CMS 3D CMS Logo

Public Member Functions | Private Attributes

VertexHistory Class Reference

This class traces the simulated and generated history of a given track. More...

#include <VertexHistory.h>

Inheritance diagram for VertexHistory:
HistoryBase

List of all members.

Public Member Functions

bool evaluate (TrackingVertexRef tvr)
 Evaluate track history using a TrackingParticleRef.
bool evaluate (reco::VertexBaseRef)
 Evaluate reco::Vertex history using a given association.
void newEvent (const edm::Event &, const edm::EventSetup &)
 Pre-process event information (for accessing reconstruction information)
double quality () const
 Return the quality of the match.
const reco::VertexBaseRefrecoVertex () const
 Return a reference to the reconstructed track.
 VertexHistory (const edm::ParameterSet &)
 Constructor by pset.

Private Attributes

bool bestMatchByMaxValue_
bool enableRecoToSim_
bool enableSimToReco_
double quality_
reco::VertexRecoToSimCollection recoToSim_
reco::VertexBaseRef recovertex_
reco::VertexSimToRecoCollection simToReco_
std::string trackAssociator_
edm::InputTag trackingTruth_
edm::InputTag trackProducer_
std::string vertexAssociator_
edm::InputTag vertexProducer_

Detailed Description

This class traces the simulated and generated history of a given track.

Definition at line 17 of file VertexHistory.h.


Constructor & Destructor Documentation

VertexHistory::VertexHistory ( const edm::ParameterSet config)

Constructor by pset.

Definition at line 6 of file VertexHistory.cc.

References bestMatchByMaxValue_, enableRecoToSim_, enableSimToReco_, edm::ParameterSet::getUntrackedParameter(), quality_, trackAssociator_, trackingTruth_, trackProducer_, vertexAssociator_, and vertexProducer_.

  : HistoryBase()
{
    // Name of the track collection
    trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" );

    // Name of the track collection
    vertexProducer_ = config.getUntrackedParameter<edm::InputTag> ( "vertexProducer" );

    // Name of the traking pariticle collection
    trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" );

    // Track association record
    trackAssociator_ = config.getUntrackedParameter<std::string> ( "trackAssociator" );

    // Track association record
    vertexAssociator_ = config.getUntrackedParameter<std::string> ( "vertexAssociator" );

    // Association by max. value
    bestMatchByMaxValue_ = config.getUntrackedParameter<bool> ( "bestMatchByMaxValue" );

    // Enable RecoToSim association
    enableRecoToSim_ = config.getUntrackedParameter<bool> ( "enableRecoToSim" );

    // Enable SimToReco association
    enableSimToReco_ = config.getUntrackedParameter<bool> ( "enableSimToReco" );

    quality_ = 0.;
}

Member Function Documentation

bool VertexHistory::evaluate ( TrackingVertexRef  tvr) [inline]

Evaluate track history using a TrackingParticleRef.

Reimplemented from HistoryBase.

Definition at line 40 of file VertexHistory.h.

References bestMatchByMaxValue_, enableSimToReco_, match(), quality_, recovertex_, query::result, and simToReco_.

Referenced by VertexClassifier::evaluate(), and evaluate().

    {
        if ( enableSimToReco_ )
        {

            std::pair<reco::VertexBaseRef, double> result =  match(tvr, simToReco_, bestMatchByMaxValue_);
            recovertex_ = result.first;
            quality_ =  result.second;
        }
        return HistoryBase::evaluate(tvr);
    }
bool VertexHistory::evaluate ( reco::VertexBaseRef  tv)

Evaluate reco::Vertex history using a given association.

Definition at line 93 of file VertexHistory.cc.

References bestMatchByMaxValue_, enableRecoToSim_, evaluate(), edm::Ref< C, T, F >::isNull(), match(), quality_, recoToSim_, recovertex_, and query::result.

{

    if ( !enableRecoToSim_ ) return false;

    std::pair<TrackingVertexRef, double> result =  match(tv, recoToSim_, bestMatchByMaxValue_);

    TrackingVertexRef tvr( result.first );
    quality_ = result.second;

    if ( !tvr.isNull() )
    {
        HistoryBase::evaluate(tvr);

        recovertex_ = tv;

        return true;
    }

    return false;
}
void VertexHistory::newEvent ( const edm::Event event,
const edm::EventSetup setup 
)

