CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
heppy::Megajet Class Reference

#include <Megajet.h>

Public Member Functions

std::vector< float > getAxis1 ()
 
std::vector< float > getAxis2 ()
 
 Megajet ()
 
 Megajet (std::vector< float > Px_vector, std::vector< float > Py_vector, std::vector< float > Pz_vector, std::vector< float > E_vector, int megajet_association_method)
 
 Megajet (std::vector< float > Px_vector, std::vector< float > Py_vector, std::vector< float > Pz_vector, std::vector< float > E_vector)
 
void SetMethod (int megajet_association_method)
 
 ~Megajet ()
 Destructor. More...
 

Private Member Functions

void Combine ()
 Combine the jets in all the possible pairs of hemispheres. More...
 
void CombineGeorgi ()
 Combining the jets in two hemispheres by maximizing (E1-Beta*m1^2/E1 + E2-Beta*m1^2/E2) More...
 
void CombineMinEnergyMass ()
 Combining the jets in two hemispheres by minimizing m1^2/E1 + m2^2/E2. More...
 
void CombineMinHT ()
 
void CombineMinMass ()
 

Private Attributes

std::vector< float > Axis1
 
std::vector< float > Axis2
 
std::vector< TLorentzVector > j1
 
std::vector< TLorentzVector > j2
 
std::vector< TLorentzVector > jIN
 
std::vector< TLorentzVector > jOUT
 
int megajet_meth
 
std::vector< float > Object_E
 
std::vector< float > Object_Px
 
std::vector< float > Object_Py
 
std::vector< float > Object_Pz
 
int status
 

Detailed Description

Definition at line 21 of file Megajet.h.

Constructor & Destructor Documentation

◆ Megajet() [1/3]

heppy::Megajet::Megajet ( )
inline

Definition at line 35 of file Megajet.h.

35 {};

◆ Megajet() [2/3]

heppy::Megajet::Megajet ( std::vector< float >  Px_vector,
std::vector< float >  Py_vector,
std::vector< float >  Pz_vector,
std::vector< float >  E_vector,
int  megajet_association_method 
)

Definition at line 12 of file Megajet.cc.

References gather_cfg::cout, createfilelist::int, dqmiolumiharvest::j, jIN, Object_E, Object_Px, Object_Py, and Object_Pz.

17  : Object_Px(Px_vector),
18  Object_Py(Py_vector),
19  Object_Pz(Pz_vector),
20  Object_E(E_vector),
21  megajet_meth(megajet_association_method),
22  status(0) {
23  if (Object_Px.size() < 2)
24  cout << "Error in Megajet: you should provide at least two jets to form Megajets" << endl;
25  for (int j = 0; j < (int)jIN.size(); ++j) {
26  jIN.push_back(TLorentzVector(Object_Px[j], Object_Py[j], Object_Pz[j], Object_E[j]));
27  }
28  }
std::vector< float > Object_E
Definition: Megajet.h:86
std::vector< float > Object_Pz
Definition: Megajet.h:85
std::vector< TLorentzVector > jIN
Definition: Megajet.h:94
std::vector< float > Object_Py
Definition: Megajet.h:84
std::vector< float > Object_Px
Definition: Megajet.h:83
int megajet_meth
Definition: Megajet.h:91

◆ Megajet() [3/3]

heppy::Megajet::Megajet ( std::vector< float >  Px_vector,
std::vector< float >  Py_vector,
std::vector< float >  Pz_vector,
std::vector< float >  E_vector 
)

Definition at line 32 of file Megajet.cc.

References gather_cfg::cout, createfilelist::int, dqmiolumiharvest::j, jIN, Object_E, Object_Px, Object_Py, and Object_Pz.

