Classes defining particle candidate. The class reco::Candidate is intended to be a common class for many Physics Analysis tools.
dynamic_cast
are provided. A tag struct can be used as optional second template parameter to disambiguate between more components in a Candidate of the same type. The following example shows how to extract references to a reco::Track or reco::Muon. The following syntaxes are all equivalent:
const Candidate & cand = ...; TrackRef track1 = c.get<TrackRef>( c ); TrackRef track2 = get<TrackRef>( c ); TrackRef track3 = component<TrackRef>::get( c );It is possible to access different types of components, but you have to get sure to
include
the header files of the concrete candidate subclass in order to define the proper template specialization.
const Candidate & c = ...; TrackRef track = c.get<TrackRef>(); SuperClusterRef cluster = c.get<SuperClusterRef>(); const Candidate & g = ...; const HepMC::GenParticle * gen = g.get<const HepMC::GenParticle *>();In case of multiple components of the same type, it is possible to specify an extra "tag" to disentangle the ambiguity. For instance:
const Candidate & muon = ...; // tracker fit: default TrackRef trackerFit = muon.get<TrackRef>(); // stand alone muon fit TrackRef standAloneMuFit = muon.get<TrackRef, StandAloneMuonTag>(); // combined muon + tracker fit TrackRef combinedFit = muon.get<TrackRef, CombinedMuonTag>();
None.
Complete.