SusyNtuple
SusyNtuple/KinematicTools.h
00001 #ifndef SusyNtuple_KinematicTools_h
00002 #define SusyNtuple_KinematicTools_h
00003 
00004 // stl
00005 #include <iostream>
00006 
00007 // SusyNtuple
00008 #include "SusyNtuple/SusyDefs.h"
00009 #include "SusyNtuple/SusyNt.h"
00010 #include "SusyNtuple/SusyNtObject.h"
00011 
00012 using namespace Susy;
00013 
00014 namespace kin {
00015 
00016 /* ----------------------------------------------------------------- */
00017 /*  Event- and Object-level quantities [begin]                       */
00018 /* ----------------------------------------------------------------- */
00019 
00021 // SUSY-ness
00023 bool eventHasSusyPropagators(const std::vector<int> &pdgs, const std::vector<std::vector<int>> &parentIndices);
00024 
00025 /* ----------------------------------------------------------------- */
00026 /*  Kinematic calculations [begin]                                   */
00027 /* ----------------------------------------------------------------- */
00028 
00030 // SFOS removal methods
00032 void removeSFOSPair(ElectronVector& elecs, float MllCut);
00033 void removeSFOSPair(MuonVector& muons, float MllCut);
00034 void removeSFOSPair(TauVector& taus, float MllCut);
00035 
00037 // Lepton counting methods
00039 bool hasNLeptonsPtThreshold(const LeptonVector& leps, int nLepCut, float ptCut);
00040 
00042 // Lepton flavor and sign methods
00044 // check if two leptons are SF
00045 bool isSameFlav(const Lepton* l1, const Lepton* l2);
00046 bool isSameFlav(const Lepton& l1, const Lepton& l2);
00047 // check if two leptons are OS
00048 bool isOppSign(const Lepton* l1, const Lepton* l2);
00049 bool isOppSign(const Lepton& l1, const Lepton& l2);
00050 // check if two taus are OS
00051 bool isOppSign(const Tau* tau1, const Tau* tau2);
00052 bool isOppSign(const Tau& tau1, const Tau& tau2);
00053 // check if a lepton-tau pair are OS
00054 bool isOppSign(const Lepton* l1, const Tau* tau1);
00055 bool isOppSign(const Lepton& l1, const Tau& tau1);
00056 bool isOppSign(const Tau* tau1, const Lepton* l2);
00057 bool isOppSign(const Tau& tau1, const Lepton& l2);
00058 
00059 // check if two leptons form an SFOS pair
00060 bool isSFOS(const Lepton* l1, const Lepton* l2);
00061 bool isSFOS(const Lepton& l1, const Lepton& l2);
00062 // check if two leptons form an SFSS pair
00063 bool isSFSS(const Lepton* l1, const Lepton* l2);
00064 bool isSFSS(const Lepton& l1, const Lepton& l2);
00065 // check if two leptons form an OFOS pair
00066 bool isOFOS(const Lepton* l1, const Lepton* l2);
00067 bool isOFOS(const Lepton& l1, const Lepton& l2);
00068 
00069 // check if a set of leptons has an SFOS pair
00070 bool hasSFOS(const LeptonVector& leps);
00071 // check if a set of leptons has an SFSS pair
00072 bool hasSFSS(const LeptonVector& leps);
00073 // check if a set of leptons has an OFOS pair
00074 bool hasOFOS(const LeptonVector& leps);
00075 
00076 // check if a set of leptons has an OS pair
00077 bool hasOS(const LeptonVector& leps);
00078 // check if a set of taus has an OS pair
00079 bool hasOS(const TauVector& taus);
00080 
00081 // check if a set of leptons has an SS pair
00082 bool hasSS(const LeptonVector& leps);
00083 // check if a set of taus has an SS pair
00084 bool hasSS(const TauVector& taus);
00085 
00087 // Lepton selection methods
00089 // select SS lepton pair with highest pT
00090 LeptonVector getSSLeptonPair(const LeptonVector& leps);
00091 
00092 
00094 // Mass calculation methods
00096 float Mll(const Particle* p1, const Particle* p2);
00097 float Mll(const Particle& p1, const Particle& p2);
00098 
00099 float Mlll(const Particle* p1, const Particle* p2, const Particle* p3);
00100 float Mlll(const Particle& p1, const Particle& p2, const Particle& p3);
00101 
00102 float Mllll(const Particle* p1, const Particle* p2, const Particle* p3, const Particle* p4);
00103 float Mllll(const Particle& p1, const Particle& p2, const Particle& p3, const Particle& p4);
00104 
00105 // di-jet mass
00106 float Mjj(const Jet* j1, const Jet* j2);
00107 float Mjj(const Jet& j1, const Jet& j2);
00108 
00109 // di-lepton, d-jet mass
00110 float Mlljj(const Lepton* l1, const Lepton* l2, const Jet* j1, const Jet* j2);
00111 float Mlljj(const Lepton& l1, const Lepton& l2, const Jet& j1, const Jet& j2);
00112 
00113 // mljj -- invariant mass of (dijet + closest lepton)-system
00114 float Mljj(const LeptonVector& leptons, const JetVector& jets);
00115 
00116 // W-transverse mass
00117 float Mt(const TLorentzVector* lep, const Met* met);
00118 float Mt(const TLorentzVector& lep, const Met& met);
00119 
00120 // effective mass -- jets + met
00121 float Meff(const JetVector& jets, const Met* met, float jetPtCut=40.);
00122 float Meff(const JetVector& jets, const Met& met, float jetPtCut=40.);
00123 
00124 // effecitve mass -- leptons + jets + met
00125 float Meff(const LeptonVector& leps, const JetVector& jets, const Met* met, float jetPtCut=40.);
00126 float Meff(const LeptonVector& leps, const JetVector& jets, const Met& met, float jetPtCut=40.);
00127 
00128 // effective mass -- leptons + taus + jets + met
00129 float Meff(const LeptonVector& leps, const TauVector& taus, const JetVector& jets, const Met* met, float jetPtCut=40.);
00130 float Meff(const LeptonVector& leps, const TauVector& taus, const JetVector& jets, const Met& met, float jetPtCut=40.);
00131 
00133 // Z-selection methods
00135 // dilepton invariant mass within massWindow of Z
00136 bool isZ(const Lepton* l1, const Lepton* l2, float massWindow = 10.);
00137 bool isZ(const Lepton& l1, const Lepton& l2, float massWindow = 10.);
00138 
00139 // trilepton invariant mass within massWindow of Z (there must be an SFOS pair)
00140 bool isZ(const Lepton* l1, const Lepton* l2, const Lepton* l3, float massWindow = 10.);
00141 bool isZ(const Lepton& l1, const Lepton& l2, const Lepton& l3, float massWindow = 10.);
00142 
00143 // tetra-lepton invariant mass within massWindow of Z (there must be 2 SFOS pairs)
00144 bool isZ(const Lepton* l1, const Lepton* l2, const Lepton* l3, const Lepton* l4, float massWindow = 10.);
00145 bool isZ(const Lepton& l1, const Lepton& l2, const Lepton& l3, const Lepton& l4, float massWindow = 10.);
00146 
00147 // check to see if two leptons have invariant mass within specified window around Z
00148 bool isZWindow(const Lepton* l1, const Lepton* l2, float minMll = MZ-10., float maxMll = MZ+10.);
00149 bool isZWindow(const Lepton& l1, const Lepton& l2, float minMll = MZ-10., float maxMll = MZ+10.);
00150 
00151 // check to see if in a set of leptons there is an SFOS pair within the specified Z massWindow
00152 bool hasZWindow(const LeptonVector& leps, float minMll = MZ-10., float maxMll = MZ+10.);
00153 
00154 // check to see if a set of leptons is within the Z-window
00155 bool hasZ(const LeptonVector& leps, float massWindow = 10., bool useMultiLep = false);
00156 bool hasZ(const LeptonVector& leps, uint* Zl1, uint* Zl2, float massWindow = 10., bool useMultiLep = false);
00157 bool hasZ(const LeptonVector& leps, uint& Zl1, uint& Zl2, float massWindow = 10., bool useMultiLep = false);
00158 
00159 // check if three leptons are inside the massWindow around Z
00160 bool hasZlll(const LeptonVector& leps, float massWindow = 10.);
00161 
00162 // check if four leptons are inside the massWindow around Z
00163 bool hasZllll(const LeptonVector& leps, float massWindow = 10.);
00164 
00165 // check if two Z decay leptonically, provide the lepton indices for each Z
00166 bool hasZllZll(const LeptonVector& leps, uint* Z1l1, uint* Z1l2, uint* Z2l1, uint* Z2l2, float massWindow = 10.);
00167 bool hasZllZll(const LeptonVector& leps, uint& Z1l1, uint& Z1l2, uint& Z2l1, uint& Z2l2, float MassWindow = 10.);
00168 
00169 // find indices for the lepton pair closest to the Z-mass
00170 bool findBestZ(uint* l1, uint* l2, const LeptonVector& leps);
00171 bool findBestZ(uint& l1, uint& l2, const LeptonVector& leps);
00172 
00173 // find indices for the jet pair closest to the Z-mass
00174 bool findBestZ(uint* j1, uint* j2, const JetVector& jets);
00175 bool findBestZ(uint& j1, uint& j2, const JetVector& jets);
00176 
00178 // W-selection methods
00180 // find indices for the jet pair closest to the W-mass
00181 bool findBestW(uint* j1, uint* j2, const JetVector& jets);
00182 bool findBestW(uint& j1, uint& j2, const JetVector& jets);
00183 
00185 // MissingET Rel (METrel METRel metrel)
00187 float getMetRel(const Met* met, const LeptonVector& leptons, const JetVector& jets);
00188 float getMetRel(const Met& met, const LeptonVector& leptons, const JetVector& jets);
00189 
00191 // MT2 calculation methods (mt2 Mt2)
00193 // calculate lepton mt2, leptons are assumed massless (massless LSP)
00194 float getMT2(const LeptonVector& leptons, const Met* met);
00195 float getMT2(const LeptonVector& leptons, const Met& met);
00196 
00197 // calculate mt2 using two visible objects p1 and p2 that are assumed massless (massless LSP)
00198 float getMT2(const TLorentzVector* p1, const TLorentzVector* p2, const Met* met);
00199 float getMT2(const TLorentzVector& p1, const TLorentzVector& p2, const Met& met);
00200 
00201 // calculate mt2 using two visible objects p1 and p2, specifiy whether to treat massless (set LSP mass)
00202 float getMT2(const TLorentzVector* p1, const TLorentzVector* p2, const Met* met, bool zeroMass, float lspMass = 0);
00203 float getMT2(const TLorentzVector& p1, const TLorentzVector& p2, const Met& met, bool zeroMass, float lspMass = 0);
00204 
00206 // MCT calculation methods Mct mct
00208 float calcMCT(TLorentzVector v1, TLorentzVector v2);
00209 
00211 // HT calculation methods (Ht ht)
00213 // ht -- jets
00214 float getHT(const JetVector& jets, float jetPtCut = 40.);
00215 
00217 // Calculate transverse thrust Transverse Thrust
00219 float getThrT(const LeptonVector& leptons);
00220 
00221 
00223 // Top Tagging top tagging methods
00225 // di-leptonic ttbar tagging method originally from SUSYTools
00226 bool passTopTag(const LeptonVector& leptons, const JetVector& jets, const Met* met, int op = 0, float ptJetCut = 0, float mEffCut = 100);
00227 bool passTopTag(const LeptonVector& leptons, const JetVector& jets, const Met& met, int op = 0, float ptJetCut = 0, float mEffCut = 100);
00228 bool toptag0j(TLorentzVector v1l, TLorentzVector v2l, TVector2 met);
00229 bool toptag2j(double ptjcut, double meffcut, TLorentzVector v1l, TLorentzVector v2l, TLorentzVector v1j, TLorentzVector v2j, TVector2 met, int opt);
00230 
00232 // Super-Razor Super Razor Super razor super razor (leptonic) calculation
00234 void superRazor(const LeptonVector& leptons, const Met* met, TVector3& vBETA_z, TVector3& pT_CM,
00235                 TVector3& vBETA_T_CMtoR, TVector3& vBETA_R,
00236                 double& SHATR, double& dphi_LL_vBETA_T, double& dphi_L1_L2,
00237                 double& gamma_R, double& dphi_vBETA_R_vBETA_T,
00238                 double& MDELTAR, double& costhetaRp1);
00239 void superRazor(const LeptonVector& leptons, const Met& met, TVector3& vBETA_z, TVector3& pT_CM,
00240                 TVector3& vBETA_T_CMtoR, TVector3& vBETA_R,
00241                 double& SHATR, double& dphi_LL_vBETA_T, double& dphi_L1_L2,
00242                 double& gamma_R, double& dphi_vBETA_R_vBETA_T,
00243                 double& MDELTAR, double& costhetaRp1);
00244 
00245 
00246 
00247 } // kin
00248 
00249 
00250 
00251 
00252 
00253 
00254 
00255 
00256 
00257 #endif
 All Classes Functions Variables Typedefs Enumerations Enumerator