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
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...
 
const HepMC::GenParticle * genParticle () const
 Returns a pointer to most primitive status 1 or 2 particle. More...
 
GenParticleTrail const & genParticleTrail () const
 Return all generated particle in the history. More...
 
GenVertexTrail const & genVertexTrail () const
 Return all generated vertex in the history. More...
 
 HistoryBase ()
 
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
 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
< 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_
 
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_, enableRecoToSim_, enableSimToReco_, edm::ParameterSet::getUntrackedParameter(), or, quality_, trackingTruth_, vertexAssociator_, and vertexProducer_.

9  : HistoryBase()
10 {
11  // Name of the track collection
12  vertexProducer_ = config.getUntrackedParameter<edm::InputTag> ( "vertexProducer" );
13 
14  // Name of the traking pariticle collection
15  trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" );
16 
17  // Vertex association record
18  vertexAssociator_ = config.getUntrackedParameter<edm::InputTag> ( "vertexAssociator" );
19 
20  // Association by max. value
21  bestMatchByMaxValue_ = config.getUntrackedParameter<bool> ( "bestMatchByMaxValue" );
22 
23  // Enable RecoToSim association
24  enableRecoToSim_ = config.getUntrackedParameter<bool> ( "enableRecoToSim" );
25 
26  // Enable SimToReco association
27  enableSimToReco_ = config.getUntrackedParameter<bool> ( "enableSimToReco" );
28 
29  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
bool bestMatchByMaxValue_
Definition: VertexHistory.h:78
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:86
edm::InputTag vertexAssociator_
Definition: VertexHistory.h:88
bool enableRecoToSim_
Definition: VertexHistory.h:80
std::vector< TrackingVertex > TrackingVertexCollection
bool enableSimToReco_
Definition: VertexHistory.h:80
edm::InputTag vertexProducer_
Definition: VertexHistory.h:84

Member Function Documentation

bool VertexHistory::evaluate ( TrackingVertexRef  tvr)
inline

Evaluate track history using a TrackingParticleRef.

Definition at line 42 of file VertexHistory.h.

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

Referenced by VertexClassifier::evaluate().

43  {
44  if ( enableSimToReco_ )
45  {
46 
47  std::pair<reco::VertexBaseRef, double> result = match(tvr, simToReco_, bestMatchByMaxValue_);
48  recovertex_ = result.first;
49  quality_ = result.second;
50  }
51  return HistoryBase::evaluate(tvr);
52  }
bool bestMatchByMaxValue_
Definition: VertexHistory.h:78
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:94
tuple result
Definition: mps_fire.py:83
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:90
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:114
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:80
bool VertexHistory::evaluate ( reco::VertexBaseRef  tv)

Evaluate reco::Vertex history using a given association.

Definition at line 73 of file VertexHistory.cc.

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

74 {
75 
76  if ( !enableRecoToSim_ ) return false;
77 
78  std::pair<TrackingVertexRef, double> result = match(tv, recoToSim_, bestMatchByMaxValue_);
79 
80  TrackingVertexRef tvr( result.first );
81  quality_ = result.second;
82 
83  if ( !tvr.isNull() )
84  {
86 
87  recovertex_ = tv;
88 
89  return true;
90  }
91 
92  return false;
93 }
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:92
bool bestMatchByMaxValue_
Definition: VertexHistory.h:78
tuple result
Definition: mps_fire.py:83
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:90
bool enableRecoToSim_
Definition: VertexHistory.h:80
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:114
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 39 of file VertexHistory.cc.

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

Referenced by VertexClassifier::newEvent().

42 {
44  {
45  // Vertex collection
47  event.getByLabel(vertexProducer_, vertexCollection);
48 
49  // Tracking particle information
51  event.getByLabel(trackingTruth_, TVCollection);
52 
53  // Get the track associator
55  event.getByLabel(vertexAssociator_, vertexAssociator);
56 
57  if ( enableRecoToSim_ )
58  {
59  // Calculate the map between recovertex -> simvertex
60  recoToSim_ = vertexAssociator->associateRecoToSim(vertexCollection, TVCollection);
61  }
62 
63  if ( enableSimToReco_ )
64  {
65  // Calculate the map between recovertex <- simvertex
66  simToReco_ = vertexAssociator->associateSimToReco(vertexCollection, TVCollection);
67  }
68 
69  }
70 }
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:92
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:94
tuple vertexCollection
edm::InputTag trackingTruth_
Definition: VertexHistory.h:86
edm::InputTag vertexAssociator_
Definition: VertexHistory.h:88
bool enableRecoToSim_
Definition: VertexHistory.h:80
bool enableSimToReco_
Definition: VertexHistory.h:80
edm::InputTag vertexProducer_
Definition: VertexHistory.h:84
double VertexHistory::quality ( void  ) const
inline

Return the quality of the match.

Definition at line 70 of file VertexHistory.h.

References quality_.

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

71  {
72  return quality_;
73  }
const reco::VertexBaseRef& VertexHistory::recoVertex ( ) const
inline

Return a reference to the reconstructed track.

Definition at line 64 of file VertexHistory.h.

References recovertex_.

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

65  {
66  return recovertex_;
67  }
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:90

Member Data Documentation

bool VertexHistory::bestMatchByMaxValue_
private

Definition at line 78 of file VertexHistory.h.

Referenced by evaluate(), and VertexHistory().

bool VertexHistory::enableRecoToSim_
private

Definition at line 80 of file VertexHistory.h.

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

bool VertexHistory::enableSimToReco_
private

Definition at line 80 of file VertexHistory.h.

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

double VertexHistory::quality_
private

Definition at line 82 of file VertexHistory.h.

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

reco::VertexRecoToSimCollection VertexHistory::recoToSim_
private

Definition at line 92 of file VertexHistory.h.

Referenced by evaluate(), and newEvent().

reco::VertexBaseRef VertexHistory::recovertex_
private

Definition at line 90 of file VertexHistory.h.

Referenced by evaluate(), and recoVertex().

reco::VertexSimToRecoCollection VertexHistory::simToReco_
private

Definition at line 94 of file VertexHistory.h.

Referenced by evaluate(), and newEvent().

edm::InputTag VertexHistory::trackingTruth_
private

Definition at line 86 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

edm::InputTag VertexHistory::vertexAssociator_
private

Definition at line 88 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

edm::InputTag VertexHistory::vertexProducer_
private

Definition at line 84 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().