Particle.hh

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_Particle_HH
00003 #define RIVET_Particle_HH
00004 
00005 #include "Rivet/Rivet.hh"
00006 #include "HepMC/GenParticle.h"
00007 #include "Rivet/Particle.fhh"
00008 #include "Rivet/RivetCLHEP.fhh"
00009 
00010 
00011 namespace Rivet {
00012   /// Typedef from HepMC.
00013   typedef HepMC::GenParticle GenParticle;
00014 
00015   
00016   /// This class is used to represent particles projected from a HepMC::GenEvent.
00017   class Particle {
00018   public:
00019 
00020     /// Default constructor.
00021     inline Particle() :
00022       _original(0), _id(0), _momentum(0), _mass(0.0) 
00023     { };
00024     
00025     /// Constructor from a HepMC GenParticle.
00026     Particle(const GenParticle& gp);
00027     
00028     /// Copy-constructor.
00029     Particle(const Particle& p);
00030 
00031     /// Destructor.
00032     ~Particle();
00033 
00034     // Copy-assignment.
00035     Particle& operator=(const Particle& p);
00036 
00037 
00038   public:
00039     /// Get a const reference to the original GenParticle.
00040     inline const GenParticle& getHepMCParticle() const { return *_original; }
00041     
00042     /// Check if the particle corresponds to a GenParticle.
00043     inline bool hasHepMCParticle() const { return _original; }
00044     
00045     /// The PDG ID code for this Particle.
00046     inline const long getPdgId() const { return _id; }
00047     
00048     /// The momentum of this projection of the Particle.
00049     inline CLHEP::LorentzVector& getMomentum() { return *_momentum; }
00050 
00051     /// The momentum of this projection of the Particle.
00052     inline const CLHEP::LorentzVector& getMomentum() const { return *_momentum; }
00053     
00054     /// The mass of this Particle.
00055     inline const double getMass() const { return _mass; }
00056 
00057   
00058   private:
00059   
00060     /// A pointer to the original GenParticle from which this Particle is projected.
00061     const GenParticle* _original;
00062     
00063     /// The PDG ID code for this Particle.
00064     long _id;
00065     
00066     /// The momentum of this projection of the Particle.
00067     CLHEP::LorentzVector* _momentum;
00068     
00069     /// The mass of this Particle.
00070     double _mass;
00071     
00072   };
00073   
00074 }
00075 
00076 #endif