CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
TrackHistory Class Reference

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

#include <TrackHistory.h>

Inheritance diagram for TrackHistory:
HistoryBase

Public Member Functions

bool evaluate (TrackingParticleRef tpr)
 Evaluate track history using a TrackingParticleRef. More...
 
bool evaluate (reco::TrackBaseRef)
 Evaluate reco::Track history using a given association. More...
 
const std::pair
< TrackingParticleRef, double > 
getMatchedTrackingParticle () const
 
void newEvent (const edm::Event &, const edm::EventSetup &)
 Pre-process event information (for accessing reconstruction information) More...
 
double quality () const
 
const reco::TrackBaseRefrecoTrack () const
 Return a reference to the reconstructed track. More...
 
 TrackHistory (const edm::ParameterSet &, edm::ConsumesCollector &&)
 Constructor by pset. More...
 
- Public Member Functions inherited from HistoryBase
void depth (int d)
 Set the depth of the history. More...
 
const HepMC::GenParticle * genParticle () const
 Returns a pointer to most primitive status 1 or 2 particle in the genParticleTrail_. More...
 
GenParticleTrail const & genParticleTrail () const
 Return all generated particle (HepMC::GenParticle) in the history. More...
 
GenVertexTrail const & genVertexTrail () const
 Return all generated vertex in the history. More...
 
 HistoryBase ()
 
const reco::GenParticlerecoGenParticle () const
 Returns a pointer to most primitive status 1 or 2 particle in the recoGenParticleTrail_. More...
 
RecoGenParticleTrail const & recoGenParticleTrail () const
 Return all reco::GenParticle in the history. More...
 
const TrackingParticleRefsimParticle () const
 Return the initial tracking particle from the history. More...
 
SimParticleTrail const & simParticleTrail () const
 Return all the simulated particle in the history. More...
 
const TrackingVertexRefsimVertex () const
 Return the initial tracking vertex from the history. More...
 
SimVertexTrail const & simVertexTrail () const
 Return all the simulated vertices in the history. More...
 

Private Attributes

bool bestMatchByMaxValue_
 
bool enableRecoToSim_
 
bool enableSimToReco_
 
bool newEvent_
 
double quality_
 
reco::RecoToSimCollection recoToSim_
 
reco::TrackBaseRef recotrack_
 
reco::SimToRecoCollection simToReco_
 
edm::InputTag trackAssociator_
 
TrackingParticleRef trackingParticle_
 
edm::InputTag trackingTruth_
 
edm::InputTag trackProducer_
 

Additional Inherited Members

- Public Types inherited from HistoryBase
typedef std::vector< const
HepMC::GenParticle * > 
GenParticleTrail
 HepMC::GenParticle trail type. More...
 
typedef std::vector< const
HepMC::GenVertex * > 
GenVertexTrail
 GenVertex trail type. More...
 
typedef std::set< const
HepMC::GenVertex * > 
GenVertexTrailHelper
 GenVertex trail helper type. More...
 
typedef std::vector< const
reco::GenParticle * > 
RecoGenParticleTrail
 reco::GenParticle trail type. More...
 
typedef std::set< const
reco::GenParticle * > 
RecoGenParticleTrailHelper
 reco::GenParticle trail helper type. More...
 
typedef std::vector
< TrackingParticleRef
SimParticleTrail
 SimParticle trail type. More...
 
typedef std::vector
< TrackingVertexRef
SimVertexTrail
 SimVertex trail type. More...
 
- Protected Member Functions inherited from HistoryBase
bool evaluate (TrackingParticleRef tpr)
 Evaluate track history using a TrackingParticleRef. More...
 
bool evaluate (TrackingVertexRef tvr)
 Evaluate track history using a TrackingParticleRef. More...
 
- Protected Attributes inherited from HistoryBase
GenParticleTrail genParticleTrail_
 
GenVertexTrail genVertexTrail_
 
GenVertexTrailHelper genVertexTrailHelper_
 
RecoGenParticleTrail recoGenParticleTrail_
 
RecoGenParticleTrailHelper recoGenParticleTrailHelper_
 
SimParticleTrail simParticleTrail_
 
SimVertexTrail simVertexTrail_
 

Detailed Description

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

Definition at line 17 of file TrackHistory.h.

Constructor & Destructor Documentation