Pre-process event information (for accessing reconstruction information)

Definition at line 38 of file VertexHistory.cc.

References enableRecoToSim_, enableSimToReco_, edm::EventSetup::get(), recoToSim_, simToReco_, ecalTPGAnalyzer_cfg::TPCollection, trackAssociator_, trackingTruth_, trackProducer_, vertexAssociator_, GoodVertex_cfg::vertexCollection, and vertexProducer_.

Referenced by VertexClassifier::newEvent().

{
    if ( enableRecoToSim_ || enableSimToReco_ )
    {

        // Track collection
        edm::Handle<edm::View<reco::Track> > trackCollection;
        event.getByLabel(trackProducer_, trackCollection);

        // Tracking particle information
        edm::Handle<TrackingParticleCollection>  TPCollection;
        event.getByLabel(trackingTruth_, TPCollection);

        // Get the track associator
        edm::ESHandle<TrackAssociatorBase> trackAssociator;
        setup.get<TrackAssociatorRecord>().get(trackAssociator_, trackAssociator);

        // Vertex collection
        edm::Handle<edm::View<reco::Vertex> > vertexCollection;
        event.getByLabel(vertexProducer_, vertexCollection);

        // Tracking particle information
        edm::Handle<TrackingVertexCollection>  TVCollection;
        event.getByLabel(trackingTruth_, TVCollection);

        // Get the track associator
        edm::ESHandle<VertexAssociatorBase> vertexAssociator;
        setup.get<VertexAssociatorRecord>().get(vertexAssociator_, vertexAssociator);

        if ( enableRecoToSim_ )
        {
            // Get the map between recovertex -> simvertex
            reco::RecoToSimCollection
            trackRecoToSim = trackAssociator->associateRecoToSim(trackCollection, TPCollection, &event);

            // Calculate the map between recovertex -> simvertex
            recoToSim_ = vertexAssociator->associateRecoToSim(vertexCollection, TVCollection, event, trackRecoToSim);
        }

        if ( enableSimToReco_ )
        {
            // Get the map between recovertex <- simvertex
            reco::SimToRecoCollection
            trackSimToReco = trackAssociator->associateSimToReco (trackCollection, TPCollection, &event);

            // Calculate the map between recovertex <- simvertex
            simToReco_ = vertexAssociator->associateSimToReco(vertexCollection, TVCollection, event, trackSimToReco);
        }

    }
}
double VertexHistory::quality ( void  ) const [inline]

Return the quality of the match.

Definition at line 68 of file VertexHistory.h.

References quality_.

Referenced by recoBSVTagInfoValidationAnalyzer::analyze(), and SVTagInfoValidationAnalyzer::analyze().

    {
        return quality_;
    }
const reco::VertexBaseRef& VertexHistory::recoVertex ( ) const [inline]

Return a reference to the reconstructed track.

Definition at line 62 of file VertexHistory.h.

References recovertex_.

Referenced by recoBSVTagInfoValidationAnalyzer::analyze(), SVTagInfoValidationAnalyzer::analyze(), and VertexClassifier::evaluate().

    {
        return recovertex_;
    }

Member Data Documentation

Definition at line 76 of file VertexHistory.h.

Referenced by evaluate(), and VertexHistory().

Definition at line 78 of file VertexHistory.h.

Referenced by evaluate(), newEvent(), and VertexHistory().

Definition at line 78 of file VertexHistory.h.

Referenced by evaluate(), newEvent(), and VertexHistory().

double VertexHistory::quality_ [private]

Definition at line 80 of file VertexHistory.h.

Referenced by evaluate(), quality(), and VertexHistory().

Definition at line 94 of file VertexHistory.h.

Referenced by evaluate(), and newEvent().

Definition at line 92 of file VertexHistory.h.

Referenced by evaluate(), and recoVertex().

Definition at line 96 of file VertexHistory.h.

Referenced by evaluate(), and newEvent().

std::string VertexHistory::trackAssociator_ [private]

Definition at line 88 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

Definition at line 86 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

Definition at line 82 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

std::string VertexHistory::vertexAssociator_ [private]

Definition at line 90 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

Definition at line 84 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().