CMS 3D CMS Logo

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 (reco::TrackBaseRef)
 Evaluate reco::Track history using a given association. More...
 
bool evaluate (TrackingParticleRef tpr)
 Evaluate track history using a TrackingParticleRef. 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...
 
bool evaluate (TrackingParticleRef tpr)
 Evaluate track history using a TrackingParticleRef. More...
 
bool evaluate (TrackingVertexRef tvr)
 Evaluate track history using a TrackingParticleRef. More...
 
const HepMC::GenParticle * genParticle () const
 
const GenParticleTrailgenParticleTrail () const
 Return all generated particle (HepMC::GenParticle) in the history. More...
 
const GenVertexTrailgenVertexTrail () const
 Return all generated vertex in the history. More...
 
 HistoryBase ()
 
const reco::GenParticlerecoGenParticle () const
 
const RecoGenParticleTrailrecoGenParticleTrail () const
 Return all reco::GenParticle in the history. More...
 
const TrackingParticleRefsimParticle () const
 Return the initial tracking particle from the history. More...
 
const SimParticleTrailsimParticleTrail () const
 Return all the simulated particle in the history. More...
 
const TrackingVertexRefsimVertex () const
 Return the initial tracking vertex from the history. More...
 
const SimVertexTrailsimVertexTrail () 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< TrackingParticleRefSimParticleTrail
 SimParticle trail type. More...
 
typedef std::vector< TrackingVertexRefSimVertexTrail
 SimVertex trail type. 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::TrackHistory ( const edm::ParameterSet config,
edm::ConsumesCollector &&  collector 
)

Constructor by pset.

Definition at line 5 of file TrackHistory.cc.

5  : HistoryBase() {
6  // Name of the track collection
7  trackProducer_ = config.getUntrackedParameter<edm::InputTag>("trackProducer");
9 
10  // Name of the traking pariticle collection
11  trackingTruth_ = config.getUntrackedParameter<edm::InputTag>("trackingTruth");
13 
14  // Track association record
15  trackAssociator_ = config.getUntrackedParameter<edm::InputTag>("trackAssociator");
16 
17  // Association by max. value
18  bestMatchByMaxValue_ = config.getUntrackedParameter<bool>("bestMatchByMaxValue");
19 
20  // Enable RecoToSim association
21  enableRecoToSim_ = config.getUntrackedParameter<bool>("enableRecoToSim");
22 
23  // Enable SimToReco association
24  enableSimToReco_ = config.getUntrackedParameter<bool>("enableSimToReco");
25 
28  }
29 
30  quality_ = 0.;
31 }

References bestMatchByMaxValue_, enableRecoToSim_, enableSimToReco_, or, quality_, trackAssociator_, trackingTruth_, and trackProducer_.

Member Function Documentation

◆ evaluate() [1/2]

bool TrackHistory::evaluate ( reco::TrackBaseRef  tr)

Evaluate reco::Track history using a given association.

Definition at line 57 of file TrackHistory.cc.

57  {
58  if (!enableRecoToSim_)
59  return false;
60 
61  std::pair<TrackingParticleRef, double> result = match(tr, recoToSim_, bestMatchByMaxValue_);
62 
63  TrackingParticleRef tpr(result.first);
64  quality_ = result.second;
65  trackingParticle_ = tpr;
66 
67  if (!tpr.isNull()) {
69 
70  recotrack_ = tr;
71 
72  return true;
73  }
74 
75  return false;
76 }

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

◆ evaluate() [2/2]

bool TrackHistory::evaluate ( TrackingParticleRef  tpr)
inline

Evaluate track history using a TrackingParticleRef.

Definition at line 37 of file TrackHistory.h.

37  {
38  if (enableSimToReco_) {
39  std::pair<reco::TrackBaseRef, double> result = match(tpr, simToReco_, bestMatchByMaxValue_);
40  recotrack_ = result.first;
41  quality_ = result.second;
42  }
43  return HistoryBase::evaluate(tpr);
44  }

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

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

◆ getMatchedTrackingParticle()

const std::pair<TrackingParticleRef, double> TrackHistory::getMatchedTrackingParticle ( ) const
inline

Definition at line 58 of file TrackHistory.h.

58  {
59  std::pair<TrackingParticleRef, double> result;
60  result.first = trackingParticle_;
61  result.second = quality_;
62 
63  return result;
64  }

References quality_, mps_fire::result, and trackingParticle_.

Referenced by BDHadronTrackMonitoringAnalyzer::analyze().

◆ newEvent()

void TrackHistory::newEvent ( const edm::Event event,
const edm::EventSetup setup 
)

Pre-process event information (for accessing reconstruction information)

Definition at line 33 of file TrackHistory.cc.

