ATLAS Offline Software
JetKinematics.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // emacs this is -*-C++-*-
6 #ifndef JETUTILS_JETKINEMATICS_H
7 #define JETUTILS_JETKINEMATICS_H
8 
9 // #include "EventKernel/I4Momentum.h"
10 
11 // //#include "FourMom/P4Help.h"
12 // #include "FourMomUtils/P4Helpers.h"
13 
14 // #include "JetEvent/Jet.h"
15 // #include "JetUtils/JetDistances.h"
16 
17 // #include <cmath>
18 
19 // struct JetKinematics
20 // {
21 
22 // typedef CLHEP::Hep3Vector vector_t;
23 
24 // static double dotProduct(const I4Momentum* pJet1, const I4Momentum* pJet2)
25 // {
26 // return
27 // vector_t(pJet1->px(),pJet1->py(),pJet1->pz()).dot(vector_t(pJet2->px(),
28 // pJet2->py(),
29 // pJet2->pz()));
30 // };
31 
32 // static double dotProductTrans(const I4Momentum* pJet1,
33 // const I4Momentum* pJet2)
34 // {
35 // return
36 // vector_t(pJet1->px(),pJet1->py(),double(0.)).dot(vector_t(pJet2->px(),
37 // pJet2->py(),
38 // double(0.)));
39 // };
40 
41 // static vector_t crossProduct(const I4Momentum* pJet1,
42 // const I4Momentum* pJet2)
43 // {
44 // return
45 // vector_t(pJet1->px(),pJet1->py(),pJet1->pz()).cross(vector_t(pJet2->px(),
46 // pJet2->py(),
47 // pJet2->
48 // pz()));
49 // };
50 
51 // static CLHEP::Hep3Vector crossProductTrans(const I4Momentum* pJet1,
52 // const I4Momentum* pJet2)
53 // {
54 // return
55 // vector_t(pJet1->px(),pJet1->py(),double(0.)).cross(vector_t(pJet2->px(),
56 // pJet2->py(),
57 // double(0.)));
58 
59 // };
60 
61 // static double projPtContrib(const I4Momentum* pJet1,
62 // const I4Momentum* pJet2)
63 // {
64 // if ( pJet1->pt() == 0 || pJet2->pt() == 0. ) return 0.;
65 // // calculate projection (absolute)
66 // return dotProductTrans(pJet1,pJet2)/pJet1->pt();
67 // };
68 
69 // static double perpPtContrib(const I4Momentum* pJet1,
70 // const I4Momentum* pJet2)
71 // {
72 // if ( pJet1->pt() == 0 || pJet2->pt() == 0. ) return 0.;
73 // // calculate perpendicular component (absolute)
74 // return (crossProductTrans(pJet1,pJet2).mag())/pJet1->pt();
75 // };
76 
77 // static double integratedProjPt(const Jet* pJet,
78 // const double& radius)
79 // {
80 // Jet::constituent_iterator fCon(pJet->begin());
81 // Jet::constituent_iterator lCon(pJet->end());
82 // double intPtProj(double(0.0));
83 // for ( ; fCon != lCon; fCon++ )
84 // {
85 // if ( P4Helpers::deltaR(pJet,(*fCon)) < radius )
86 // {
87 // intPtProj += projPtContrib(pJet,(*fCon));
88 // }
89 // }
90 // return intPtProj;
91 // };
92 
93 
94 
95 
96 // template<class CONT>
97 // static double ptWeightedWidth(CONT & c, const I4Momentum* axis){
98 // typename CONT::const_iterator it = c.begin();
99 // typename CONT::const_iterator itE = c.end();
100 // return ptWeightedWidth(it, itE, axis);
101 // }
102 
103 // template<class ITERATOR>
104 // static double ptWeightedWidth(ITERATOR & it, ITERATOR & itE, const I4Momentum* axis){
105 // double jetPtSumConst = 0;
106 // double jetWidth = 0;
107 
108 // for( ; it!=itE; ++it)
109 // {
110 // double dR = JetDistances::deltaR(axis,(*it));
111 // double pt=(*it)->pt();
112 // jetWidth += dR * pt;
113 // jetPtSumConst += pt;
114 // }
115 
116 // if(jetPtSumConst <= 0)
117 // return -1;
118 
119 // jetWidth = jetWidth / jetPtSumConst;
120 // return jetWidth;
121 // }
122 
123 
124 // /// Functions to compute various kinematic quantities related to a collection of
125 // /// 4Momentum in a single call.
126 // /// As a compromise for a stable yet flexible interface, we simply use a vector<double> as
127 // /// the returned object with an enum helper to flag each value in this vector.
128 // struct CollectionQuantities {
129 // enum {
130 // N, SumPt, WeightedWidth,
131 // Px,Py,Pz,E,
132 // MAX
133 // };
134 // Jet::hlv_t toHepLotentzVect(std::vector<double> & v){ return Jet::hlv_t(v[Px], v[Py], v[Pz], v[E]); }
135 // };
136 
137 // template<class CONT>
138 // static std::vector<double> computeCollectionQuantities(CONT &c,const I4Momentum* parent){
139 // typename CONT::const_iterator it = c.begin();
140 // typename CONT::const_iterator itE = c.end();
141 // return computeCollectionQuantities(it, itE, parent);
142 // }
143 // template<class ITERATOR>
144 // static std::vector<double> computeCollectionQuantities(ITERATOR & it, ITERATOR & itE, const I4Momentum* parent){
145 // std::vector<double> outV(CollectionQuantities::MAX,0.0);
146 // typedef CollectionQuantities CQ;
147 // for( ; it!=itE; ++it)
148 // {
149 // double dR = JetDistances::deltaR(parent,(*it));
150 // double pt=(*it)->pt();
151 // outV[CQ::WeightedWidth] += dR * pt;
152 // outV[CQ::SumPt] += pt;
153 // outV[CQ::N]+=1;
154 // outV[CQ::Px] += (*it)->px();outV[CQ::Py] += (*it)->py();outV[CQ::Pz] += (*it)->pz();outV[CQ::E] += (*it)->e();
155 // }
156 
157 // if(outV[CQ::SumPt] > 0){
158 // outV[CQ::WeightedWidth] = outV[CQ::WeightedWidth] / outV[CQ::SumPt] ;
159 // } else outV[CQ::WeightedWidth] = -1;
160 
161 // return outV;
162 // }
163 
164 
165 };
166 #endif