Page MenuHomeHEPForge

Jet.hh
No OneTemporary

#ifndef _JET_HH_
#define _JET_HH_
#include "LorentzVector.hh"
#include <list>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
namespace SpartyJet {
class Jet : public LorentzVector {
public :
typedef std::list<Jet*> constit_vect_t;
typedef std::vector<Jet*> jet_list_t;
typedef std::vector<Jet*>::const_iterator const_iterator;
Jet(): LorentzVector(0,0,0,0) {}
Jet(double p1, double p2, double p3, double p0, int index=0): LorentzVector(p1,p2,p3,p0), m_index(index){}
Jet(LorentzVector v): LorentzVector(v) {m_index = 0;}
Jet(Jet &j);
Jet(Jet *j);
~Jet();
/// The standard way of merging jets
void addJet(Jet& j);
void addJet(Jet* j);
/// Access jet constituents
int getConstituentNum(){return m_constituents.size();}
constit_vect_t::iterator firstConstituent(){ return m_constituents.begin();};
constit_vect_t::iterator lastConstituent(){ return m_constituents.end();};
// convenience methods
void addConstituent(Jet* jet) {m_constituents.push_back(jet);this->add(*jet);};
void addConstituent(constit_vect_t::iterator first, constit_vect_t::iterator last);
void removeConstituent(Jet* jet) {m_constituents.remove(jet);this->subtract(*jet);};
void addConstituent_notMoment(Jet* jet){m_constituents.push_back(jet);}
//void removeConstituent(constit_vect_t::iterator first, constit_vect_t::iterator last);
// return position in initial collection
int index() const {return m_index;}
void set_index(int i){m_index= i;}
// return position in history
int historyIndex() const {return m_historyIndex;}
void setHistoryIndex(int i){m_historyIndex= i;}
/// Atlas compatibility code :
LorentzVector hlv() {return *this;}
//bool split_merged; // from siscone/jetclu/midpoint algorithms
ClassDef(Jet,0);
protected :
int m_index; /// position in a jet list (used for constituents positions)
int m_historyIndex; /// position in a history sequence
constit_vect_t m_constituents;
public:
//static std::set<Jet *> deadJets; // for debugging
};
// using functors is supposed to be faster... (??)
class JetSorter_Et {
public:
bool operator()(Jet* j1, Jet* j2){
// deal with numerical uncertainty :
if(fabs( j1->et() - j2->et())<0.001 ) return 0;
else return j1->et() > j2->et();
//return (j1->et() > j2->et());
}
};
class JetSorter_Pt {
public:
bool operator()(Jet* j1, Jet* j2){
return (j1->pt() > j2->pt());
}
};
class JetSorter_Eta {
public:
bool operator()(Jet* j1, Jet* j2){
return (j1->eta() > j2->eta());
}
};
class JetSorter_E {
public:
bool operator()(Jet* j1, Jet* j2){
return (j1->e() > j2->e());
}
};
template<class T>
inline void sort_jet_list(Jet::jet_list_t &list){
std::sort(list.begin(),list.end(), T());
}
inline void sort_list_et(Jet::jet_list_t &list){
//std::sort(list.begin(),list.end(),et_compare);
std::sort(list.begin(),list.end(), JetSorter_Et());
}
inline void sort_list_pt(Jet::jet_list_t &list){
std::sort(list.begin(),list.end(),JetSorter_Pt());
}
Jet* jet_from_overlap(Jet* j1, Jet* j2);
} // namespace SpartyJet
#endif

File Metadata

Mime Type
text/x-c++
Expires
Thu, Apr 24, 6:32 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4834828
Default Alt Text
Jet.hh (3 KB)

Event Timeline