33  {
35  // Track collection
37  event.getByLabel(trackProducer_, trackCollection);
38 
39  // Tracking particle information
41  event.getByLabel(trackingTruth_, TPCollection);
42 
43  // Get the track associator
45  event.getByLabel(trackAssociator_, associator);
46 
47  // Calculate the map between recotracks -> tp
48  if (enableRecoToSim_)
49  recoToSim_ = associator->associateRecoToSim(trackCollection, TPCollection);
50 
51  // Calculate the map between recotracks <- tp
52  if (enableSimToReco_)
53  simToReco_ = associator->associateSimToReco(trackCollection, TPCollection);
54  }
55 }

References LCToCPAssociation_cfi::associator, enableRecoToSim_, enableSimToReco_, recoToSim_, simToReco_, trackAssociator_, duplicaterechits_cfi::trackCollection, trackingTruth_, and trackProducer_.

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

◆ quality()

double TrackHistory::quality ( void  ) const
inline

Definition at line 66 of file TrackHistory.h.

66 { return quality_; }

References quality_.

◆ recoTrack()

const reco::TrackBaseRef& TrackHistory::recoTrack ( ) const
inline

Return a reference to the reconstructed track.

Definition at line 55 of file TrackHistory.h.

55 { return recotrack_; }

References recotrack_.

Referenced by TrackClassifier::evaluate().

Member Data Documentation

◆ bestMatchByMaxValue_

bool TrackHistory::bestMatchByMaxValue_
private

Definition at line 71 of file TrackHistory.h.

Referenced by evaluate(), and TrackHistory().

◆ enableRecoToSim_

bool TrackHistory::enableRecoToSim_
private

Definition at line 73 of file TrackHistory.h.

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

◆ enableSimToReco_

bool TrackHistory::enableSimToReco_
private

Definition at line 73 of file TrackHistory.h.

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

◆ newEvent_

bool TrackHistory::newEvent_
private

Definition at line 69 of file TrackHistory.h.

◆ quality_

double TrackHistory::quality_
private

Definition at line 75 of file TrackHistory.h.

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

◆ recoToSim_

reco::RecoToSimCollection TrackHistory::recoToSim_
private

Definition at line 87 of file TrackHistory.h.

Referenced by evaluate(), and newEvent().

◆ recotrack_

reco::TrackBaseRef TrackHistory::recotrack_
private

Definition at line 83 of file TrackHistory.h.

Referenced by evaluate(), and recoTrack().

◆ simToReco_

reco::SimToRecoCollection TrackHistory::simToReco_
private

Definition at line 89 of file TrackHistory.h.

Referenced by evaluate(), and newEvent().

◆ trackAssociator_

edm::InputTag TrackHistory::trackAssociator_
private

Definition at line 81 of file TrackHistory.h.

Referenced by newEvent(), and TrackHistory().

◆ trackingParticle_

TrackingParticleRef TrackHistory::trackingParticle_
private

Definition at line 85 of file TrackHistory.h.

Referenced by evaluate(), and getMatchedTrackingParticle().

◆ trackingTruth_

edm::InputTag TrackHistory::trackingTruth_
private

Definition at line 79 of file TrackHistory.h.

Referenced by newEvent(), and TrackHistory().

◆ trackProducer_

edm::InputTag TrackHistory::trackProducer_
private

Definition at line 77 of file TrackHistory.h.

Referenced by newEvent(), and TrackHistory().

LCToCPAssociation_cfi.associator
associator
Definition: LCToCPAssociation_cfi.py:4
TrackHistory::bestMatchByMaxValue_
bool bestMatchByMaxValue_
Definition: TrackHistory.h:71
TrackHistory::recoToSim_
reco::RecoToSimCollection recoToSim_
Definition: TrackHistory.h:87
reco::TrackToTrackingParticleAssociator
Definition: TrackToTrackingParticleAssociator.h:51
TrackHistory::enableRecoToSim_
bool enableRecoToSim_
Definition: TrackHistory.h:73
TrackHistory::trackProducer_
edm::InputTag trackProducer_
Definition: TrackHistory.h:77
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref< TrackingParticleCollection >
config
Definition: config.py:1
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
edm::View
Definition: CaloClusterFwd.h:14
TrackHistory::trackingParticle_
TrackingParticleRef trackingParticle_
Definition: TrackHistory.h:85
TrackHistory::trackAssociator_
edm::InputTag trackAssociator_
Definition: TrackHistory.h:81
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
TrackHistory::recotrack_
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:83
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
HistoryBase::HistoryBase
HistoryBase()
Definition: HistoryBase.h:36
TrackHistory::trackingTruth_
edm::InputTag trackingTruth_
Definition: TrackHistory.h:79
TrackHistory::simToReco_
reco::SimToRecoCollection simToReco_
Definition: TrackHistory.h:89
TrackHistory::enableSimToReco_
bool enableSimToReco_
Definition: TrackHistory.h:73
TrackHistory::quality_
double quality_
Definition: TrackHistory.h:75
TrackingParticleCollection
std::vector< TrackingParticle > TrackingParticleCollection
Definition: TrackingParticleFwd.h:9
or
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
mps_fire.result
result
Definition: mps_fire.py:311
HistoryBase::evaluate
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:96
edm::InputTag
Definition: InputTag.h:15