CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | 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

Public Member Functions

bool evaluate (TrackingVertexRef tvr)
 Evaluate track history using a TrackingParticleRef. More...
 
bool evaluate (reco::VertexBaseRef)
 Evaluate reco::Vertex history using a given association. More...
 
void newEvent (const edm::Event &, const edm::EventSetup &)
 Pre-process event information (for accessing reconstruction information) More...
 
double quality () const
 Return the quality of the match. More...
 
const reco::VertexBaseRefrecoVertex () const
 Return a reference to the reconstructed track. More...
 
 VertexHistory (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
 
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
 
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_
 
double quality_
 
reco::VertexRecoToSimCollection recoToSim_
 
reco::VertexBaseRef recovertex_
 
reco::VertexSimToRecoCollection simToReco_
 
edm::InputTag trackingTruth_
 
edm::InputTag vertexAssociator_
 
edm::InputTag vertexProducer_
 

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 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 18 of file VertexHistory.h.

Constructor & Destructor Documentation

VertexHistory::VertexHistory ( const edm::ParameterSet config,
edm::ConsumesCollector  collector 
)

Constructor by pset.

Definition at line 6 of file VertexHistory.cc.

References bestMatchByMaxValue_, edm::ConsumesCollector::consumes(), enableRecoToSim_, enableSimToReco_, edm::ParameterSet::getUntrackedParameter(), or, quality_, trackingTruth_, vertexAssociator_, and vertexProducer_.

6  : HistoryBase() {
7  // Name of the track collection
8  vertexProducer_ = config.getUntrackedParameter<edm::InputTag>("vertexProducer");
9 
10  // Name of the traking pariticle collection
11  trackingTruth_ = config.getUntrackedParameter<edm::InputTag>("trackingTruth");
12 
13  // Vertex association record
14  vertexAssociator_ = config.getUntrackedParameter<edm::InputTag>("vertexAssociator");
15 
16  // Association by max. value
17  bestMatchByMaxValue_ = config.getUntrackedParameter<bool>("bestMatchByMaxValue");
18 
19  // Enable RecoToSim association
20  enableRecoToSim_ = config.getUntrackedParameter<bool>("enableRecoToSim");
21 
22  // Enable SimToReco association
23  enableSimToReco_ = config.getUntrackedParameter<bool>("enableSimToReco");
24 
25  if (enableRecoToSim_ or enableSimToReco_) {
29  }
30 
31  quality_ = 0.;
32 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
bool bestMatchByMaxValue_
Definition: VertexHistory.h:62
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
edm::InputTag trackingTruth_
Definition: VertexHistory.h:70
edm::InputTag vertexAssociator_
Definition: VertexHistory.h:72
bool enableRecoToSim_
Definition: VertexHistory.h:64
std::vector< TrackingVertex > TrackingVertexCollection
bool enableSimToReco_
Definition: VertexHistory.h:64
edm::InputTag vertexProducer_
Definition: VertexHistory.h:68

Member Function Documentation

bool VertexHistory::evaluate ( TrackingVertexRef  tvr)
inline

Evaluate track history using a TrackingParticleRef.

Definition at line 38 of file VertexHistory.h.

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

Referenced by VertexClassifier::evaluate().

38  {
39  if (enableSimToReco_) {
40  std::pair<reco::VertexBaseRef, double> result = match(tvr, simToReco_, bestMatchByMaxValue_);
41  recovertex_ = result.first;
42  quality_ = result.second;
43  }
44  return HistoryBase::evaluate(tvr);
45  }
bool bestMatchByMaxValue_
Definition: VertexHistory.h:62
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:78
tuple result
Definition: mps_fire.py:311
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:74
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:96
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
bool enableSimToReco_
Definition: VertexHistory.h:64
bool VertexHistory::evaluate ( reco::VertexBaseRef  tv)

Evaluate reco::Vertex history using a given association.

Definition at line 60 of file VertexHistory.cc.

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

60  {
61  if (!enableRecoToSim_)
62  return false;
63 
64  std::pair<TrackingVertexRef, double> result = match(tv, recoToSim_, bestMatchByMaxValue_);
65 
66  TrackingVertexRef tvr(result.first);
67  quality_ = result.second;
68 
69  if (!tvr.isNull()) {
71 
72  recovertex_ = tv;
73 
74  return true;
75  }
76 
77  return false;
78 }
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:76
bool bestMatchByMaxValue_
Definition: VertexHistory.h:62
tuple result
Definition: mps_fire.py:311
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:74
bool enableRecoToSim_
Definition: VertexHistory.h:64
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:96
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void VertexHistory::newEvent ( const edm::Event event,
const edm::EventSetup setup 
)

Pre-process event information (for accessing reconstruction information)

Definition at line 34 of file VertexHistory.cc.

References enableRecoToSim_, enableSimToReco_, recoToSim_, simToReco_, trackingTruth_, vertexAssociator_, GoodVertex_cfg::vertexCollection, and vertexProducer_.

Referenced by VertexClassifier::newEvent().

34  {
36  // Vertex collection
38  event.getByLabel(vertexProducer_, vertexCollection);
39 
40  // Tracking particle information
42  event.getByLabel(trackingTruth_, TVCollection);
43 
44  // Get the track associator
46  event.getByLabel(vertexAssociator_, vertexAssociator);
47 
48  if (enableRecoToSim_) {
49  // Calculate the map between recovertex -> simvertex
50  recoToSim_ = vertexAssociator->associateRecoToSim(vertexCollection, TVCollection);
51  }
52 
53  if (enableSimToReco_) {
54  // Calculate the map between recovertex <- simvertex
55  simToReco_ = vertexAssociator->associateSimToReco(vertexCollection, TVCollection);
56  }
57  }
58 }
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:76
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:78
tuple vertexCollection
edm::InputTag trackingTruth_
Definition: VertexHistory.h:70
edm::InputTag vertexAssociator_
Definition: VertexHistory.h:72
bool enableRecoToSim_
Definition: VertexHistory.h:64
bool enableSimToReco_
Definition: VertexHistory.h:64
edm::InputTag vertexProducer_
Definition: VertexHistory.h:68
double VertexHistory::quality ( void  ) const
inline

Return the quality of the match.

Definition at line 59 of file VertexHistory.h.

References quality_.

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

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

Return a reference to the reconstructed track.

Definition at line 56 of file VertexHistory.h.

References recovertex_.

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

56 { return recovertex_; }
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:74

Member Data Documentation

bool VertexHistory::bestMatchByMaxValue_
private

Definition at line 62 of file VertexHistory.h.

Referenced by evaluate(), and VertexHistory().

bool VertexHistory::enableRecoToSim_
private

Definition at line 64 of file VertexHistory.h.

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

bool VertexHistory::enableSimToReco_
private

Definition at line 64 of file VertexHistory.h.

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

double VertexHistory::quality_
private

Definition at line 66 of file VertexHistory.h.

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

reco::VertexRecoToSimCollection VertexHistory::recoToSim_
private

Definition at line 76 of file VertexHistory.h.

Referenced by evaluate(), and newEvent().

reco::VertexBaseRef VertexHistory::recovertex_
private

Definition at line 74 of file VertexHistory.h.

Referenced by evaluate(), and recoVertex().

reco::VertexSimToRecoCollection VertexHistory::simToReco_
private

Definition at line 78 of file VertexHistory.h.

Referenced by evaluate(), and newEvent().

edm::InputTag VertexHistory::trackingTruth_
private

Definition at line 70 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

edm::InputTag VertexHistory::vertexAssociator_
private

Definition at line 72 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

edm::InputTag VertexHistory::vertexProducer_
private

Definition at line 68 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().