TrackHistory::TrackHistory ( const edm::ParameterSet config,
edm::ConsumesCollector &&  collector 
)

Constructor by pset.

Definition at line 6 of file TrackHistory.cc.

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

9  : HistoryBase()
10 {
11  // Name of the track collection
12  trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" );
14 
15  // Name of the traking pariticle collection
16  trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" );
18 
19  // Track association record
20  trackAssociator_ = config.getUntrackedParameter<edm::InputTag> ( "trackAssociator" );
21 
22  // Association by max. value
23  bestMatchByMaxValue_ = config.getUntrackedParameter<bool> ( "bestMatchByMaxValue" );
24 
25  // Enable RecoToSim association
26  enableRecoToSim_ = config.getUntrackedParameter<bool> ( "enableRecoToSim" );
27 
28  // Enable SimToReco association
29  enableSimToReco_ = config.getUntrackedParameter<bool> ( "enableSimToReco" );
30 
31  if(enableRecoToSim_ or enableSimToReco_) {
33  }
34 
35  quality_ = 0.;
36 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
std::vector< TrackingParticle > TrackingParticleCollection
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool enableSimToReco_
Definition: TrackHistory.h:88
edm::InputTag trackProducer_
Definition: TrackHistory.h:92
bool enableRecoToSim_
Definition: TrackHistory.h:88
edm::InputTag trackAssociator_
Definition: TrackHistory.h:96
double quality_
Definition: TrackHistory.h:90
bool bestMatchByMaxValue_
Definition: TrackHistory.h:86
edm::InputTag trackingTruth_
Definition: TrackHistory.h:94

Member Function Documentation

bool TrackHistory::evaluate ( TrackingParticleRef  tpr)
inline

Evaluate track history using a TrackingParticleRef.

Definition at line 41 of file TrackHistory.h.

References bestMatchByMaxValue_, enableSimToReco_, HistoryBase::evaluate(), match(), quality_, recotrack_, mps_fire::result, and simToReco_.

Referenced by TrackClassifier::evaluate(), and GenTrackMatcher::produce().

42  {
43  if ( enableSimToReco_ )
44  {
45  std::pair<reco::TrackBaseRef, double> result = match(tpr, simToReco_, bestMatchByMaxValue_);
46  recotrack_ = result.first;
47  quality_ = result.second;
48  }
49  return HistoryBase::evaluate(tpr);
50  }
bool enableSimToReco_
Definition: TrackHistory.h:88
reco::SimToRecoCollection simToReco_
Definition: TrackHistory.h:104
tuple result
Definition: mps_fire.py:84
double quality_
Definition: TrackHistory.h:90
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:135
bool bestMatchByMaxValue_
Definition: TrackHistory.h:86
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:98
bool TrackHistory::evaluate ( reco::TrackBaseRef  tr)

Evaluate reco::Track history using a given association.

Definition at line 66 of file TrackHistory.cc.

References bestMatchByMaxValue_, enableRecoToSim_, HistoryBase::evaluate(), edm::Ref< C, T, F >::isNull(), match(), quality_, recoToSim_, recotrack_, mps_fire::result, and trackingParticle_.

67 {
68  if ( !enableRecoToSim_ ) return false;
69 
70  std::pair<TrackingParticleRef, double> result = match(tr, recoToSim_, bestMatchByMaxValue_);
71 
72  TrackingParticleRef tpr( result.first );
73  quality_ = result.second;
74  trackingParticle_ = tpr;
75 
76  if ( !tpr.isNull() )
77  {
79 
80  recotrack_ = tr;
81 
82  return true;
83  }
84 
85  return false;
86 }
tuple result
Definition: mps_fire.py:84
reco::RecoToSimCollection recoToSim_
Definition: TrackHistory.h:102
TrackingParticleRef trackingParticle_
Definition: TrackHistory.h:100
bool enableRecoToSim_
Definition: TrackHistory.h:88
double quality_
Definition: TrackHistory.h:90
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:135
bool bestMatchByMaxValue_
Definition: TrackHistory.h:86
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:98
const std::pair<TrackingParticleRef, double> TrackHistory::getMatchedTrackingParticle ( ) const
inline

Definition at line 68 of file TrackHistory.h.

References quality_, mps_fire::result, and trackingParticle_.

69  {
70  std::pair<TrackingParticleRef, double> result;
71  result.first = trackingParticle_;
72  result.second = quality_;
73 
74  return result;
75  }
tuple result
Definition: mps_fire.py:84
TrackingParticleRef trackingParticle_
Definition: TrackHistory.h:100
double quality_
Definition: TrackHistory.h:90
void TrackHistory::newEvent ( const edm::Event event,
const edm::EventSetup setup 
)

Pre-process event information (for accessing reconstruction information)

Definition at line 39 of file TrackHistory.cc.

References enableRecoToSim_, enableSimToReco_, recoToSim_, simToReco_, ecalTPGAnalyzer_cfg::TPCollection, trackAssociator_, HLT_25ns10e33_v2_cff::trackCollection, trackingTruth_, and trackProducer_.

Referenced by TrackClassifier::newEvent(), and GenTrackMatcher::produce().

42 {
44  {
45  // Track collection
47  event.getByLabel(trackProducer_, trackCollection);
48 
49  // Tracking particle information
51  event.getByLabel(trackingTruth_, TPCollection);
52 
53  // Get the track associator
55  event.getByLabel(trackAssociator_, associator);
56 
57  // Calculate the map between recotracks -> tp
58  if ( enableRecoToSim_ ) recoToSim_ = associator->associateRecoToSim(trackCollection, TPCollection);
59 
60  // Calculate the map between recotracks <- tp
61  if ( enableSimToReco_ ) simToReco_ = associator->associateSimToReco(trackCollection, TPCollection );
62  }
63 }
bool enableSimToReco_
Definition: TrackHistory.h:88
reco::SimToRecoCollection simToReco_
Definition: TrackHistory.h:104
edm::InputTag trackProducer_
Definition: TrackHistory.h:92
reco::RecoToSimCollection recoToSim_
Definition: TrackHistory.h:102
bool enableRecoToSim_
Definition: TrackHistory.h:88
edm::InputTag trackAssociator_
Definition: TrackHistory.h:96
edm::InputTag trackingTruth_
Definition: TrackHistory.h:94
double TrackHistory::quality ( void  ) const
inline

Definition at line 77 of file TrackHistory.h.

References quality_.

78  {
79  return quality_;
80  }
double quality_
Definition: TrackHistory.h:90
const reco::TrackBaseRef& TrackHistory::recoTrack ( ) const
inline

Return a reference to the reconstructed track.

Definition at line 62 of file TrackHistory.h.

References recotrack_.

Referenced by TrackClassifier::evaluate().

63  {
64  return recotrack_;
65  }
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:98

Member Data Documentation

bool TrackHistory::bestMatchByMaxValue_
private

Definition at line 86 of file TrackHistory.h.

Referenced by evaluate(), and TrackHistory().

bool TrackHistory::enableRecoToSim_
private

Definition at line 88 of file TrackHistory.h.

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

bool TrackHistory::enableSimToReco_
private

Definition at line 88 of file TrackHistory.h.

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

bool TrackHistory::newEvent_
private

Definition at line 84 of file TrackHistory.h.

double TrackHistory::quality_
private

Definition at line 90 of file TrackHistory.h.

Referenced by evaluate(), getMatchedTrackingParticle(), quality(), and TrackHistory().

reco::RecoToSimCollection TrackHistory::recoToSim_
private

Definition at line 102 of file TrackHistory.h.

Referenced by evaluate(), and newEvent().

reco::TrackBaseRef TrackHistory::recotrack_
private

Definition at line 98 of file TrackHistory.h.

Referenced by evaluate(), and recoTrack().

reco::SimToRecoCollection TrackHistory::simToReco_
private

Definition at line 104 of file TrackHistory.h.

Referenced by evaluate(), and newEvent().

edm::InputTag TrackHistory::trackAssociator_
private

Definition at line 96 of file TrackHistory.h.

Referenced by newEvent(), and TrackHistory().

TrackingParticleRef TrackHistory::trackingParticle_
private

Definition at line 100 of file TrackHistory.h.

Referenced by evaluate(), and getMatchedTrackingParticle().

edm::InputTag TrackHistory::trackingTruth_
private

Definition at line 94 of file TrackHistory.h.

Referenced by newEvent(), and TrackHistory().

edm::InputTag TrackHistory::trackProducer_
private

Definition at line 92 of file TrackHistory.h.

Referenced by newEvent(), and TrackHistory().