33  : Object_Px(Px_vector), Object_Py(Py_vector), Object_Pz(Pz_vector), Object_E(E_vector), status(0) {
34  if (Object_Px.size() < 2)
35  cout << "Error in Megajet: you should provide at least two jets to form Megajets" << endl;
36  for (int j = 0; j < (int)jIN.size(); ++j) {
37  jIN.push_back(TLorentzVector(Object_Px[j], Object_Py[j], Object_Pz[j], Object_E[j]));
38  }
39  }
std::vector< float > Object_E
Definition: Megajet.h:86
std::vector< float > Object_Pz
Definition: Megajet.h:85
std::vector< TLorentzVector > jIN
Definition: Megajet.h:94
std::vector< float > Object_Py
Definition: Megajet.h:84
std::vector< float > Object_Px
Definition: Megajet.h:83

◆ ~Megajet()

heppy::Megajet::~Megajet ( )
inline

Destructor.

Definition at line 49 of file Megajet.h.

49 {};

Member Function Documentation

◆ Combine()

void heppy::Megajet::Combine ( )
private

Combine the jets in all the possible pairs of hemispheres.

Definition at line 88 of file Megajet.cc.

References Axis1, Axis2, submitPVResolutionJobs::count, mps_fire::i, createfilelist::int, dqmiolumiharvest::j, j1, j2, and jIN.

Referenced by getAxis1(), and getAxis2().

88  {
89  int N_JETS = (int)jIN.size();
90 
91  int N_comb = 1;
92  for (int i = 0; i < N_JETS; i++) {
93  N_comb *= 2;
94  }
95 
96  // clear some vectors if method Combine() is called again
97  if (!j1.empty()) {
98  j1.clear();
99  j2.clear();
100  Axis1.clear();
101  Axis2.clear();
102  }
103 
104  for (int j = 0; j < 5; ++j) {
105  Axis1.push_back(0);
106  Axis2.push_back(0);
107  }
108 
109  int j_count;
110  for (int i = 1; i < N_comb - 1; i++) {
111  TLorentzVector j_temp1, j_temp2;
112  int itemp = i;
113  j_count = N_comb / 2;
114  int count = 0;
115  while (j_count > 0) {
116  if (itemp / j_count == 1) {
117  j_temp1 += jIN[count];
118  } else {
119  j_temp2 += jIN[count];
120  }
121  itemp -= j_count * (itemp / j_count);
122  j_count /= 2;
123  count++;
124  }
125 
126  j1.push_back(j_temp1);
127  j2.push_back(j_temp2);
128  }
129  }
std::vector< TLorentzVector > jIN
Definition: Megajet.h:94
std::vector< float > Axis2
Definition: Megajet.h:89
std::vector< TLorentzVector > j1
Definition: Megajet.h:96
std::vector< TLorentzVector > j2
Definition: Megajet.h:97
std::vector< float > Axis1
Definition: Megajet.h:88

◆ CombineGeorgi()

void heppy::Megajet::CombineGeorgi ( )
private

Combining the jets in two hemispheres by maximizing (E1-Beta*m1^2/E1 + E2-Beta*m1^2/E2)

Definition at line 186 of file Megajet.cc.

References mps_fire::i, createfilelist::int, j1, j2, jOUT, and status.

Referenced by getAxis1(), and getAxis2().

186  {
187  double M_max = -10000;
188  // default value (in case none is found)
189  TLorentzVector myJ1 = TLorentzVector(0, 0, 0, 0);
190  TLorentzVector myJ2 = TLorentzVector(0, 0, 0, 0);
191  for (int i = 0; i < (int)j1.size(); i++) {
192  int myBeta = 2;
193  double M_temp = (j1[i].E() - myBeta * j1[i].M2() / j1[i].E()) + (j2[i].E() - myBeta * j2[i].M2() / j2[i].E());
194  if (M_max < -9999 || M_temp > M_max) {
195  M_max = M_temp;
196  myJ1 = j1[i];
197  myJ2 = j2[i];
198  }
199  }
200 
201  // myJ1.SetPtEtaPhiM(myJ1.Pt(),myJ1.Eta(),myJ1.Phi(),0.0);
202  // myJ2.SetPtEtaPhiM(myJ2.Pt(),myJ2.Eta(),myJ2.Phi(),0.0);
203 
204  jOUT.clear();
205  if (myJ1.Pt() > myJ2.Pt()) {
206  jOUT.push_back(myJ1);
207  jOUT.push_back(myJ2);
208  } else {
209  jOUT.push_back(myJ2);
210  jOUT.push_back(myJ1);
211  }
212  status = 1;
213  }
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:95
std::vector< TLorentzVector > j1
Definition: Megajet.h:96
std::vector< TLorentzVector > j2
Definition: Megajet.h:97

