hej is hosted by Hepforge, IPPP Durham
HEJ  2.2.3
High energy resummation for hadron colliders
HepMCInterface_common.hh
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include "HEJ/Event.hh"
11 #include "HEJ/Particle.hh"
12 
13 namespace HEJ {
14  namespace detail_HepMC {
15 
17  template<class FourVector>
18  FourVector to_FourVector(Particle const & sp){
19  return {sp.px(), sp.py(), sp.pz(), sp.E()};
20  }
21  namespace status_codes {
23  enum Status: unsigned {
24  out = 1,
25  decay = 2,
26  beam = 4,
27  in = 11,
28  };
29  }
31 
35  template<int V> struct HepMCVersion;
36  template<int V>
38  template<int V>
39  using Beam = typename HepMCVersion<V>::Beam;
40 
42  template<int V>
44  Particle const & sp, int status
45  );
46 
48  template<int V>
49  auto make_vx_ptr();
51 
60  template<int V>
62  Event const & event, Beam<V> const & beam, GenEvent<V> && out_ev
63  ){
64  out_ev.set_beam_particles(beam[0], beam[1]);
65 
66  auto vx = make_vx_ptr<V>();
67  for(size_t i=0; i<event.incoming().size(); ++i){
68  auto particle = make_particle_ptr<V>(event.incoming()[i], Status::in);
69  auto vx_beam = make_vx_ptr<V>();
70  vx_beam->add_particle_in(beam[i]);
71  vx_beam->add_particle_out(particle);
72  out_ev.add_vertex(vx_beam);
73  vx->add_particle_in(particle);
74  }
75  for(size_t i=0; i < event.outgoing().size(); ++i){
76  auto const & out = event.outgoing()[i];
77  auto particle = make_particle_ptr<V>(out, Status::out);
78  const int status = event.decays().count(i)?Status::decay:Status::out;
79  particle->set_status(status);
80  if( status == Status::decay ){
81  auto vx_decay = make_vx_ptr<V>();
82  vx_decay->add_particle_in(particle);
83  for( auto const & decay: event.decays().at(i) ){
84  vx_decay->add_particle_out(
85  make_particle_ptr<V>(decay, Status::out)
86  );
87  }
88  out_ev.add_vertex(vx_decay);
89  }
90  vx->add_particle_out(particle);
91  }
92  out_ev.add_vertex(vx);
93 
94  return out_ev;
95  }
96  } // namespace detail_HepMC
97 } // namespace HEJ
Declares the Event class and helpers.
Contains the particle struct.
An event with clustered jets.
Definition: Event.hh:51
std::unordered_map< std::size_t, std::vector< Particle > > const & decays() const
Particle decays.
Definition: Event.hh:101
std::array< Particle, 2 > const & incoming() const
Incoming particles.
Definition: Event.hh:70
Status
Conventional status codes in HepMC.
Definition: HepMCInterface_common.hh:23
@ decay
Decaying.
Definition: HepMCInterface_common.hh:25
@ out
Final outgoing.
Definition: HepMCInterface_common.hh:24
@ in
Incoming.
Definition: HepMCInterface_common.hh:27
@ beam
Beam.
Definition: HepMCInterface_common.hh:26
auto make_vx_ptr()
Make HepMC vetex.
GenEvent< V > HepMC_init_kinematics(Event const &event, Beam< V > const &beam, GenEvent< V > &&out_ev)
Template class to initialise the kinematics for HepMC.
Definition: HepMCInterface_common.hh:61
typename HepMCVersion< V >::GenEvent GenEvent
Definition: HepMCInterface_common.hh:37
auto make_particle_ptr(Particle const &sp, int status)
Make HepMC particle.
typename HepMCVersion< V >::Beam Beam
Definition: HepMCInterface_common.hh:39
FourVector to_FourVector(Particle const &sp)
Convert Particle to HepMC 4-vector (x,y,z,E)
Definition: HepMCInterface_common.hh:18
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
Class representing a particle.
Definition: Particle.hh:25
double py() const
get momentum in y direction
Definition: Particle.hh:50
double px() const
get momentum in x direction
Definition: Particle.hh:46
double E() const
get energy
Definition: Particle.hh:58
double pz() const
get momentum in z direction
Definition: Particle.hh:54
Definition: HepMCInterface_common.hh:35