File:
ParticleMatcher.h
This file may become a part of CLHEP - a Class Library for High Energy Physics.
This is the definition of the HepParticleMatcher class.
HepParticleMatcher is an abstract base class used to represent groups of HepParticleData objects. It contains an std::set of pointers to matched HepParticleData objects and an std::set of pointers to other HepParticleMatcher objects which matches a subset of the matched HepParticleData objects.
A derived class should implement at least two methods:
To simplified the implementation of derived classes a macro called HEP_PARTICLE_MATCHER is defined whose argument are the name of the derived class, the name used as the identifier, and an identifier used as argument for the static matchCheck() method. The use of the macro must be followed by the implementation of the matchCheck() method encosed in curly brackets using the given identifier. See example below. There is also a templated helper class called HepDerivedMatcher for the same purpose. Again see the example below.
When a object of a derived class is added to HepPDTable, it will be presented to all HepParticleData objects via the checkMatch() method and the matched particles will be added to the list in the base class.
If all the matched particles have common properties, the HepParticleMatcher objects will also have these properties accessible with the mass(), width(), cTau(), iCharge(), iSpin(), iColor() and stable() methods.
A particle matcher class matching any lepton may be implemented with the HEP_PARTICLE_MATCHER as follows
HEP_PARTICLE_MATCHER(HepLeptonMatcher,"Lepton",pd) {
return HepBoolean( abs(pd.id()) > 10 && abs(pd.id()) < 19 );
}
This class can also be implemented with the templated HepDerivedMatcher class as follows:
struct MatchLeptons {
static HepString name () { return "Lepton";}
static HepBoolean check(const HepParticleData & pd) {
return HepBoolean( abs(pd.id()) > 10 && abs(pd.id()) < 19 );
}
};
typedef HepDerivedMatcher<MatchLeptons> HepLeptonMatcher;
CLASS HepParticleMatcher
This macro is depreciated. Please use the template below instead.
template <class T>
CLASS HepDerivedMatcher: