1 #ifndef D0RunIIconeJets_PROTOJET
2 #define D0RunIIconeJets_PROTOJET
47 #include "ConeJetInfo.hpp"
51 #include "inline_maths.h"
53 #include <fastjet/internal/base.hh>
55 FASTJET_BEGIN_NAMESPACE
59 using namespace inline_maths;
60 using namespace D0RunIIconeJets_CONEJETINFO;
63 inline float RD2(
float y1,
float phi1,
float y2,
float phi2)
65 float dphi= delta_phi(phi1,phi2);
66 return (y1-y2)*(y1-y2)+dphi*dphi;
69 inline float RDelta(
float y1,
float phi1,
float y2,
float phi2)
71 float dphi= delta_phi(phi1,phi2);
72 return sqrt((y1-y2)*(y1-y2)+dphi*dphi);
75 inline float P2y(
float* p4vec) {
76 return y(p4vec[3],p4vec[2]);
79 inline float P2phi(
float* p4vec) {
80 return phi(p4vec[0],p4vec[1]);
89 ProtoJet(
float seedET);
90 ProtoJet(
float seedET,
float y,
float phi);
91 ProtoJet(
const ProtoJet<Item>& pj);
94 void addItem(
const Item* tw);
95 void setJet(
float y,
float phi,
float pT);
102 const ConeJetInfo & info()
const;
103 const std::list<const Item*>& LItems()
const;
105 void print(std::ostream &os)
const;
110 void splitted(){_info.splitted();};
112 void merged(){_info.merged();};
115 std::list<const Item*> _LItems;
124 ProtoJet<Item>::ProtoJet(
float seedET) : _LItems(), _info(seedET) {
131 ProtoJet<Item>::ProtoJet(
float seedET,
float y_in,
float phi_in) : _LItems(), _info(seedET) {
138 ProtoJet<Item>::ProtoJet(
const ProtoJet<Item>& pj): _y(pj._y),
139 _phi(pj._phi), _pT(pj._pT),
142 typename std::list<const Item*>::const_iterator it;
143 for(it = pj._LItems.begin(); it != pj._LItems.end(); ++it) {
144 _LItems.push_back(*it);
149 void ProtoJet<Item>::addItem(
const Item* tw) {
150 _LItems.push_back(tw);
154 void ProtoJet<Item>::setJet(
float y_in,
float phi_in,
float pT_in) {
161 void ProtoJet<Item>::updateJet() {
165 float p[4] = {0.,0.,0.,0.};
166 typename std::list<const Item*>::iterator it;
167 for(it = _LItems.begin(); it != _LItems.end(); ++it)
172 for (
int i = 0; i < 4 ; ++i) p[i] += pk[i];
176 _pT = sqrt(p[0]*p[0] + p[1]*p[1]);
177 if ( p[3] < 0. ) _pT = - _pT;
182 void ProtoJet<Item>::erase() {
183 _LItems.erase(_LItems.begin(),_LItems.end());
192 void ProtoJet<Item>::NowStable() {
193 _info.initialET(_pT);
197 void ProtoJet<Item>::print(std::ostream& os)
const {
198 os<<
"y phi Et = ("<<_y<<
", "<<_phi<<
", "<<this->_Et<<
")"<<std::endl;
199 os<<
" members= " << std::endl;
200 typename std::list<const Item*>::const_iterator i;
201 for(i = _LItems.begin(); i != _LItems.end(); ++i)
207 inline float ProtoJet<Item>::y()
const{
212 inline float ProtoJet<Item>::phi()
const{
217 inline float ProtoJet<Item>::pT()
const{
221 inline const ConeJetInfo & ProtoJet<Item>::info()
const{
226 inline const std::list<const Item*>& ProtoJet<Item>::LItems()
const{
233 FASTJET_END_NAMESPACE