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 trackAssociator_
 
edm::InputTag trackingTruth_
 
edm::InputTag trackProducer_
 
std::string 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_, AlCaHLTBitMon_QueryRunRegistry::string, trackAssociator_, trackingTruth_, trackProducer_, vertexAssociator_, and vertexProducer_.

9  : HistoryBase()
10 {
11  // Name of the track collection
12  trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" );
13 
14  // Name of the track collection
15  vertexProducer_ = config.getUntrackedParameter<edm::InputTag> ( "vertexProducer" );
16 
17  // Name of the traking pariticle collection
18  trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" );
19 
20  // Track association record
21  trackAssociator_ = config.getUntrackedParameter<edm::InputTag> ( "trackAssociator" );
22 
23  // Track association record
24  vertexAssociator_ = config.getUntrackedParameter<std::string> ( "vertexAssociator" );
25 
26  // Association by max. value
27  bestMatchByMaxValue_ = config.getUntrackedParameter<bool> ( "bestMatchByMaxValue" );
28 
29  // Enable RecoToSim association
30  enableRecoToSim_ = config.getUntrackedParameter<bool> ( "enableRecoToSim" );
31 
32  // Enable SimToReco association
33  enableSimToReco_ = config.getUntrackedParameter<bool> ( "enableSimToReco" );
34 
35  if(enableRecoToSim_ or enableSimToReco_) {
41  }
42 
43  quality_ = 0.;
44 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
bool bestMatchByMaxValue_
Definition: VertexHistory.h:78
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
edm::InputTag trackProducer_
Definition: VertexHistory.h:84
edm::InputTag trackAssociator_
Definition: VertexHistory.h:90
edm::InputTag trackingTruth_
Definition: VertexHistory.h:88
bool enableRecoToSim_
Definition: VertexHistory.h:80
std::vector< TrackingVertex > TrackingVertexCollection
std::string vertexAssociator_
Definition: VertexHistory.h:92
bool enableSimToReco_
Definition: VertexHistory.h:80
edm::InputTag vertexProducer_
Definition: VertexHistory.h:86

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_, query::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:98
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:94
tuple result
Definition: query.py:137
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 102 of file VertexHistory.cc.

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

103 {
104 
105  if ( !enableRecoToSim_ ) return false;
106 
107  std::pair<TrackingVertexRef, double> result = match(tv, recoToSim_, bestMatchByMaxValue_);
108 
109  TrackingVertexRef tvr( result.first );
110  quality_ = result.second;
111 
112  if ( !tvr.isNull() )
113  {
115 
116  recovertex_ = tv;
117 
118  return true;
119  }
120 
121  return false;
122 }
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:96
bool bestMatchByMaxValue_
Definition: VertexHistory.h:78
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:94
tuple result
Definition: query.py:137
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 47 of file VertexHistory.cc.

References enableRecoToSim_, enableSimToReco_, edm::EventSetup::get(), recoToSim_, simToReco_, ecalTPGAnalyzer_cfg::TPCollection, trackAssociator_, HLT_25ns14e33_v3_cff::trackCollection, trackingTruth_, trackProducer_, vertexAssociator_, GoodVertex_cfg::vertexCollection, and vertexProducer_.

Referenced by VertexClassifier::newEvent().

50 {
52  {
53 
54  // Track collection
56  event.getByLabel(trackProducer_, trackCollection);
57 
58  // Tracking particle information
60  event.getByLabel(trackingTruth_, TPCollection);
61 
62  // Get the track associator
64  event.getByLabel(trackAssociator_, trackAssociator);
65 
66  // Vertex collection
68  event.getByLabel(vertexProducer_, vertexCollection);
69 
70  // Tracking particle information
72  event.getByLabel(trackingTruth_, TVCollection);
73 
74  // Get the track associator
75  edm::ESHandle<VertexAssociatorBase> vertexAssociator;
76  setup.get<VertexAssociatorRecord>().get(vertexAssociator_, vertexAssociator);
77 
78  if ( enableRecoToSim_ )
79  {
80  // Get the map between recovertex -> simvertex
82  trackRecoToSim = trackAssociator->associateRecoToSim(trackCollection, TPCollection);
83 
84  // Calculate the map between recovertex -> simvertex
85  recoToSim_ = vertexAssociator->associateRecoToSim(vertexCollection, TVCollection, event, trackRecoToSim);
86  }
87 
88  if ( enableSimToReco_ )
89  {
90  // Get the map between recovertex <- simvertex
92  trackSimToReco = trackAssociator->associateSimToReco (trackCollection, TPCollection);
93 
94  // Calculate the map between recovertex <- simvertex
95  simToReco_ = vertexAssociator->associateSimToReco(vertexCollection, TVCollection, event, trackSimToReco);
96  }
97 
98  }
99 }
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:96
edm::InputTag trackProducer_
Definition: VertexHistory.h:84
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:98
tuple vertexCollection
edm::InputTag trackAssociator_
Definition: VertexHistory.h:90
edm::InputTag trackingTruth_
Definition: VertexHistory.h:88
bool enableRecoToSim_
Definition: VertexHistory.h:80
const T & get() const
Definition: EventSetup.h:55
std::string vertexAssociator_
Definition: VertexHistory.h:92
bool enableSimToReco_
Definition: VertexHistory.h:80
edm::InputTag vertexProducer_
Definition: VertexHistory.h:86
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:94

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

Referenced by evaluate(), and newEvent().

reco::VertexBaseRef VertexHistory::recovertex_
private

Definition at line 94 of file VertexHistory.h.

Referenced by evaluate(), and recoVertex().

reco::VertexSimToRecoCollection VertexHistory::simToReco_
private

Definition at line 98 of file VertexHistory.h.

Referenced by evaluate(), and newEvent().

edm::InputTag VertexHistory::trackAssociator_
private

Definition at line 90 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

edm::InputTag VertexHistory::trackingTruth_
private

Definition at line 88 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

edm::InputTag VertexHistory::trackProducer_
private

Definition at line 84 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

std::string VertexHistory::vertexAssociator_
private

Definition at line 92 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

edm::InputTag VertexHistory::vertexProducer_
private

Definition at line 86 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().