Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:00:50

0001 // -*- C++ -*-
0002 //
0003 // Package:     FastSimulation/Particle
0004 // Class  :     makeParticle
0005 //
0006 // Implementation:
0007 //     [Notes on implementation]
0008 //
0009 // Original Author:  Christopher Jones
0010 //         Created:  Mon, 04 Mar 2019 17:15:41 GMT
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "FastSimulation/Particle/interface/makeParticle.h"
0017 #include "CommonTools/BaseParticlePropagator/interface/RawParticle.h"
0018 
0019 inline RawParticle unchecked_makeParticle(int id, const math::XYZTLorentzVector& p, double mass, double charge) {
0020   return RawParticle(id, p, mass, charge);
0021 }
0022 
0023 inline RawParticle unchecked_makeParticle(
0024     int id, const math::XYZTLorentzVector& p, const math::XYZTLorentzVector& xStart, double mass, double charge) {
0025   return RawParticle(id, p, xStart, mass, charge);
0026 }
0027 
0028 RawParticle makeParticle(HepPDT::ParticleDataTable const* table, int id, const math::XYZTLorentzVector& p) {
0029   double charge = 0.;
0030   double mass = 0.;
0031   auto info = table->particle(HepPDT::ParticleID(id));
0032   if (info) {
0033     charge = info->charge();
0034     mass = info->mass().value();
0035   }
0036 
0037   return unchecked_makeParticle(id, p, mass, charge);
0038 }
0039 
0040 RawParticle makeParticle(HepPDT::ParticleDataTable const* table,
0041                          int id,
0042                          const math::XYZTLorentzVector& p,
0043                          const math::XYZTLorentzVector& xStart) {
0044   double charge = 0.;
0045   double mass = 0.;
0046   auto info = table->particle(HepPDT::ParticleID(id));
0047   if (info) {
0048     charge = info->charge();
0049     mass = info->mass().value();
0050   }
0051   return unchecked_makeParticle(id, p, xStart, mass, charge);
0052 }