◆ CombineMinEnergyMass()

void heppy::Megajet::CombineMinEnergyMass ( )
private

Combining the jets in two hemispheres by minimizing m1^2/E1 + m2^2/E2.

Definition at line 158 of file Megajet.cc.

References mps_fire::i, createfilelist::int, j1, j2, jOUT, and status.

Referenced by getAxis1(), and getAxis2().

158  {
159  double M_min = -1;
160  // default value (in case none is found)
161  TLorentzVector myJ1 = TLorentzVector(0, 0, 0, 0);
162  TLorentzVector myJ2 = TLorentzVector(0, 0, 0, 0);
163  for (int i = 0; i < (int)j1.size(); i++) {
164  double M_temp = j1[i].M2() / j1[i].E() + j2[i].M2() / j2[i].E();
165  if (M_min < 0 || M_temp < M_min) {
166  M_min = M_temp;
167  myJ1 = j1[i];
168  myJ2 = j2[i];
169  }
170  }
171 
172  // myJ1.SetPtEtaPhiM(myJ1.Pt(),myJ1.Eta(),myJ1.Phi(),0.0);
173  // myJ2.SetPtEtaPhiM(myJ2.Pt(),myJ2.Eta(),myJ2.Phi(),0.0);
174 
175  jOUT.clear();
176  if (myJ1.Pt() > myJ2.Pt()) {
177  jOUT.push_back(myJ1);
178  jOUT.push_back(myJ2);
179  } else {
180  jOUT.push_back(myJ2);
181  jOUT.push_back(myJ1);
182  }
183  status = 1;
184  }
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:95
std::vector< TLorentzVector > j1
Definition: Megajet.h:96
std::vector< TLorentzVector > j2
Definition: Megajet.h:97

◆ CombineMinHT()

void heppy::Megajet::CombineMinHT ( )
private

Combining the jets in two hemispheres minimizing the difference of HT for the two hemispheres

Definition at line 215 of file Megajet.cc.

References mps_fire::i, createfilelist::int, j1, j2, jOUT, and status.

Referenced by getAxis1(), and getAxis2().

215  {
216  double dHT_min = 999999999999999.0;
217  // default value (in case none is found)
218  TLorentzVector myJ1 = TLorentzVector(0, 0, 0, 0);
219  TLorentzVector myJ2 = TLorentzVector(0, 0, 0, 0);
220  for (int i = 0; i < (int)j1.size(); i++) {
221  double dHT_temp = fabs(j1[i].E() - j2[i].E());
222  if (dHT_temp < dHT_min) {
223  dHT_min = dHT_temp;
224  myJ1 = j1[i];
225  myJ2 = j2[i];
226  }
227  }
228 
229  jOUT.clear();
230  if (myJ1.Pt() > myJ2.Pt()) {
231  jOUT.push_back(myJ1);
232  jOUT.push_back(myJ2);
233  } else {
234  jOUT.push_back(myJ2);
235  jOUT.push_back(myJ1);
236  }
237  status = 1;
238  }
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:95
std::vector< TLorentzVector > j1
Definition: Megajet.h:96
std::vector< TLorentzVector > j2
Definition: Megajet.h:97

◆ CombineMinMass()

void heppy::Megajet::CombineMinMass ( )
private

