CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

heppy::Megajet::Megajet ( )
inline

Definition at line 37 of file Megajet.h.

37 {};
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, j, jIN, Object_E, Object_Px, Object_Py, and Object_Pz.

13  :
14  Object_Px(Px_vector), Object_Py(Py_vector), Object_Pz(Pz_vector), Object_E(E_vector),
15  megajet_meth(megajet_association_method), status(0) {
16 
17  if(Object_Px.size() < 2) cout << "Error in Megajet: you should provide at least two jets to form Megajets" << endl;
18  for(int j=0; j<(int)jIN.size(); ++j) {
19  jIN.push_back(TLorentzVector(Object_Px[j],Object_Py[j],Object_Pz[j],Object_E[j]));
20  }
21 }
std::vector< float > Object_E
Definition: Megajet.h:83
std::vector< float > Object_Pz
Definition: Megajet.h:82
std::vector< TLorentzVector > jIN
Definition: Megajet.h:92
int j
Definition: DBlmapReader.cc:9
std::vector< float > Object_Py
Definition: Megajet.h:81
std::vector< float > Object_Px
Definition: Megajet.h:80
int megajet_meth
Definition: Megajet.h:89
tuple cout
Definition: gather_cfg.py:145
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 25 of file Megajet.cc.

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

26  :
27  Object_Px(Px_vector), Object_Py(Py_vector), Object_Pz(Pz_vector), Object_E(E_vector),
28  status(0) {
29 
30  if(Object_Px.size() < 2) cout << "Error in Megajet: you should provide at least two jets to form Megajets" << endl;
31  for(int j=0; j<(int)jIN.size(); ++j) {
32  jIN.push_back(TLorentzVector(Object_Px[j],Object_Py[j],Object_Pz[j],Object_E[j]));
33  }
34 }
std::vector< float > Object_E
Definition: Megajet.h:83
std::vector< float > Object_Pz
Definition: Megajet.h:82
std::vector< TLorentzVector > jIN
Definition: Megajet.h:92
int j
Definition: DBlmapReader.cc:9
std::vector< float > Object_Py
Definition: Megajet.h:81
std::vector< float > Object_Px
Definition: Megajet.h:80
tuple cout
Definition: gather_cfg.py:145
heppy::Megajet::~Megajet ( )
inline

Destructor.

Definition at line 44 of file Megajet.h.

44 {};

Member Function Documentation

void heppy::Megajet::Combine ( )
private

Combine the jets in all the possible pairs of hemispheres.

Definition at line 73 of file Megajet.cc.

References Axis1, Axis2, KineDebug3::count(), i, j, j1, j2, and jIN.

Referenced by getAxis1(), and getAxis2().

73  {
74  int N_JETS = (int)jIN.size();
75 
76  int N_comb = 1;
77  for(int i = 0; i < N_JETS; i++){
78  N_comb *= 2;
79  }
80 
81  // clear some vectors if method Combine() is called again
82  if ( !j1.empty() ) {
83  j1.clear();
84  j2.clear();
85  Axis1.clear();
86  Axis2.clear();
87  }
88 
89  for(int j = 0; j < 5; ++j){
90  Axis1.push_back(0);
91  Axis2.push_back(0);
92  }
93 
94  int j_count;
95  for(int i = 1; i < N_comb-1; i++){
96  TLorentzVector j_temp1, j_temp2;
97  int itemp = i;
98  j_count = N_comb/2;
99  int count = 0;
100  while(j_count > 0){
101  if(itemp/j_count == 1){
102  j_temp1 += jIN[count];
103  } else {
104  j_temp2 += jIN[count];
105  }
106  itemp -= j_count*(itemp/j_count);
107  j_count /= 2;
108  count++;
109  }
110 
111  j1.push_back(j_temp1);
112  j2.push_back(j_temp2);
113  }
114 }
int i
Definition: DBlmapReader.cc:9
std::vector< TLorentzVector > jIN
Definition: Megajet.h:92
std::vector< float > Axis2
Definition: Megajet.h:86
std::vector< TLorentzVector > j1
Definition: Megajet.h:94
std::vector< TLorentzVector > j2
Definition: Megajet.h:95
int j
Definition: DBlmapReader.cc:9
std::vector< float > Axis1
Definition: Megajet.h:85
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 171 of file Megajet.cc.

References i, j1, j2, jOUT, and status.

Referenced by getAxis1(), and getAxis2().

