Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Particle.cc
Go to the documentation of this file.
1 ///
2 /// @file Particle.cc
3 /// @brief Hammer particle class
4 ///
5 
6 //**** This file is a part of the HAMMER library
7 //**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
8 //**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
9 //**** Please note the MCnet academic guidelines; see GUIDELINES for details
10 
11 // -*- C++ -*-
12 #include "Hammer/Particle.hh"
13 #include "Hammer/Exceptions.hh"
14 #include <cmath>
15 #include <string>
16 
17 #ifdef HAVE_ROOT
19 #endif
20 
21 
22 using namespace std;
23 
24 namespace Hammer {
25 
26  Particle::Particle() {
27  _code = 0;
28  _momentum = FourMomentum(0., 0., 0., 0.);
29  }
30 
31  Particle::Particle(const FourMomentum& p, PdgId code) {
32  _momentum = p;
33  _code = code;
34  }
35 
36 #ifdef HAVE_ROOT
37  Particle Particle::fromRoot(const TLorentzVector& p, PdgId code) {
38  return Particle{{p.E(), p.Px(), p.Py(), p.Pz()}, code};
39  }
40 #endif
41 
42  Particle& Particle::setMomentum(const FourMomentum& p) {
43  _momentum = p;
44  return *this;
45  }
46 
47  Particle& Particle::setPdgId(PdgId code) {
48  _code = code;
49  return *this;
50  }
51 
52  PdgId Particle::pdgId() const {
53  return _code;
54  }
55 
56  const FourMomentum& Particle::momentum() const {
57  return _momentum;
58  }
59 
60  FourMomentum& Particle::momentum() {
61  return _momentum;
62  }
63 
64  const FourMomentum& Particle::p() const {
65  return momentum();
66  }
67 
68  FourMomentum& Particle::p() {
69  return _momentum;
70  }
71 
72 } // namespace Hammer
Hammer exception definitions.
Particle class.
Definition: Particle.hh:30
ROOT includes.
Hammer particle class.
int PdgId
Definition: Pdg.fhh:17
4-momentum class
Definition: FourMomentum.hh:30