5 #include <TMatrixDSym.h>
6 #include <TMatrixDSymEigen.h>
15 for (reco::TrackCollection::const_iterator itTrack = tracks.begin(); itTrack < tracks.end(); ++itTrack) {
16 p.push_back(TVector3(itTrack->px(), itTrack->py(), itTrack->pz()));
20 TMatrixDSym MomentumTensor(3);
21 for (std::vector<TVector3>::const_iterator momentum =
p.begin(); momentum <
p.end(); ++momentum) {
22 for (
unsigned int i = 0;
i < 3;
i++)
23 for (
unsigned int j = 0;
j <=
i;
j++) {
24 MomentumTensor[
i][
j] += momentum[
i] * momentum[
j];
27 MomentumTensor *= 1 / (MomentumTensor[0][0] + MomentumTensor[1][1] + MomentumTensor[2][2]);
29 TMatrixDSymEigen eigen(MomentumTensor);
30 TVectorD eigenvals = eigen.GetEigenValues();
40 TVector3
zero(0., 0., 0.);
42 uint32_t Np =
p.size();
47 TVector3 vn, vm, vc, vl;
48 for (
unsigned int i = 0;
i < Np - 1;
i++)
49 for (
unsigned int j =
i + 1;
j < Np;
j++) {
50 vc =
p[
i].Cross(
p[
j]);
52 for (
unsigned int k = 0;
k < Np;
k++)
53 if ((
k !=
i) && (
k != j)) {
54 if (
p[
k].Dot(vc) >= 0.)
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.)
101 if (
p[0].Dot(
p[1]) >= 0.)
113 for (
unsigned int i = 0;
i < Np;
i++)
114 vsum = vsum + p[
i].Mag();
116 float v = vnew / vsum;
117 float x = qtbo.X() / vnew;
118 float y = qtbo.Y() / vnew;
119 float z = qtbo.Z() / vnew;
120 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.)
151 vn = vl + pp[
j] + pp[
i];
157 vn = vl + pp[
j] - pp[
i];
163 vn = vl - pp[
j] + pp[
i];
169 vn = vl - pp[
j] - pp[
i];
177 for (
int iter = 1; iter <= 4; iter++) {
179 for (
unsigned int i = 0;
i < Np;
i++)
180 if (vm.Dot(pp[
i]) >= 0.)
192 if (pp[0].Dot(pp[1]) >= 0.)
193 qtbo = pp[0] + pp[1];
195 qtbo = pp[0] - pp[1];
204 for (
unsigned int i = 0;
i < Np;
i++)
205 vsum = vsum + pp[
i].Mag();
207 float v = vnew / vsum;
208 float x = qtbo.X() / vnew;
209 float y = qtbo.Y() / vnew;
210 float z = qtbo.Z() / vnew;
211 output.SetPxPyPzE(x, y, z, v);
221 TMatrixDSym MomentumTensor(3);
222 for (reco::TrackCollection::const_iterator itTrack = tracks.begin(); itTrack < tracks.end(); ++itTrack) {
223 std::vector<double> momentum(3);
224 momentum[0] = itTrack->px();
225 momentum[1] = itTrack->py();
226 momentum[2] = itTrack->pz();
227 for (
unsigned int i = 0;
i < 3;
i++)
228 for (
unsigned int j = 0;
j <=
i;
j++) {
229 MomentumTensor[
i][
j] += momentum[
i] * momentum[
j];
232 MomentumTensor *= 1 / (MomentumTensor[0][0] + MomentumTensor[1][1] + MomentumTensor[2][2]);
234 TMatrixDSymEigen eigen(MomentumTensor);
235 TVectorD eigenvals = eigen.GetEigenValues();
236 vector<float> eigenvaluess(3);
237 eigenvaluess[0] = eigenvals[0];
238 eigenvaluess[1] = eigenvals[1];
239 eigenvaluess[2] = eigenvals[2];
240 sort(eigenvaluess.begin(), eigenvaluess.end());
242 float sph = (1.5 * (1 - eigenvaluess[2]));
251 TMatrixDSym MomentumTensor(3);
252 for (reco::TrackCollection::const_iterator itTrack = tracks.begin(); itTrack < tracks.end(); ++itTrack) {
253 std::vector<double> momentum(3);
254 momentum[0] = itTrack->px();
255 momentum[1] = itTrack->py();
256 momentum[2] = itTrack->pz();
257 for (
unsigned int i = 0;
i < 3;
i++)
258 for (
unsigned int j = 0;
j <=
i;
j++) {
259 MomentumTensor[
i][
j] += momentum[
i] * momentum[
j];
262 MomentumTensor *= 1 / (MomentumTensor[0][0] + MomentumTensor[1][1] + MomentumTensor[2][2]);
264 TMatrixDSymEigen eigen(MomentumTensor);
265 TVectorD eigenvals = eigen.GetEigenValues();
266 vector<float> eigenvaluess(3);
267 eigenvaluess[0] = eigenvals[0];
268 eigenvaluess[1] = eigenvals[1];
269 eigenvaluess[2] = eigenvals[2];
270 sort(eigenvaluess.begin(), eigenvaluess.end());
272 return (1.5 * eigenvaluess[0]);
280 TMatrixDSym MomentumTensor(3);
281 for (reco::TrackCollection::const_iterator itTrack = tracks.begin(); itTrack < tracks.end(); ++itTrack) {
282 std::vector<double> momentum(3);
283 momentum[0] = itTrack->px();
284 momentum[1] = itTrack->py();
285 momentum[2] = itTrack->pz();
286 for (
unsigned int i = 0;
i < 3;
i++)
287 for (
unsigned int j = 0;
j <=
i;
j++) {
288 MomentumTensor[
i][
j] += momentum[
i] * momentum[
j];
291 MomentumTensor *= 1 / (MomentumTensor[0][0] + MomentumTensor[1][1] + MomentumTensor[2][2]);
293 TMatrixDSymEigen eigen(MomentumTensor);
294 TVectorD eigenvals = eigen.GetEigenValues();
295 vector<float> eigenvaluess(3);
296 eigenvaluess[0] = eigenvals[0];
297 eigenvaluess[1] = eigenvals[1];
298 eigenvaluess[2] = eigenvals[2];
299 sort(eigenvaluess.begin(), eigenvaluess.end());
301 return (eigenvaluess[0] / eigenvaluess[1]);
EventShape(reco::TrackCollection &)
std::vector< Track > TrackCollection
collection of Tracks
auto const & tracks
cannot be loose
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