manchester::MParticle Class Reference

Base class for 4-vector based particles. More...

#include <MParticle.h>

Inheritance diagram for manchester::MParticle:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 MParticle ()
 Default Constructor with a 0 4-vector.
 MParticle (const TLorentzVector &p)
 TLorentzVector copy constructor.
 MParticle (const MParticle &p)
 Copy constructor.
 MParticle (Double_t px, Double_t py, Double_t pz, Double_t e)
 Construct from 4-vector components.
virtual ~MParticle ()
 So far the destructor does nothing.
Int_t Charge () const
 Charge of the particle.
void SetCharge (Int_t c)
 Set the charge of the particle.
virtual std::string Type () const
 So we know what type of particle this is at run time.
virtual std::ostream & PrintContent (std::ostream &o) const
 Works with operator<< to allow the printing of MParticle to screen.
bool operator< (const MParticle &p) const
 Method for comparing objects based on transverse momentum.
bool operator> (const MParticle &p) const
 Method for comparing objects based on transverse momentum.
MParticleoperator+= (const MParticle &p)
 In order to minimise temporaries in operator+.
MParticleoperator= (const MParticle &p)
 Assignment operator uses MParticle copy constructor.

Protected Member Functions

virtual void Reset ()
 Function to reset any private members - overridden by derived class.

Detailed Description

Base class for 4-vector based particles.

Includes functionality for sorting based on transverse momentum. The charge information is included to allow C++ vectors of particles (e.g. electrons and muons) to be cast to MParticle. i.e. vectors of MParticles can contain both electrons and muons in a single list.


Constructor & Destructor Documentation

MParticle::MParticle ( const MParticle p  ) 

Copy constructor.

Copy constructors should be defined in terms of references. GCC wasn't always seeing the pointer variants correctly. Set the TLorentzVector and the particle charge.

MParticle::~MParticle (  )  [virtual]

So far the destructor does nothing.

Added for the sake of completeness, since we have our own copy constructors.


Member Function Documentation

Int_t MParticle::Charge (  )  const

Charge of the particle.

The electric charge is stored as an integer. This method allows public access.

MParticle & MParticle::operator+= ( const MParticle p  ) 

In order to minimise temporaries in operator+.

Worrying about the number of temporaries created by the previous operator+.

bool MParticle::operator< ( const MParticle p  )  const

Method for comparing objects based on transverse momentum.

Comparison works based on transverse momentum.

MParticle & MParticle::operator= ( const MParticle p  ) 

Assignment operator uses MParticle copy constructor.

Assignment operator. Since we have copy constructor we should also define the assignment operator (and the destructor). Calls TLorentzVector::operator= and also assigns the charge. Also checks for self assignment.

bool MParticle::operator> ( const MParticle p  )  const

Method for comparing objects based on transverse momentum.

Just invert the operator<. Avoids the branch condition in the previous version.

void MParticle::Reset (  )  [protected, virtual]

Function to reset any private members - overridden by derived class.

Reset the private member variables of this instance.

Reimplemented in manchester::MEFMuonTrack, manchester::MEFTrack, manchester::MElectron, manchester::MInDetTrack, manchester::MJet, manchester::ML2CombMuon, manchester::ML2Muon, manchester::MMuon, manchester::MTrack, and manchester::MTruthParticle.

string MParticle::Type (  )  const [virtual]

So we know what type of particle this is at run time.

At run time we may have a vector<MParticle*> which could for example contain both electrons and muons. This function lets you know which particle it is.

Reimplemented in manchester::MElectron, manchester::MInDetTrack, manchester::MJet, manchester::ML2CombMuon, manchester::ML2Muon, manchester::MMuon, manchester::MTrack, and manchester::MTruthParticle.


The documentation for this class was generated from the following files:
Generated on Thu Jun 30 11:40:29 2011 for manTreeSFrame by  doxygen 1.4.7