171  {
172  double M_max = -10000;
173  // default value (in case none is found)
174  TLorentzVector myJ1 = TLorentzVector(0,0,0,0);
175  TLorentzVector myJ2 = TLorentzVector(0,0,0,0);
176  for(int i=0; i<(int)j1.size(); i++) {
177  int myBeta = 2;
178  double M_temp = (j1[i].E()-myBeta*j1[i].M2()/j1[i].E())+(j2[i].E()-myBeta*j2[i].M2()/j2[i].E());
179  if(M_max < -9999 || M_temp > M_max){
180  M_max = M_temp;
181  myJ1 = j1[i];
182  myJ2 = j2[i];
183  }
184  }
185 
186  // myJ1.SetPtEtaPhiM(myJ1.Pt(),myJ1.Eta(),myJ1.Phi(),0.0);
187  // myJ2.SetPtEtaPhiM(myJ2.Pt(),myJ2.Eta(),myJ2.Phi(),0.0);
188 
189  jOUT.clear();
190  if(myJ1.Pt() > myJ2.Pt()){
191  jOUT.push_back(myJ1);
192  jOUT.push_back(myJ2);
193  } else {
194  jOUT.push_back(myJ2);
195  jOUT.push_back(myJ1);
196  }
197  status=1;
198 }
int i
Definition: DBlmapReader.cc:9
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:93
std::vector< TLorentzVector > j1
Definition: Megajet.h:94
std::vector< TLorentzVector > j2
Definition: Megajet.h:95
void heppy::Megajet::CombineMinEnergyMass ( )
private

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

Definition at line 143 of file Megajet.cc.

References i, j1, j2, jOUT, and status.

Referenced by getAxis1(), and getAxis2().

143  {
144  double M_min = -1;
145  // default value (in case none is found)
146  TLorentzVector myJ1 = TLorentzVector(0,0,0,0);
147  TLorentzVector myJ2 = TLorentzVector(0,0,0,0);
148  for(int i=0; i<(int)j1.size(); i++) {
149  double M_temp = j1[i].M2()/j1[i].E()+j2[i].M2()/j2[i].E();
150  if(M_min < 0 || M_temp < M_min){
151  M_min = M_temp;
152  myJ1 = j1[i];
153  myJ2 = j2[i];
154  }
155  }
156 
157  // myJ1.SetPtEtaPhiM(myJ1.Pt(),myJ1.Eta(),myJ1.Phi(),0.0);
158  // myJ2.SetPtEtaPhiM(myJ2.Pt(),myJ2.Eta(),myJ2.Phi(),0.0);
159 
160  jOUT.clear();
161  if(myJ1.Pt() > myJ2.Pt()){
162  jOUT.push_back(myJ1);
163  jOUT.push_back(myJ2);
164  } else {
165  jOUT.push_back(myJ2);
166  jOUT.push_back(myJ1);
167  }
168  status=1;
169 }
int i
Definition: DBlmapReader.cc:9
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:93
std::vector< TLorentzVector > j1
Definition: Megajet.h:94
std::vector< TLorentzVector > j2
Definition: Megajet.h:95
void heppy::Megajet::CombineMinHT ( )
private

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

Definition at line 200 of file Megajet.cc.

References i, j1, j2, jOUT, and status.

Referenced by getAxis1(), and getAxis2().

200  {
201  double dHT_min = 999999999999999.0;
202  // default value (in case none is found)
203  TLorentzVector myJ1 = TLorentzVector(0,0,0,0);
204  TLorentzVector myJ2 = TLorentzVector(0,0,0,0);
205  for(int i=0; i<(int)j1.size(); i++) {
206  double dHT_temp = fabs(j1[i].E()-j2[i].E());
207  if(dHT_temp < dHT_min){
208  dHT_min = dHT_temp;
209  myJ1 = j1[i];
210  myJ2 = j2[i];
211  }
212  }
213 
214  jOUT.clear();
215  if(myJ1.Pt() > myJ2.Pt()){
216  jOUT.push_back(myJ1);
217  jOUT.push_back(myJ2);
218  } else {
219  jOUT.push_back(myJ2);
220  jOUT.push_back(myJ1);
221  }
222  status=1;
223 }
int i
Definition: DBlmapReader.cc:9
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:93
std::vector< TLorentzVector > j1
Definition: Megajet.h:94
std::vector< TLorentzVector > j2
Definition: Megajet.h:95
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 116 of file Megajet.cc.

References i, j1, j2, jOUT, and status.

Referenced by getAxis1(), and getAxis2().

116  {
117  double M_min = -1;
118  // default value (in case none is found)
119  TLorentzVector myJ1 = TLorentzVector(0,0,0,0);
120  TLorentzVector myJ2 = TLorentzVector(0,0,0,0);
121  for(int i=0; i<(int)j1.size(); i++) {
122  double M_temp = j1[i].M2()+j2[i].M2();
123  if(M_min < 0 || M_temp < M_min){
124  M_min = M_temp;
125  myJ1 = j1[i];
126  myJ2 = j2[i];
127  }
128  }
129  // myJ1.SetPtEtaPhiM(myJ1.Pt(),myJ1.Eta(),myJ1.Phi(),0.0);
130  // myJ2.SetPtEtaPhiM(myJ2.Pt(),myJ2.Eta(),myJ2.Phi(),0.0);
131 
132  jOUT.clear();
133  if(myJ1.Pt() > myJ2.Pt()){
134  jOUT.push_back(myJ1);
135  jOUT.push_back(myJ2);
136  } else {
137  jOUT.push_back(myJ2);
138  jOUT.push_back(myJ1);
139  }
140  status=1;
141 }
int i
Definition: DBlmapReader.cc:9
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:93
std::vector< TLorentzVector > j1
Definition: Megajet.h:94
std::vector< TLorentzVector > j2
Definition: Megajet.h:95
vector< float > heppy::Megajet::getAxis1 ( )

