This class traces the simulated and generated history of a given track. More...
#include <TrackHistory.h>
Public Member Functions | |
bool | evaluate (TrackingParticleRef tpr) |
Evaluate track history using a TrackingParticleRef. | |
bool | evaluate (reco::TrackBaseRef) |
Evaluate reco::Track history using a given association. | |
void | newEvent (const edm::Event &, const edm::EventSetup &) |
Pre-process event information (for accessing reconstruction information) | |
double | quality () const |
const reco::TrackBaseRef & | recoTrack () const |
Return a reference to the reconstructed track. | |
TrackHistory (const edm::ParameterSet &) | |
Constructor by pset. | |
Private Attributes | |
bool | bestMatchByMaxValue_ |
bool | enableRecoToSim_ |
bool | enableSimToReco_ |
bool | newEvent_ |
double | quality_ |
reco::RecoToSimCollection | recoToSim_ |
reco::TrackBaseRef | recotrack_ |
reco::SimToRecoCollection | simToReco_ |
std::string | trackAssociator_ |
edm::InputTag | trackingTruth_ |
edm::InputTag | trackProducer_ |
This class traces the simulated and generated history of a given track.
Definition at line 16 of file TrackHistory.h.
TrackHistory::TrackHistory | ( | const edm::ParameterSet & | config | ) |
Constructor by pset.
Definition at line 6 of file TrackHistory.cc.
References bestMatchByMaxValue_, enableRecoToSim_, enableSimToReco_, edm::ParameterSet::getUntrackedParameter(), quality_, trackAssociator_, trackingTruth_, and trackProducer_.
: HistoryBase() { // Name of the track collection trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" ); // Name of the traking pariticle collection trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" ); // Track association record trackAssociator_ = config.getUntrackedParameter<std::string> ( "trackAssociator" ); // 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.; }
bool TrackHistory::evaluate | ( | TrackingParticleRef | tpr | ) | [inline] |
Evaluate track history using a TrackingParticleRef.
Reimplemented from HistoryBase.
Definition at line 39 of file TrackHistory.h.
References bestMatchByMaxValue_, enableSimToReco_, match(), quality_, recotrack_, query::result, and simToReco_.
Referenced by evaluate(), TrackClassifier::evaluate(), and GenTrackMatcher::produce().
{ if ( enableSimToReco_ ) { std::pair<reco::TrackBaseRef, double> result = match(tpr, simToReco_, bestMatchByMaxValue_); recotrack_ = result.first; quality_ = result.second; } return HistoryBase::evaluate(tpr); }
bool TrackHistory::evaluate | ( | reco::TrackBaseRef | tr | ) |
Evaluate reco::Track history using a given association.
Definition at line 59 of file TrackHistory.cc.
References bestMatchByMaxValue_, enableRecoToSim_, evaluate(), edm::Ref< C, T, F >::isNull(), match(), quality_, recoToSim_, recotrack_, and query::result.
{ if ( !enableRecoToSim_ ) return false; std::pair<TrackingParticleRef, double> result = match(tr, recoToSim_, bestMatchByMaxValue_); TrackingParticleRef tpr( result.first ); quality_ = result.second; if ( !tpr.isNull() ) { HistoryBase::evaluate(tpr); recotrack_ = tr; return true; } return false; }
void TrackHistory::newEvent | ( | const edm::Event & | event, |
const edm::EventSetup & | setup | ||
) |
Pre-process event information (for accessing reconstruction information)
Definition at line 32 of file TrackHistory.cc.
References enableRecoToSim_, enableSimToReco_, edm::EventSetup::get(), recoToSim_, simToReco_, ecalTPGAnalyzer_cfg::TPCollection, trackAssociator_, trackingTruth_, and trackProducer_.
Referenced by TrackClassifier::newEvent(), and GenTrackMatcher::produce().
{ 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> associator; setup.get<TrackAssociatorRecord>().get(trackAssociator_, associator); // Calculate the map between recotracks -> tp if ( enableRecoToSim_ ) recoToSim_ = associator->associateRecoToSim(trackCollection, TPCollection, &event, &setup); // Calculate the map between recotracks <- tp if ( enableSimToReco_ ) simToReco_ = associator->associateSimToReco(trackCollection, TPCollection, &event, &setup); } }
double TrackHistory::quality | ( | void | ) | const [inline] |
const reco::TrackBaseRef& TrackHistory::recoTrack | ( | ) | const [inline] |
Return a reference to the reconstructed track.
Definition at line 60 of file TrackHistory.h.
References recotrack_.
Referenced by TrackClassifier::evaluate().
{ return recotrack_; }
bool TrackHistory::bestMatchByMaxValue_ [private] |
Definition at line 74 of file TrackHistory.h.
Referenced by evaluate(), and TrackHistory().
bool TrackHistory::enableRecoToSim_ [private] |
Definition at line 76 of file TrackHistory.h.
Referenced by evaluate(), newEvent(), and TrackHistory().
bool TrackHistory::enableSimToReco_ [private] |
Definition at line 76 of file TrackHistory.h.
Referenced by evaluate(), newEvent(), and TrackHistory().
bool TrackHistory::newEvent_ [private] |
Definition at line 72 of file TrackHistory.h.
double TrackHistory::quality_ [private] |
Definition at line 78 of file TrackHistory.h.
Referenced by evaluate(), quality(), and TrackHistory().
Definition at line 88 of file TrackHistory.h.
Referenced by evaluate(), and newEvent().
reco::TrackBaseRef TrackHistory::recotrack_ [private] |
Definition at line 86 of file TrackHistory.h.
Referenced by evaluate(), and recoTrack().
Definition at line 90 of file TrackHistory.h.
Referenced by evaluate(), and newEvent().
std::string TrackHistory::trackAssociator_ [private] |
Definition at line 84 of file TrackHistory.h.
Referenced by newEvent(), and TrackHistory().
edm::InputTag TrackHistory::trackingTruth_ [private] |
Definition at line 82 of file TrackHistory.h.
Referenced by newEvent(), and TrackHistory().
edm::InputTag TrackHistory::trackProducer_ [private] |
Definition at line 80 of file TrackHistory.h.
Referenced by newEvent(), and TrackHistory().