#include <MParticle.h>
Inheritance diagram for manchester::MParticle:
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. | |
MParticle & | operator+= (const MParticle &p) |
In order to minimise temporaries in operator+. | |
MParticle & | operator= (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. |
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.
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.
Int_t MParticle::Charge | ( | ) | const |
Charge of the particle.
The electric charge is stored as an integer. This method allows public access.
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.
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.