CMS 3D CMS Logo

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 (reco::VertexBaseRef)
 Evaluate reco::Vertex history using a given association. More...
 
bool evaluate (TrackingVertexRef tvr)
 Evaluate track history using a TrackingParticleRef. 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
 
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_
 
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< 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 18 of file VertexHistory.h.

Constructor & Destructor Documentation

◆ VertexHistory()

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

Constructor by pset.

Definition at line 6 of file VertexHistory.cc.

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 
29  }
30 
31  quality_ = 0.;
32 }

References bestMatchByMaxValue_, enableRecoToSim_, enableSimToReco_, or, quality_, trackingTruth_, vertexAssociator_, and vertexProducer_.

Member Function Documentation

◆ evaluate() [1/2]

bool VertexHistory::evaluate ( reco::VertexBaseRef  tv)

Evaluate reco::Vertex history using a given association.

Definition at line 60 of file VertexHistory.cc.

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 }

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

◆ evaluate() [2/2]

bool VertexHistory::evaluate ( TrackingVertexRef  tvr)
inline

Evaluate track history using a TrackingParticleRef.

Definition at line 38 of file VertexHistory.h.

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  }

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

Referenced by VertexClassifier::evaluate().

◆ newEvent()

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.

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 }

References enableRecoToSim_, enableSimToReco_, recoToSim_, simToReco_, trackingTruth_, packedPFCandidates_cff::vertexAssociator, vertexAssociator_, spclusmultinvestigator_cfi::vertexCollection, and vertexProducer_.

Referenced by VertexClassifier::newEvent().

◆ quality()

double VertexHistory::quality ( void  ) const
inline

Return the quality of the match.

Definition at line 59 of file VertexHistory.h.

59 { return quality_; }

References quality_.

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

◆ recoVertex()

const reco::VertexBaseRef& VertexHistory::recoVertex ( ) const
inline

Return a reference to the reconstructed track.

Definition at line 56 of file VertexHistory.h.

56 { return recovertex_; }

References recovertex_.

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

Member Data Documentation

◆ bestMatchByMaxValue_

bool VertexHistory::bestMatchByMaxValue_
private

Definition at line 62 of file VertexHistory.h.

Referenced by evaluate(), and VertexHistory().

◆ enableRecoToSim_

bool VertexHistory::enableRecoToSim_
private

Definition at line 64 of file VertexHistory.h.

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

◆ enableSimToReco_

bool VertexHistory::enableSimToReco_
private

Definition at line 64 of file VertexHistory.h.

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

◆ quality_

double VertexHistory::quality_
private

Definition at line 66 of file VertexHistory.h.

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

◆ recoToSim_

reco::VertexRecoToSimCollection VertexHistory::recoToSim_
private

Definition at line 76 of file VertexHistory.h.

Referenced by evaluate(), and newEvent().

◆ recovertex_

reco::VertexBaseRef VertexHistory::recovertex_
private

Definition at line 74 of file VertexHistory.h.

Referenced by evaluate(), and recoVertex().

◆ simToReco_

reco::VertexSimToRecoCollection VertexHistory::simToReco_
private

Definition at line 78 of file VertexHistory.h.

Referenced by evaluate(), and newEvent().

◆ trackingTruth_

edm::InputTag VertexHistory::trackingTruth_
private

Definition at line 70 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

◆ vertexAssociator_

edm::InputTag VertexHistory::vertexAssociator_
private

Definition at line 72 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

◆ vertexProducer_

edm::InputTag VertexHistory::vertexProducer_
private

Definition at line 68 of file VertexHistory.h.

Referenced by newEvent(), and VertexHistory().

VertexHistory::vertexAssociator_
edm::InputTag vertexAssociator_
Definition: VertexHistory.h:72
TrackingVertexCollection
std::vector< TrackingVertex > TrackingVertexCollection
Definition: TrackingVertexContainer.h:8
edm::Handle
Definition: AssociativeIterator.h:50
VertexHistory::trackingTruth_
edm::InputTag trackingTruth_
Definition: VertexHistory.h:70
VertexHistory::vertexProducer_
edm::InputTag vertexProducer_
Definition: VertexHistory.h:68
VertexHistory::enableRecoToSim_
bool enableRecoToSim_
Definition: VertexHistory.h:64
edm::Ref< TrackingVertexCollection >
config
Definition: config.py:1
VertexHistory::enableSimToReco_
bool enableSimToReco_
Definition: VertexHistory.h:64
packedPFCandidates_cff.vertexAssociator
vertexAssociator
Definition: packedPFCandidates_cff.py:18
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
VertexHistory::recovertex_
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:74
edm::View
Definition: CaloClusterFwd.h:14
VertexHistory::recoToSim_
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:76
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
reco::VertexToTrackingVertexAssociator
Definition: VertexToTrackingVertexAssociator.h:9
spclusmultinvestigator_cfi.vertexCollection
vertexCollection
Definition: spclusmultinvestigator_cfi.py:4
VertexHistory::simToReco_
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:78
VertexHistory::quality_
double quality_
Definition: VertexHistory.h:66
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
VertexHistory::bestMatchByMaxValue_
bool bestMatchByMaxValue_
Definition: VertexHistory.h:62
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