Combining the jets in two hemispheres minimizing the sum of the invariant masses of the two hemispheres

Definition at line 131 of file Megajet.cc.

References mps_fire::i, createfilelist::int, j1, j2, jOUT, and status.

Referenced by getAxis1(), and getAxis2().

131  {
132  double M_min = -1;
133  // default value (in case none is found)
134  TLorentzVector myJ1 = TLorentzVector(0, 0, 0, 0);
135  TLorentzVector myJ2 = TLorentzVector(0, 0, 0, 0);
136  for (int i = 0; i < (int)j1.size(); i++) {
137  double M_temp = j1[i].M2() + j2[i].M2();
138  if (M_min < 0 || M_temp < M_min) {
139  M_min = M_temp;
140  myJ1 = j1[i];
141  myJ2 = j2[i];
142  }
143  }
144  // myJ1.SetPtEtaPhiM(myJ1.Pt(),myJ1.Eta(),myJ1.Phi(),0.0);
145  // myJ2.SetPtEtaPhiM(myJ2.Pt(),myJ2.Eta(),myJ2.Phi(),0.0);
146 
147  jOUT.clear();
148  if (myJ1.Pt() > myJ2.Pt()) {
149  jOUT.push_back(myJ1);
150  jOUT.push_back(myJ2);
151  } else {
152  jOUT.push_back(myJ2);
153  jOUT.push_back(myJ1);
154  }
155  status = 1;
156  }
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:95
std::vector< TLorentzVector > j1
Definition: Megajet.h:96
std::vector< TLorentzVector > j2
Definition: Megajet.h:97

◆ getAxis1()

vector< float > heppy::Megajet::getAxis1 ( )

Definition at line 41 of file Megajet.cc.

References Axis1, Combine(), CombineGeorgi(), CombineMinEnergyMass(), CombineMinHT(), CombineMinMass(), jIN, jOUT, megajet_meth, and status.

41  {
42  if (status != 1) {
43  this->Combine();
44  if (megajet_meth == 1)
45  this->CombineMinMass();
46  else if (megajet_meth == 2)
47  this->CombineMinHT();
48  else if (megajet_meth == 3)
49  this->CombineMinEnergyMass();
50  else if (megajet_meth == 4)
51  this->CombineGeorgi();
52  else
53  this->CombineMinMass();
54  }
55  if (jIN.size() > 1) {
56  Axis1[0] = jOUT[0].Px() / jOUT[0].P();
57  Axis1[1] = jOUT[0].Py() / jOUT[0].P();
58  Axis1[2] = jOUT[0].Pz() / jOUT[0].P();
59  Axis1[3] = jOUT[0].P();
60  Axis1[4] = jOUT[0].E();
61  }
62  return Axis1;
63  }
void CombineGeorgi()
Combining the jets in two hemispheres by maximizing (E1-Beta*m1^2/E1 + E2-Beta*m1^2/E2) ...
Definition: Megajet.cc:186
std::vector< TLorentzVector > jIN
Definition: Megajet.h:94
void CombineMinHT()
Definition: Megajet.cc:215
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:95
void CombineMinMass()
Definition: Megajet.cc:131
int megajet_meth
Definition: Megajet.h:91
std::vector< float > Axis1
Definition: Megajet.h:88
void Combine()
Combine the jets in all the possible pairs of hemispheres.
Definition: Megajet.cc:88
void CombineMinEnergyMass()
Combining the jets in two hemispheres by minimizing m1^2/E1 + m2^2/E2.
Definition: Megajet.cc:158

◆ getAxis2()

vector< float > heppy::Megajet::getAxis2 ( )

Definition at line 64 of file Megajet.cc.

References Axis2, Combine(), CombineGeorgi(), CombineMinEnergyMass(), CombineMinHT(), CombineMinMass(), jIN, jOUT, megajet_meth, and status.

