From 7f2832bbc968bd268b5afe6c18ce2a46db24a827 Mon Sep 17 00:00:00 2001 From: Andrea Marini Date: Tue, 14 Jul 2015 16:27:00 +0200 Subject: [PATCH] adding pt requirement on Tau/Leptons, and creating central jets --- interface/Event.hpp | 2 ++ interface/Jet.hpp | 12 +++++++++++- interface/Lepton.hpp | 5 ++++- interface/Tau.hpp | 2 +- src/Event.cpp | 17 +++++++++++++++++ src/Jet.cpp | 1 + src/Lepton.cpp | 1 + src/Tau.cpp | 13 ++++++++++++- 8 files changed, 49 insertions(+), 4 deletions(-) diff --git a/interface/Event.hpp b/interface/Event.hpp index 0f83c05e3360b..88abcc08ff6fc 100644 --- a/interface/Event.hpp +++ b/interface/Event.hpp @@ -42,6 +42,7 @@ class Event{ // This functions should check if the objects are valid // Get NULL in case of failure Jet * GetJet( int iJet ); + Jet * GetCentralJet( int iJet ); Jet * GetBjet( int iJet ); Tau * GetTau( int iTau ); Lepton * GetLepton( int iLep ); @@ -54,6 +55,7 @@ class Event{ inline float Rho() { return rho_; } inline float Ht() { float ht=0 ; for(auto j : jets_ ) if( j->IsJet() ) ht+= j->Pt() ; return ht;} inline int Njets(){ int n=0 ; for(auto j : jets_ ) if( j->IsJet() ) n+=1; return n; } + inline int NcentralJets(){ int n=0 ; for(auto j : jets_ ) if( j->IsCentralJet() ) n+=1; return n; } inline int Bjets(){ int n=0 ; for(auto j : jets_ ) if( j->IsBJet() ) n+=1; return n; } inline int Ntaus(){ int n=0 ; for(auto t : taus_ ) if( t->IsTau() ) n+=1; return n; } inline int Nleps(){ int n=0 ; for(auto t : leps_ ) if( t->IsLep() ) n+=1; return n; } diff --git a/interface/Jet.hpp b/interface/Jet.hpp index c2422ba3ae18f..7e3f2d1291662 100644 --- a/interface/Jet.hpp +++ b/interface/Jet.hpp @@ -10,8 +10,11 @@ class Jet : virtual public Object // float ptcut_; // ** pt cut on the accepted jets float etacut_ ; // ** eta cut on the accepted jets + float etacutcentral_; float bcut_; /// ** bcut on the bJets discr + public: + Jet() ; int isValid; // rejected by DR @@ -22,6 +25,7 @@ class Jet : virtual public Object float bdiscr; // float bunc; // TOFILL int bsyst ; + // --- inline float Pt(){ if (syst ==0) return p4.Pt(); return p4.Pt() *(1.0 + unc*syst );} virtual inline void clearSyst(){syst = 0;bsyst=0; isValid=1;}; // reset smearing @@ -29,9 +33,15 @@ class Jet : virtual public Object virtual inline int IsObject(){return IsJet();} inline int IsJet() { if (not isValid) return 0 ; if( Pt() < ptcut_ ) return 0; - if( Eta() >= etacut_) return 0; + if( fabs(Eta()) >= etacut_) return 0; return 1; } + + inline int IsCentralJet() { + if ( not IsJet() ) return 0; + if ( fabs(Eta()) >= etacutcentral_ ) return 0; + } + inline int IsBJet(){ if( bdiscr > bcut_ + bsyst*bunc and IsJet() ) return 1; return 0;} inline void computeValidity( Object* o, float dR = 0.4) diff --git a/interface/Lepton.hpp b/interface/Lepton.hpp index 8e1e67854e49a..44315e253eb0b 100644 --- a/interface/Lepton.hpp +++ b/interface/Lepton.hpp @@ -7,6 +7,7 @@ class Lepton : virtual public Object { protected: float isocut_; + float ptcut_; public: Lepton() ; @@ -15,7 +16,9 @@ class Lepton : virtual public Object int type;// abspdgid 11 o 13 virtual inline int IsLep(){ - if (iso> isocut_) return 0; + if ( iso > isocut_) return 0; + if ( Pt() < ptcut_ ) return 0; + return 1; } virtual inline bool IsElectron(){ return IsLep() and (type == 11); } diff --git a/interface/Tau.hpp b/interface/Tau.hpp index 4e2d81ed3032b..bd8fdc54983b2 100644 --- a/interface/Tau.hpp +++ b/interface/Tau.hpp @@ -11,7 +11,7 @@ class Tau: virtual public Object, public: - Tau() : Lepton() { idcut_ = 0.5; match = -999; ; isocut_=100; iso2 = -999; id_ele= -1; id_mu=-1;} + Tau() ; float id; float iso2; int id_ele; diff --git a/src/Event.cpp b/src/Event.cpp index 121935af80f3f..73d57bec975ac 100644 --- a/src/Event.cpp +++ b/src/Event.cpp @@ -76,6 +76,23 @@ Jet * Event::GetJet( int iJet ) return jets_[ valid[iJet].second]; } +// Get Object functions +Jet * Event::GetCentralJet( int iJet ) +{ + vector > valid; // pt, idx + for(int i = 0 ; iIsCentralJet()) valid.push_back(pair(jets_[i]->Pt(),i)); + } + + if (valid.size() == 0 ) return NULL; + if (valid.size() <= iJet ) return NULL; + + sort(valid.begin(),valid.end(),[](pair &a,pair &b) { if (a.first> b.first) return true; if (a.first > valid; // pt, idx diff --git a/src/Jet.cpp b/src/Jet.cpp index 2bb479bd0a8b5..ae241c00a9ff6 100644 --- a/src/Jet.cpp +++ b/src/Jet.cpp @@ -11,6 +11,7 @@ Jet::Jet() : Object(){ bcut_=0.5; // define bjets ptcut_=30.; etacut_=4.7; + etacutcentral_=2.4; } // Local Variables: diff --git a/src/Lepton.cpp b/src/Lepton.cpp index 76d74595e346e..f65b930c2b350 100644 --- a/src/Lepton.cpp +++ b/src/Lepton.cpp @@ -5,6 +5,7 @@ Lepton::Lepton() : Object() { iso =-1; charge = 0 ; isocut_ = 10; + ptcut_ = 15; type=0; } diff --git a/src/Tau.cpp b/src/Tau.cpp index f8517c1b3e786..d21fa4ce0470d 100644 --- a/src/Tau.cpp +++ b/src/Tau.cpp @@ -3,9 +3,20 @@ #include using namespace std; +Tau::Tau() : Lepton(){ + ptcut_ = 41; + isocut_= 1.5; + idcut_ = 0.5; + + match = -999; ; // matching with generator + iso2 = -999; // Iso with Delta beta correction + id_ele= -1; + id_mu=-1; +} + int Tau::IsTau(){ if (id=isocut_ ) return 0; + if (iso2 >= isocut_ ) return 0; return 1; } // Local Variables: