gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
lhef2heputils.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
2 // GAMBIT: Global and Modular BSM Inference Tool
3 // *********************************************
25 
26 #include "gambit/cmake/cmake_variables.hpp"
27 
28 #ifndef EXCLUDE_HEPMC
29 
30 using namespace std;
31 
32 #include <iostream>
33 
35 
37 #include "HepMC3/LHEF.h"
39 
40 #include "HEPUtils/FastJet.h"
41 
42 //#define COLLIDERBIT_DEBUG
43 
44 using namespace HEPUtils;
45 using namespace FJNS;
46 
48 void get_HEPUtils_event(const LHEF::Reader& lhe, Event& evt, double jet_pt_min)
49 {
50 
51  P4 vmet;
52  vector<PseudoJet> jetparticles;
53 
54  evt.set_weight(lhe.hepeup.weight());
55 
56  // Loop over all particles in the event
57  for (int i = 0; i < lhe.hepeup.NUP; ++i)
58  {
59  // Get status and PID code
60  const int st = lhe.hepeup.ISTUP[i];
61  const int pid = lhe.hepeup.IDUP[i];
62  const int apid = fabs(pid);
63 
64  // Use LHE-stable particles only
65  if (st != 1) continue;
66 
67  // Get 4-momentum
68  const P4 p4 = P4::mkXYZM(lhe.hepeup.PUP[i][0], lhe.hepeup.PUP[i][1], lhe.hepeup.PUP[i][2], lhe.hepeup.PUP[i][4]);
69 
70  // Store interacting prompt particles
72  if (apid == 22 || apid == 11 || apid == 13 || apid == 15)
73  {
74  Particle* p = new Particle(p4, pid); // the event will take ownership of this pointer
75  p->set_prompt(true);
76  evt.add_particle(p);
77  }
78 
79  // Aggregate missing ET
80  else if (apid == 12 || apid == 14 || apid == 16 || apid == 1000022 || apid == 1000039)
81  {
82  Particle* p = new Particle(p4, pid); // the event will take ownership of this pointer
83  p->set_prompt(true);
84  evt.add_particle(p);
85  vmet += p4;
86  }
87 
88  // Store non-prompt momenta for Jet building
89  else
90  {
91  PseudoJet pj = mk_pj(p4);
92  pj.set_user_index(apid);
93  jetparticles.push_back(pj);
94  }
95  }
96 
97  // MET
98  vmet.setPz(0);
99  vmet.setM(0);
100  evt.set_missingmom(vmet);
101 
102  // Jets
103  vector<PseudoJet> jets = get_jets(jetparticles, 0.4, jet_pt_min);
104 
105  for (const PseudoJet& pj : jets)
106  {
107  bool hasC = false, hasB = false;
109  // for (const PseudoJet& c : pj.constituents()) {
110  // if (c.user_index() == 4) hasC = true;
111  // if (c.user_index() == 5) hasB = true;
112  // }
113  evt.add_jet(new Jet(mk_p4(pj), hasB, hasC));
114  }
115 
116  #ifdef COLLIDERBIT_DEBUG
117  // Print event summary
118  cout << " MET = " << evt.met() << " GeV" << endl;
119  cout << " #e = " << evt.electrons().size() << endl;
120  cout << " #mu = " << evt.muons().size() << endl;
121  cout << " #tau = " << evt.taus().size() << endl;
122  cout << " #jet = " << evt.jets().size() << endl;
123  cout << " #pho = " << evt.photons().size() << endl;
124  cout << endl;
125  #endif
126 
127 }
128 
129 #endif
Pragma directives to suppress compiler warnings coming from including HepMC library headers...
STL namespace.
HEPUtils::P4 mk_p4(const Vec4T &p)
Definition: Py8Utils.hpp:45
void get_HEPUtils_event(const LHEF::Reader &lhe, Event &evt, double jet_pt_min)
Extract an LHE event as a HEPUtils::Event.
Simple header file for turning compiler warnings back on after having included one of the begin_ignor...
std::vector< std::shared_ptr< HEPUtils::Jet > > get_jets(const std::vector< MOM *> &moms, double R, double ptmin=0 *GeV, FJNS::JetAlgorithm alg=FJNS::antikt_algorithm)
Run jet clustering from any P4-compatible momentum type.
Definition: Utils.hpp:269