CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
25  if (enableRecoToSim_ or enableSimToReco_) {
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 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:76
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
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
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:78
tuple vertexCollection
tuple result
Definition: mps_fire.py:311
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: VertexHistory.h:38
edm::InputTag trackingTruth_
Definition: VertexHistory.h:70
edm::InputTag vertexAssociator_
Definition: VertexHistory.h:72
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:74
bool enableRecoToSim_
Definition: VertexHistory.h:64
bool isNull() const
Checks for null.
Definition: Ref.h:235
std::vector< TrackingVertex > TrackingVertexCollection
VertexHistory(const edm::ParameterSet &, edm::ConsumesCollector)
Constructor by pset.
Definition: VertexHistory.cc:6
Base class to all the history types.
Definition: HistoryBase.h:12
tuple config
parse the configuration file
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
edm::InputTag vertexProducer_
Definition: VertexHistory.h:68