5 #include <TMatrixDSym.h>
6 #include <TMatrixDSymEigen.h>
16 for(reco::TrackCollection::const_iterator itTrack = tracks.begin(); itTrack<tracks.end(); ++itTrack) {
17 p.push_back(TVector3(itTrack->px(),itTrack->py(),itTrack->pz()));
21 TMatrixDSym MomentumTensor(3);
22 for(std::vector<TVector3>::const_iterator momentum =
p.begin();momentum<
p.end();++momentum) {
23 for(
unsigned int i=0;
i<3;
i++)
24 for(
unsigned int j=0;
j<=
i;
j++) {
25 MomentumTensor[
i][
j] += momentum[
i]*momentum[
j];
28 MomentumTensor*=1/(MomentumTensor[0][0]+MomentumTensor[1][1]+MomentumTensor[2][2]);
30 TMatrixDSymEigen eigen(MomentumTensor);
31 TVectorD eigenvals = eigen.GetEigenValues();
42 TVector3 zero(0.,0.,0.);
44 uint32_t Np =
p.size();
49 TVector3 vn, vm, vc, vl;
50 for(
unsigned int i=0;
i< Np-1;
i++)
51 for(
unsigned int j=
i+1;
j < Np;
j++) {
52 vc =
p[
i].Cross(
p[
j]);
54 for(
unsigned int k=0;
k<Np;
k++)
55 if ((
k !=
i) && (
k != j)) {
56 if (
p[
k].Dot(vc) >= 0.) vl = vl +
p[
k];
60 vn = vl +
p[
j] +
p[
i];
66 vn = vl + p[
j] - p[
i];
72 vn = vl - p[
j] + p[
i];
78 vn = vl - p[
j] - p[
i];
86 for(
int iter=1; iter<=4; iter++) {
88 for(
unsigned int i=0;
i< Np;
i++)
89 if (vm.Dot(
p[
i]) >= 0.)
94 if (vnew == vmax)
break;
101 if (
p[0].Dot(
p[1]) >= 0.)
113 for(
unsigned int i=0;
i < Np;
i++) vsum = vsum + p[
i].Mag();
116 float x = qtbo.X()/vnew;
117 float y = qtbo.Y()/vnew;
118 float z = qtbo.Z()/vnew;
119 output.SetPxPyPzE(x, y, z, v);
125 std::vector<TVector3>
pp;
126 uint32_t Np = tracks.size();
128 for(reco::TrackCollection::const_iterator itTrack = tracks.begin(); itTrack<tracks.end(); ++itTrack) {
129 pp.push_back(TVector3(itTrack->px(),itTrack->py(),itTrack->pz()));
132 TVector3 zero(0.,0.,0.);
138 TVector3 vn, vm, vc, vl;
139 for(
unsigned int i=0;
i< Np-1;
i++)
140 for(
unsigned int j=
i+1;
j < Np;
j++) {
141 vc = pp[
i].Cross(pp[
j]);
143 for(
unsigned int k=0;
k<Np;
k++)
144 if ((
k !=
i) && (
k != j)) {
145 if (pp[
k].Dot(vc) >= 0.) vl = vl + pp[
k];
146 else vl = vl - pp[
k];
149 vn = vl + pp[
j] + pp[
i];
155 vn = vl + pp[
j] - pp[
i];
161 vn = vl - pp[
j] + pp[
i];
167 vn = vl - pp[
j] - pp[
i];
175 for(
int iter=1; iter<=4; iter++) {
177 for(
unsigned int i=0;
i< Np;
i++)
178 if (vm.Dot(pp[
i]) >= 0.)
183 if (vnew == vmax)
break;
190 if (pp[0].Dot(pp[1]) >= 0.)
191 qtbo = pp[0] + pp[1];
193 qtbo = pp[0] - pp[1];
202 for(
unsigned int i=0;
i < Np;
i++) vsum = vsum + pp[
i].Mag();
205 float x = qtbo.X()/vnew;
206 float y = qtbo.Y()/vnew;
207 float z = qtbo.Z()/vnew;
208 output.SetPxPyPzE(x, y, z, v);
215 if(tracks.size()==0)
return 0;
218 TMatrixDSym MomentumTensor(3);
219 for(reco::TrackCollection::const_iterator itTrack = tracks.begin(); itTrack<tracks.end(); ++itTrack) {
220 std::vector<double> momentum(3);
221 momentum[0] = itTrack->px();
222 momentum[1] = itTrack->py();
223 momentum[2] = itTrack->pz();
224 for(
unsigned int i=0;
i<3;
i++)
225 for(
unsigned int j=0;
j<=
i;
j++) {
226 MomentumTensor[
i][
j] += momentum[
i]*momentum[
j];
229 MomentumTensor*=1/(MomentumTensor[0][0]+MomentumTensor[1][1]+MomentumTensor[2][2]);
231 TMatrixDSymEigen eigen(MomentumTensor);
232 TVectorD eigenvals = eigen.GetEigenValues();
233 vector<float> eigenvaluess(3);
234 eigenvaluess[0] = eigenvals[0];
235 eigenvaluess[1] = eigenvals[1];
236 eigenvaluess[2] = eigenvals[2];
237 sort(eigenvaluess.begin(),eigenvaluess.end());
239 float sph = ( 1.5*(1-eigenvaluess[2]));
246 if (tracks.size()==0)
return 0;
248 TMatrixDSym MomentumTensor(3);
249 for(reco::TrackCollection::const_iterator itTrack = tracks.begin(); itTrack<tracks.end(); ++itTrack) {
250 std::vector<double> momentum(3);
251 momentum[0] = itTrack->px();
252 momentum[1] = itTrack->py();
253 momentum[2] = itTrack->pz();
254 for(
unsigned int i=0;
i<3;
i++)
255 for(
unsigned int j=0;
j<=
i;
j++) {
256 MomentumTensor[
i][
j] += momentum[
i]*momentum[
j];
259 MomentumTensor*=1/(MomentumTensor[0][0]+MomentumTensor[1][1]+MomentumTensor[2][2]);
261 TMatrixDSymEigen eigen(MomentumTensor);
262 TVectorD eigenvals = eigen.GetEigenValues();
263 vector<float> eigenvaluess(3);
264 eigenvaluess[0] = eigenvals[0];
265 eigenvaluess[1] = eigenvals[1];
266 eigenvaluess[2] = eigenvals[2];
267 sort(eigenvaluess.begin(),eigenvaluess.end());
269 return ( 1.5*eigenvaluess[0]);
275 if (tracks.size()==0)
return 0;
277 TMatrixDSym MomentumTensor(3);
278 for(reco::TrackCollection::const_iterator itTrack = tracks.begin(); itTrack<tracks.end(); ++itTrack) {
279 std::vector<double> momentum(3);
280 momentum[0] = itTrack->px();
281 momentum[1] = itTrack->py();
282 momentum[2] = itTrack->pz();
283 for(
unsigned int i=0;
i<3;
i++)
284 for(
unsigned int j=0;
j<=
i;
j++) {
285 MomentumTensor[
i][
j] += momentum[
i]*momentum[
j];
288 MomentumTensor*=1/(MomentumTensor[0][0]+MomentumTensor[1][1]+MomentumTensor[2][2]);
290 TMatrixDSymEigen eigen(MomentumTensor);
291 TVectorD eigenvals = eigen.GetEigenValues();
292 vector<float> eigenvaluess(3);
293 eigenvaluess[0] = eigenvals[0];
294 eigenvaluess[1] = eigenvals[1];
295 eigenvaluess[2] = eigenvals[2];
296 sort(eigenvaluess.begin(),eigenvaluess.end());
298 return (eigenvaluess[0]/eigenvaluess[1]);
EventShape(reco::TrackCollection &)
std::vector< Track > TrackCollection
collection of Tracks
math::XYZTLorentzVectorF thrust() const
std::vector< float > eigenvalues
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > XYZTLorentzVectorF
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::vector< TVector3 > p