Skip to content

Commit

Permalink
adding pt requirement on Tau/Leptons, and creating central jets
Browse files Browse the repository at this point in the history
  • Loading branch information
amarini committed Jul 14, 2015
1 parent 849a770 commit 7f2832b
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 4 deletions.
2 changes: 2 additions & 0 deletions interface/Event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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; }
Expand Down
12 changes: 11 additions & 1 deletion interface/Jet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,16 +25,23 @@ 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
// ---
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)
Expand Down
5 changes: 4 additions & 1 deletion interface/Lepton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Lepton : virtual public Object
{
protected:
float isocut_;
float ptcut_;
public:
Lepton() ;

Expand All @@ -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); }
Expand Down
2 changes: 1 addition & 1 deletion interface/Tau.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 17 additions & 0 deletions src/Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ Jet * Event::GetJet( int iJet )
return jets_[ valid[iJet].second];
}

// Get Object functions
Jet * Event::GetCentralJet( int iJet )
{
vector<pair<float,int> > valid; // pt, idx
for(int i = 0 ; i<jets_.size() ;++i)
{
if ( jets_[i]->IsCentralJet()) valid.push_back(pair<float,int>(jets_[i]->Pt(),i));
}

if (valid.size() == 0 ) return NULL;
if (valid.size() <= iJet ) return NULL;

sort(valid.begin(),valid.end(),[](pair<float,int> &a,pair<float,int> &b) { if (a.first> b.first) return true; if (a.first<b.first) return false; return a.second<b.second;} ) ;

return jets_[ valid[iJet].second];
}

Jet * Event::GetBjet( int iJet )
{
vector<pair<float,int> > valid; // pt, idx
Expand Down
1 change: 1 addition & 0 deletions src/Jet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Jet::Jet() : Object(){
bcut_=0.5; // define bjets
ptcut_=30.;
etacut_=4.7;
etacutcentral_=2.4;
}

// Local Variables:
Expand Down
1 change: 1 addition & 0 deletions src/Lepton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Lepton::Lepton() : Object() {
iso =-1;
charge = 0 ;
isocut_ = 10;
ptcut_ = 15;
type=0;
}

Expand Down
13 changes: 12 additions & 1 deletion src/Tau.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@
#include <iostream>
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<idcut_ ) return 0;
if (iso>=isocut_ ) return 0;
if (iso2 >= isocut_ ) return 0;
return 1;
}
// Local Variables:
Expand Down

0 comments on commit 7f2832b

Please sign in to comment.