Definition at line 36 of file Megajet.cc.

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

36  {
37  if (status != 1) {
38  this->Combine();
39  if( megajet_meth == 1) this->CombineMinMass();
40  else if(megajet_meth == 2) this->CombineMinHT();
41  else if(megajet_meth == 3) this->CombineMinEnergyMass();
42  else if(megajet_meth == 4) this->CombineGeorgi();
43  else this->CombineMinMass();
44  }
45  if(jIN.size() > 1) {
46  Axis1[0] = jOUT[0].Px() / jOUT[0].P();
47  Axis1[1] = jOUT[0].Py() / jOUT[0].P();
48  Axis1[2] = jOUT[0].Pz() / jOUT[0].P();
49  Axis1[3] = jOUT[0].P();
50  Axis1[4] = jOUT[0].E();
51  }
52  return Axis1;
53 }
void CombineGeorgi()
Combining the jets in two hemispheres by maximizing (E1-Beta*m1^2/E1 + E2-Beta*m1^2/E2) ...
Definition: Megajet.cc:171
std::vector< TLorentzVector > jIN
Definition: Megajet.h:92
void CombineMinHT()
Definition: Megajet.cc:200
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:93
void CombineMinMass()
Definition: Megajet.cc:116
int megajet_meth
Definition: Megajet.h:89
std::vector< float > Axis1
Definition: Megajet.h:85
void Combine()
Combine the jets in all the possible pairs of hemispheres.
Definition: Megajet.cc:73
void CombineMinEnergyMass()
Combining the jets in two hemispheres by minimizing m1^2/E1 + m2^2/E2.
Definition: Megajet.cc:143
vector< float > heppy::Megajet::getAxis2 ( )

Definition at line 54 of file Megajet.cc.

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

54  {
55  if (status != 1) {
56  this->Combine();
57  if( megajet_meth == 1) this->CombineMinMass();
58  else if(megajet_meth == 2) this->CombineMinHT();
59  else if(megajet_meth == 3) this->CombineMinEnergyMass();
60  else if(megajet_meth == 4) this->CombineGeorgi();
61  else this->CombineMinMass();
62  }
63  if(jIN.size() > 1) {
64  Axis2[0] = jOUT[1].Px() / jOUT[1].P();
65  Axis2[1] = jOUT[1].Py() / jOUT[1].P();
66  Axis2[2] = jOUT[1].Pz() / jOUT[1].P();
67  Axis2[3] = jOUT[1].P();
68  Axis2[4] = jOUT[1].E();
69  }
70  return Axis2;
71 }
void CombineGeorgi()
Combining the jets in two hemispheres by maximizing (E1-Beta*m1^2/E1 + E2-Beta*m1^2/E2) ...
Definition: Megajet.cc:171
std::vector< TLorentzVector > jIN
Definition: Megajet.h:92
std::vector< float > Axis2
Definition: Megajet.h:86
void CombineMinHT()
Definition: Megajet.cc:200
std::vector< TLorentzVector > jOUT
Definition: Megajet.h:93
void CombineMinMass()
Definition: Megajet.cc:116
int megajet_meth
Definition: Megajet.h:89
void Combine()
Combine the jets in all the possible pairs of hemispheres.
Definition: Megajet.cc:73
void CombineMinEnergyMass()
Combining the jets in two hemispheres by minimizing m1^2/E1 + m2^2/E2.
Definition: Megajet.cc:143
void heppy::Megajet::SetMethod ( int  megajet_association_method)
inline

Definition at line 55 of file Megajet.h.

References megajet_meth, and status.

55  {
56  megajet_meth = megajet_association_method;
57  status = 0;
58  }
int megajet_meth
Definition: Megajet.h:89

Member Data Documentation

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

Definition at line 85 of file Megajet.h.

Referenced by Combine(), and getAxis1().

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

Definition at line 86 of file Megajet.h.

Referenced by Combine(), and getAxis2().

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

Definition at line 94 of file Megajet.h.

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

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

Definition at line 95 of file Megajet.h.

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

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

Definition at line 92 of file Megajet.h.

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

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

Definition at line 89 of file Megajet.h.

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

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

Definition at line 83 of file Megajet.h.

Referenced by Megajet().

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

Definition at line 80 of file Megajet.h.

Referenced by Megajet().

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

Definition at line 81 of file Megajet.h.

Referenced by Megajet().

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

Definition at line 82 of file Megajet.h.

Referenced by Megajet().

int heppy::Megajet::status
private