Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
// -*- C++ -*-
//
// Package:     FastSimulation/Particle
// Class  :     makeParticle
//
// Implementation:
//     [Notes on implementation]
//
// Original Author:  Christopher Jones
//         Created:  Mon, 04 Mar 2019 17:15:41 GMT
//

// system include files

// user include files
#include "FastSimulation/Particle/interface/makeParticle.h"
#include "CommonTools/BaseParticlePropagator/interface/RawParticle.h"

inline RawParticle unchecked_makeParticle(int id, const math::XYZTLorentzVector& p, double mass, double charge) {
  return RawParticle(id, p, mass, charge);
}

inline RawParticle unchecked_makeParticle(
    int id, const math::XYZTLorentzVector& p, const math::XYZTLorentzVector& xStart, double mass, double charge) {
  return RawParticle(id, p, xStart, mass, charge);
}

RawParticle makeParticle(HepPDT::ParticleDataTable const* table, int id, const math::XYZTLorentzVector& p) {
  double charge = 0.;
  double mass = 0.;
  auto info = table->particle(HepPDT::ParticleID(id));
  if (info) {
    charge = info->charge();
    mass = info->mass().value();
  }

  return unchecked_makeParticle(id, p, mass, charge);
}

RawParticle makeParticle(HepPDT::ParticleDataTable const* table,
                         int id,
                         const math::XYZTLorentzVector& p,
                         const math::XYZTLorentzVector& xStart) {
  double charge = 0.;
  double mass = 0.;
  auto info = table->particle(HepPDT::ParticleID(id));
  if (info) {
    charge = info->charge();
    mass = info->mass().value();
  }
  return unchecked_makeParticle(id, p, xStart, mass, charge);
}