gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
mt2w.cc
Go to the documentation of this file.
2 
3 double calculateMT2wHepUtils(vector<HEPUtils::P4>& jets, vector<bool>& btag, HEPUtils::P4& lep, float met, float metphi){
4 
5  // I am asumming that jets is sorted by Pt
6  assert ( jets.size() == btag.size() );
7  // require at least 2 jets
8  if ( jets.size()<2 ) return 99999.;
9 
10  // First we count the number of b-tagged jets, and separate those non b-tagged
11  std::vector<int> bjets;
12  std::vector<int> non_bjets;
13  for( unsigned int i = 0 ; i < jets.size() ; i++ ){
14  if( btag.at(i) ) {
15  bjets.push_back(i);
16  } else {
17  non_bjets.push_back(i);
18  }
19  }
20 
21  int n_btag = (int) bjets.size();
22  // cout << "n_btag = " << n_btag << endl;
23 
24  // We do different things depending on the number of b-tagged jets
25  // arXiv:1203.4813 recipe
26 
27  int nMax=-1;
28  if(jets.size()<=3) nMax=non_bjets.size();
29  else nMax=3;
30 
31  if (n_btag == 0){ // 0 b-tags
32  // If no b-jets select the minimum of the mt2w from all combinations with
33  // the three leading jets
34  float min_mt2w = 9999;
35 
36  for (int i=0; i<nMax; i++)
37  for (int j=0; j<nMax; j++){
38  if (i == j) continue;
39  float c_mt2w = mt2wWrapperHepUtils(lep,
40  jets[non_bjets[i]],
41  jets[non_bjets[j]], met, metphi);
42  if (c_mt2w < min_mt2w)
43  min_mt2w = c_mt2w;
44  }
45  return min_mt2w;
46 
47  } else if (n_btag == 1 ){ // 1 b-tags
48  // if only one b-jet choose the three non-b leading jets and choose the smaller
49  float min_mt2w = 9999;
50 
51  for (int i=0; i<nMax; i++){
52  float c_mt2w = mt2wWrapperHepUtils(lep, jets[bjets[0]], jets[non_bjets[i]], met, metphi);
53  if (c_mt2w < min_mt2w)
54  min_mt2w = c_mt2w;
55  }
56  for (int i=0; i<nMax; i++){
57  float c_mt2w = mt2wWrapperHepUtils(lep, jets[non_bjets[i]], jets[bjets[0]], met, metphi);
58  if (c_mt2w < min_mt2w)
59  min_mt2w = c_mt2w;
60  }
61  return min_mt2w;
62 
63  } else if (n_btag >= 2) { // >=2 b-tags
64  // if 3 or more b-jets the paper says ignore b-tag and do like 0-bjets
65  // but we are going to make the combinations with the b-jets
66  float min_mt2w = 9999;
67  for (int i=0; i<n_btag; i++)
68  for (int j=0; j<n_btag; j++){
69  if (i == j) continue;
70  float c_mt2w = mt2wWrapperHepUtils(lep,
71  jets[bjets[i]],
72  jets[bjets[j]], met, metphi);
73  if (c_mt2w < min_mt2w)
74  min_mt2w = c_mt2w;
75  }
76  return min_mt2w;
77  }
78 
79  return -1.;
80 }
81 
82 // This funcion is a wrapper for mt2w_bisect etc that takes HEPUtils::P4 vectors instead of doubles
83 // Written by Martin White (martin.white@adelaide.edu.au), October 2015
84 double mt2wWrapperHepUtils(HEPUtils::P4& lep, HEPUtils::P4& jet_o, HEPUtils::P4& jet_b, float met, float metphi){
85 
86  // same for all MT2x variables
87  float metx = met * cos( metphi );
88  float mety = met * sin( metphi );
89 
90  double pl[4]; // Visible lepton
91  double pb1[4]; // bottom on the same side as the visible lepton
92  double pb2[4]; // other bottom, paired with the invisible W
93  double pmiss[3]; // <unused>, pmx, pmy missing pT
94 
95  pl[0]= lep.E(); pl[1]= lep.px(); pl[2]= lep.py(); pl[3]= lep.pz();
96  pb1[1] = jet_o.px(); pb1[2] = jet_o.py(); pb1[3] = jet_o.pz();
97  pb2[1] = jet_b.px(); pb2[2] = jet_b.py(); pb2[3] = jet_b.pz();
98  pmiss[0] = 0.; pmiss[1] = metx; pmiss[2] = mety;
99 
100  pb1[0] = jet_o.E();
101  pb2[0] = jet_b.E();
102 
103  mt2w_bisect::mt2w mt2w_event;
104  mt2w_event.set_momenta(pl, pb1, pb2, pmiss);
105 
106  return mt2w_event.get_mt2w();
107 }
108 
double calculateMT2wHepUtils(vector< HEPUtils::P4 > &jets, vector< bool > &btag, HEPUtils::P4 &lep, float met, float metphi)
Definition: mt2w.cc:3
void set_momenta(double *pl0, double *pb10, double *pb20, double *pmiss0)
Definition: mt2w_bisect.cpp:67
DS5_MSPCTM DS_INTDOF int
double mt2wWrapperHepUtils(HEPUtils::P4 &lep, HEPUtils::P4 &jet_o, HEPUtils::P4 &jet_b, float met, float metphi)
Definition: mt2w.cc:84