1 | #include "KtJet/KtRecom.h"
|
---|
2 | #include "KtJet/KtUtil.h"
|
---|
3 | #include "KtJet/KtRecomInterface.h"
|
---|
4 | #include <string>
|
---|
5 |
|
---|
6 | namespace KtJet {
|
---|
7 | //using CLHEP::HepLorentzVector;
|
---|
8 | using namespace CLHEP;
|
---|
9 |
|
---|
10 | KtRecom* getRecomScheme(int recom) {
|
---|
11 | if (recom == 1) return new KtRecomE();
|
---|
12 | else if (recom == 2) return new KtRecomPt();
|
---|
13 | else if (recom == 3) return new KtRecomPt2();
|
---|
14 | else if (recom == 4) return new KtRecomEt();
|
---|
15 | else if (recom == 5) return new KtRecomEt2();
|
---|
16 | else{
|
---|
17 | std::cout << "WARNING, unreconised recombination scheme specified!" << std::endl;
|
---|
18 | std::cout << "Recombination Scheme set to KtRecomE" << std::endl;
|
---|
19 | return new KtRecomE();
|
---|
20 | }
|
---|
21 | }
|
---|
22 |
|
---|
23 |
|
---|
24 | KtRecomE::KtRecomE() : m_name("E") {}
|
---|
25 | //KtRecomE::~KtRecomE() {}
|
---|
26 | std::string KtRecomE::name() const {return m_name;}
|
---|
27 |
|
---|
28 | HepLorentzVector KtRecomE::operator()(const HepLorentzVector &a, const HepLorentzVector &b) const {
|
---|
29 | return a+b;
|
---|
30 | }
|
---|
31 |
|
---|
32 | KtLorentzVector KtRecomE::operator()(const KtLorentzVector &a) const {
|
---|
33 | return a;
|
---|
34 | }
|
---|
35 |
|
---|
36 | KtRecomPt::KtRecomPt() : m_name("Pt") {}
|
---|
37 | //KtRecomPt::~KtRecomPt() {}
|
---|
38 | std::string KtRecomPt::name() const {return m_name;}
|
---|
39 |
|
---|
40 | HepLorentzVector KtRecomPt::operator()(const HepLorentzVector &a, const HepLorentzVector &b) const {
|
---|
41 | KtFloat pti, ptj, newPt, newEta, newPhi, deltaPhi;
|
---|
42 | pti = a.perp();
|
---|
43 | ptj = b.perp();
|
---|
44 | newPt = pti + ptj;
|
---|
45 | newEta = (pti * a.eta() + ptj * b.eta()) / newPt;
|
---|
46 | deltaPhi = phiAngle(b.phi() - a.phi());
|
---|
47 | newPhi = a.phi() + deltaPhi * ptj / newPt;
|
---|
48 | newPhi = phiAngle(newPhi);
|
---|
49 | return HepLorentzVector(newPt*cos(newPhi),newPt*sin(newPhi),newPt*sinh(newEta),newPt*cosh(newEta));
|
---|
50 | }
|
---|
51 |
|
---|
52 | /** Make 4-vector massless by setting E = p */
|
---|
53 | KtLorentzVector KtRecomPt::operator()(const KtLorentzVector &a) const {
|
---|
54 | KtLorentzVector v = a;
|
---|
55 | v.setE(a.vect().mag());
|
---|
56 | return v;
|
---|
57 | }
|
---|
58 |
|
---|
59 |
|
---|
60 | KtRecomPt2::KtRecomPt2() : m_name("Pt^2") {}
|
---|
61 | //KtRecomPt2::~KtRecomPt2() {}
|
---|
62 | std::string KtRecomPt2::name() const {return m_name;}
|
---|
63 |
|
---|
64 | HepLorentzVector KtRecomPt2::operator()(const HepLorentzVector &a, const HepLorentzVector &b) const {
|
---|
65 | KtFloat pti, ptj, ptisq, ptjsq, newPt, newEta, newPhi, deltaPhi;
|
---|
66 | pti = a.perp();
|
---|
67 | ptj = b.perp();
|
---|
68 | ptisq = a.perp2();
|
---|
69 | ptjsq = b.perp2();
|
---|
70 | newPt = pti + ptj;
|
---|
71 | newEta = (ptisq * a.eta() + ptjsq * b.eta()) / (ptisq + ptjsq);
|
---|
72 | deltaPhi = phiAngle(b.phi() - a.phi());
|
---|
73 | newPhi = a.phi() + deltaPhi * ptjsq / (ptisq + ptjsq);
|
---|
74 | newPhi = phiAngle(newPhi);
|
---|
75 | return HepLorentzVector(newPt*cos(newPhi),newPt*sin(newPhi),newPt*sinh(newEta),newPt*cosh(newEta));
|
---|
76 | }
|
---|
77 |
|
---|
78 | /** Make 4-vector massless by setting E = p */
|
---|
79 | KtLorentzVector KtRecomPt2::operator()(const KtLorentzVector &a) const {
|
---|
80 | KtLorentzVector v = a;
|
---|
81 | v.setE(a.vect().mag());
|
---|
82 | return v;
|
---|
83 | }
|
---|
84 |
|
---|
85 |
|
---|
86 | KtRecomEt::KtRecomEt() : m_name("Et") {}
|
---|
87 | //KtRecomEt::~KtRecomEt() {}
|
---|
88 | std::string KtRecomEt::name() const {return m_name;}
|
---|
89 |
|
---|
90 | HepLorentzVector KtRecomEt::operator()(const HepLorentzVector &a, const HepLorentzVector &b) const {
|
---|
91 | KtFloat pti, ptj, newPt, newEta, newPhi, deltaPhi;
|
---|
92 | pti = a.et();
|
---|
93 | ptj = b.et();
|
---|
94 | newPt = pti + ptj;
|
---|
95 | newEta = (pti * a.eta() + ptj * b.eta()) / newPt;
|
---|
96 | deltaPhi = phiAngle(b.phi() - a.phi());
|
---|
97 | newPhi = a.phi() + deltaPhi * ptj / newPt;
|
---|
98 | newPhi = phiAngle(newPhi);
|
---|
99 | return HepLorentzVector(newPt*cos(newPhi),newPt*sin(newPhi),newPt*sinh(newEta),newPt*cosh(newEta));
|
---|
100 | }
|
---|
101 |
|
---|
102 | /** Make 4-vector massless by scaling momentum to equal E */
|
---|
103 | KtLorentzVector KtRecomEt::operator()(const KtLorentzVector &a) const {
|
---|
104 | KtLorentzVector v = a;
|
---|
105 | KtFloat scale = a.e() / a.vect().mag();
|
---|
106 | v.setVect(a.vect() * scale);
|
---|
107 | return v;
|
---|
108 | }
|
---|
109 |
|
---|
110 |
|
---|
111 | KtRecomEt2::KtRecomEt2() : m_name("Et^2") {}
|
---|
112 | //KtRecomEt2::~KtRecomEt2() {}
|
---|
113 | std::string KtRecomEt2::name() const {return m_name;}
|
---|
114 |
|
---|
115 | HepLorentzVector KtRecomEt2::operator()(const HepLorentzVector &a, const HepLorentzVector &b) const {
|
---|
116 | KtFloat pti, ptj, ptisq, ptjsq, newPt, newEta, newPhi, deltaPhi;
|
---|
117 | pti = a.et();
|
---|
118 | ptj = b.et();
|
---|
119 | ptisq = pti*pti;
|
---|
120 | ptjsq = ptj*ptj;
|
---|
121 | newPt = pti + ptj;
|
---|
122 | newEta = (ptisq * a.eta() + ptjsq * b.eta()) / (ptisq + ptjsq);
|
---|
123 | deltaPhi = phiAngle(b.phi() - a.phi());
|
---|
124 | newPhi = a.phi() + deltaPhi * ptjsq / (ptisq + ptjsq);
|
---|
125 | newPhi = phiAngle(newPhi);
|
---|
126 | return HepLorentzVector(newPt*cos(newPhi),newPt*sin(newPhi),newPt*sinh(newEta),newPt*cosh(newEta));
|
---|
127 | }
|
---|
128 |
|
---|
129 | /** Make 4-vector massless by scaling momentum to equal E */
|
---|
130 | KtLorentzVector KtRecomEt2::operator()(const KtLorentzVector &a) const {
|
---|
131 | KtLorentzVector v = a;
|
---|
132 | KtFloat scale = a.e() / a.vect().mag();
|
---|
133 | v.setVect(a.vect() * scale);
|
---|
134 | return v;
|
---|
135 | }
|
---|
136 |
|
---|
137 | }//end of namespace
|
---|