CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

TrackClassifierByProxy< Collection > Class Template Reference

Get track history and classification by proxy. More...

#include <TrackClassifierByProxy.h>

Inheritance diagram for TrackClassifierByProxy< Collection >:
TrackClassifier TrackCategories

List of all members.

Public Types

typedef edm::AssociationMap
< edm::OneToMany< Collection,
reco::TrackCollection > > 
Association
 Association type.

Public Member Functions

TrackClassifierByProxy
< Collection > const & 
evaluate (TrackingParticleRef const &track)
 Classify the TrackingVertex in categories.
TrackClassifierByProxy
< Collection > const & 
evaluate (edm::Ref< Collection > const &track)
 Classify any tracks in categories.
TrackClassifierByProxy
< Collection > const & 
evaluate (edm::Ref< Collection > const &track, std::size_t index)
 Classify any Tracks in categories.
virtual void newEvent (edm::Event const &event, edm::EventSetup const &config)
 Pre-process event information (for accessing reconstraction information).
 TrackClassifierByProxy (edm::ParameterSet const &config)
 Constructor by ParameterSet.

Private Attributes

const edm::InputTag proxy_
edm::Handle< AssociationproxyHandler_

Detailed Description

template<typename Collection>
class TrackClassifierByProxy< Collection >

Get track history and classification by proxy.

Definition at line 11 of file TrackClassifierByProxy.h.


Member Typedef Documentation

template<typename Collection >
typedef edm::AssociationMap<edm::OneToMany<Collection, reco::TrackCollection> > TrackClassifierByProxy< Collection >::Association

Association type.

Definition at line 17 of file TrackClassifierByProxy.h.


Constructor & Destructor Documentation

template<typename Collection >
TrackClassifierByProxy< Collection >::TrackClassifierByProxy ( edm::ParameterSet const &  config) [inline]

Constructor by ParameterSet.

Definition at line 20 of file TrackClassifierByProxy.h.

                                                           : TrackClassifier(config),
            proxy_( config.getUntrackedParameter<edm::InputTag>("trackProducer") ) {}

Member Function Documentation

template<typename Collection >
TrackClassifierByProxy<Collection> const& TrackClassifierByProxy< Collection >::evaluate ( TrackingParticleRef const &  track) [inline]

Classify the TrackingVertex in categories.

Reimplemented from TrackClassifier.

Definition at line 33 of file TrackClassifierByProxy.h.

Referenced by TrackClassifierByProxy< Collection >::evaluate().

    {
        TrackClassifier::evaluate(track);
        return *this;
    }
template<typename Collection >
TrackClassifierByProxy<Collection> const& TrackClassifierByProxy< Collection >::evaluate ( edm::Ref< Collection > const &  track) [inline]

Classify any tracks in categories.

Definition at line 64 of file TrackClassifierByProxy.h.

References edm::RefVector< C, T, F >::at(), TrackClassifierByProxy< Collection >::evaluate(), TrackCategories::flags(), TrackCategories::flags_, i, getHLTprescales::index, TrackClassifierByProxy< Collection >::proxyHandler_, TrackCategories::reset(), edm::RefVector< C, T, F >::size(), testEve_cfg::tracks, and TrackCategories::unknownTrack().

    {
        const reco::TrackRefVector * tracks = 0;

        try
        {
            // Get a reference to the vector of associated tracks
            tracks = proxyHandler_->find(track)->val;
        }
        catch (edm::Exception& e)
        {
            // If association fails define the track as unknown
            reset();
            unknownTrack();
            return *this;
        }

        // Loop over all the associated tracks
        for (std::size_t index = 0; index < tracks->size(); ++index)
        {
            // Copy the last status for all the flags
            Flags flags(flags_);

            // Evaluate the history for a given index
            TrackClassifier::evaluate( tracks->at(index) );

            // Combine OR the flag information
            for (std::size_t i = 0; i < flags_.size(); ++i)
                flags_[i] = flags_[i] | flags[i];
        }

        return *this;
    }
template<typename Collection >
TrackClassifierByProxy<Collection> const& TrackClassifierByProxy< Collection >::evaluate ( edm::Ref< Collection > const &  track,
std::size_t  index 
) [inline]

Classify any Tracks in categories.

Definition at line 40 of file TrackClassifierByProxy.h.

References edm::RefVector< C, T, F >::at(), TrackClassifierByProxy< Collection >::evaluate(), TrackClassifierByProxy< Collection >::proxyHandler_, TrackCategories::reset(), testEve_cfg::tracks, and TrackCategories::unknownTrack().

    {
        const reco::TrackRefVector * tracks = 0;

        try
        {
            // Get a reference to the vector of associated tracks
            tracks = proxyHandler_->find(track)->val;
        }
        catch (edm::Exception& e)
        {
            // If association fails define the track as unknown
            reset();
            unknownTrack();
            return *this;
        }

        // Evaluate the history for a given index
        TrackClassifier::evaluate( tracks->at(index) );

        return *this;
    }
template<typename Collection >
virtual void TrackClassifierByProxy< Collection >::newEvent ( edm::Event const &  event,
edm::EventSetup const &  config 
) [inline, virtual]

Pre-process event information (for accessing reconstraction information).

Reimplemented from TrackClassifier.

Definition at line 24 of file TrackClassifierByProxy.h.

References TrackClassifierByProxy< Collection >::proxy_, and TrackClassifierByProxy< Collection >::proxyHandler_.

    {
        // Get the association part of the proxy to the collection
        event.getByLabel(proxy_, proxyHandler_);
        // Call the previous new event
        TrackClassifier::newEvent(event, config);
    }

Member Data Documentation

template<typename Collection >
const edm::InputTag TrackClassifierByProxy< Collection >::proxy_ [private]
template<typename Collection >
edm::Handle<Association> TrackClassifierByProxy< Collection >::proxyHandler_ [private]