CMS 3D CMS Logo

VertexHistory.cc
Go to the documentation of this file.
1 
5 
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 
26  collector.consumes<edm::View<reco::Vertex>>(vertexProducer_);
27  collector.consumes<TrackingVertexCollection>(trackingTruth_);
29  }
30 
31  quality_ = 0.;
32 }
33 
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 }
59 
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 }
VertexHistory::vertexAssociator_
edm::InputTag vertexAssociator_
Definition: VertexHistory.h:72
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
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
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
VertexHistory::enableRecoToSim_
bool enableRecoToSim_
Definition: VertexHistory.h:64
edm::Ref< TrackingVertexCollection >
VertexHistory::VertexHistory
VertexHistory(const edm::ParameterSet &, edm::ConsumesCollector &&)
Constructor by pset.
Definition: VertexHistory.cc:6
VertexHistory.h
config
Definition: config.py:1
VertexHistory::enableSimToReco_
bool enableSimToReco_
Definition: VertexHistory.h:64
packedPFCandidates_cff.vertexAssociator
vertexAssociator
Definition: packedPFCandidates_cff.py:18
VertexHistory::evaluate
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: VertexHistory.h:38
VertexHistory::recovertex_
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:74
edm::View
Definition: CaloClusterFwd.h:14
TrackToTrackingParticleAssociator.h
edm::ParameterSet
Definition: ParameterSet.h:47
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
Base class to all the history types.
Definition: HistoryBase.h:12
edm::EventSetup
Definition: EventSetup.h:58
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
edm::RefToBase< reco::Vertex >
VertexHistory::bestMatchByMaxValue_
bool bestMatchByMaxValue_
Definition: VertexHistory.h:62
mps_fire.result
result
Definition: mps_fire.py:311
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
VertexHistory::newEvent
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
Definition: VertexHistory.cc:34
HistoryBase::evaluate
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:96
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
VertexToTrackingVertexAssociator.h