64  {
65  if (status != 1) {
66  this->Combine();
67  if (megajet_meth == 1)
68  this->CombineMinMass();
69  else if (megajet_meth == 2)
70  this->CombineMinHT();
71  else if (megajet_meth == 3)
72  this->CombineMinEnergyMass();
73  else if (megajet_meth == 4)
74  this->CombineGeorgi();
75  else
76  this->CombineMinMass();
77  }
78  if (jIN.size() > 1) {
79  Axis2[0] = jOUT[1].Px() / jOUT[1].P();
80  Axis2[1] = jOUT[1].Py() / jOUT[1].P();
81  Axis2[2] = jOUT[1].Pz() / jOUT[1].P();
82  Axis2[3] = jOUT[1].P();
83  Axis2[4] = jOUT[1].E();
84  }
85  return Axis2;
86  }
void CombineGeorgi()
Combining the jets in two hemispheres by maximizing (E1-Beta*m1^2/E1 + E2-Beta*m1^2/E2) ...
Definition: Megajet.cc:186
std::vector< TLorentzVector > jIN
Definition: Megajet.h:94
std::vector< float > Axis2
Definition: Megajet.h:89
void CombineMinHT()
Definition: Megajet.cc:215
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:95
void CombineMinMass()
Definition: Megajet.cc:131
int megajet_meth
Definition: Megajet.h:91
void Combine()
Combine the jets in all the possible pairs of hemispheres.
Definition: Megajet.cc:88
void CombineMinEnergyMass()
Combining the jets in two hemispheres by minimizing m1^2/E1 + m2^2/E2.
Definition: Megajet.cc:158

◆ SetMethod()

void heppy::Megajet::SetMethod ( int  megajet_association_method)
inline

Definition at line 60 of file Megajet.h.

References megajet_meth, and status.

60  {
61  megajet_meth = megajet_association_method;
62  status = 0;
63  }
int megajet_meth
Definition: Megajet.h:91

Member Data Documentation

◆ Axis1

std::vector<float> heppy::Megajet::Axis1
private

Definition at line 88 of file Megajet.h.

Referenced by Combine(), and getAxis1().

◆ Axis2

std::vector<float> heppy::Megajet::Axis2
private

Definition at line 89 of file Megajet.h.

Referenced by Combine(), and getAxis2().

◆ j1

std::vector<TLorentzVector> heppy::Megajet::j1
private

Definition at line 96 of file Megajet.h.

Referenced by Combine(), CombineGeorgi(), CombineMinEnergyMass(), CombineMinHT(), and CombineMinMass().

◆ j2

std::vector<TLorentzVector> heppy::Megajet::j2
private

Definition at line 97 of file Megajet.h.

Referenced by Combine(), CombineGeorgi(), CombineMinEnergyMass(), CombineMinHT(), and CombineMinMass().

◆ jIN

std::vector<TLorentzVector> heppy::Megajet::jIN
private

Definition at line 94 of file Megajet.h.

Referenced by Combine(), getAxis1(), getAxis2(), and Megajet().

◆ jOUT

std::vector<TLorentzVector> heppy::Megajet::jOUT
private

◆ megajet_meth

int heppy::Megajet::megajet_meth
private

Definition at line 91 of file Megajet.h.

Referenced by getAxis1(), getAxis2(), and SetMethod().

◆ Object_E

std::vector<float> heppy::Megajet::Object_E
private

Definition at line 86 of file Megajet.h.

Referenced by Megajet().

◆ Object_Px

std::vector<float> heppy::Megajet::Object_Px
private

Definition at line 83 of file Megajet.h.

Referenced by Megajet().

◆ Object_Py

std::vector<float> heppy::Megajet::Object_Py
private

Definition at line 84 of file Megajet.h.

Referenced by Megajet().

◆ Object_Pz

std::vector<float> heppy::Megajet::Object_Pz
private

Definition at line 85 of file Megajet.h.

Referenced by Megajet().

◆ status

int heppy::Megajet::status
private