CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VertexHistory.cc
Go to the documentation of this file.
1 
5 
8  edm::ConsumesCollector&& collector
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_) {
30  collector.consumes<edm::View<reco::Vertex>>(vertexProducer_);
31  collector.consumes<TrackingVertexCollection>(trackingTruth_);
33  }
34 
35  quality_ = 0.;
36 }
37 
38 
40  const edm::Event & event, const edm::EventSetup & setup
41 )
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 }
71 
72 
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 }
94 
T getUntrackedParameter(std::string const &, T const &) const
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:92
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
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
VertexHistory(const edm::ParameterSet &, edm::ConsumesCollector &&)
Constructor by pset.
Definition: VertexHistory.cc:6
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:94
tuple vertexCollection
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: VertexHistory.h:42
edm::InputTag trackingTruth_
Definition: VertexHistory.h:86
edm::InputTag vertexAssociator_
Definition: VertexHistory.h:88
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:90
tuple result
Definition: query.py:137
bool enableRecoToSim_
Definition: VertexHistory.h:80
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isNull() const
Checks for null.
Definition: Ref.h:249
std::vector< TrackingVertex > TrackingVertexCollection
Base class to all the history types.
Definition: HistoryBase.h:12
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
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
edm::InputTag vertexProducer_
Definition: VertexHistory.h:84