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 ) : HistoryBase()
9 {
10  // Name of the track collection
11  trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" );
12 
13  // Name of the track collection
14  vertexProducer_ = config.getUntrackedParameter<edm::InputTag> ( "vertexProducer" );
15 
16  // Name of the traking pariticle collection
17  trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" );
18 
19  // Track association record
20  trackAssociator_ = config.getUntrackedParameter<std::string> ( "trackAssociator" );
21 
22  // Track association record
23  vertexAssociator_ = config.getUntrackedParameter<std::string> ( "vertexAssociator" );
24 
25  // Association by max. value
26  bestMatchByMaxValue_ = config.getUntrackedParameter<bool> ( "bestMatchByMaxValue" );
27 
28  // Enable RecoToSim association
29  enableRecoToSim_ = config.getUntrackedParameter<bool> ( "enableRecoToSim" );
30 
31  // Enable SimToReco association
32  enableSimToReco_ = config.getUntrackedParameter<bool> ( "enableSimToReco" );
33 
34  quality_ = 0.;
35 }
36 
37 
39  const edm::Event & event, const edm::EventSetup & setup
40 )
41 {
43  {
44 
45  // Track collection
46  edm::Handle<edm::View<reco::Track> > trackCollection;
47  event.getByLabel(trackProducer_, trackCollection);
48 
49  // Tracking particle information
51  event.getByLabel(trackingTruth_, TPCollection);
52 
53  // Get the track associator
54  edm::ESHandle<TrackAssociatorBase> trackAssociator;
55  setup.get<TrackAssociatorRecord>().get(trackAssociator_, trackAssociator);
56 
57  // Vertex collection
59  event.getByLabel(vertexProducer_, vertexCollection);
60 
61  // Tracking particle information
63  event.getByLabel(trackingTruth_, TVCollection);
64 
65  // Get the track associator
66  edm::ESHandle<VertexAssociatorBase> vertexAssociator;
67  setup.get<VertexAssociatorRecord>().get(vertexAssociator_, vertexAssociator);
68 
69  if ( enableRecoToSim_ )
70  {
71  // Get the map between recovertex -> simvertex
73  trackRecoToSim = trackAssociator->associateRecoToSim(trackCollection, TPCollection, &event,&setup);
74 
75  // Calculate the map between recovertex -> simvertex
76  recoToSim_ = vertexAssociator->associateRecoToSim(vertexCollection, TVCollection, event, trackRecoToSim);
77  }
78 
79  if ( enableSimToReco_ )
80  {
81  // Get the map between recovertex <- simvertex
83  trackSimToReco = trackAssociator->associateSimToReco (trackCollection, TPCollection, &event, &setup);
84 
85  // Calculate the map between recovertex <- simvertex
86  simToReco_ = vertexAssociator->associateSimToReco(vertexCollection, TVCollection, event, trackSimToReco);
87  }
88 
89  }
90 }
91 
92 
94 {
95 
96  if ( !enableRecoToSim_ ) return false;
97 
98  std::pair<TrackingVertexRef, double> result = match(tv, recoToSim_, bestMatchByMaxValue_);
99 
100  TrackingVertexRef tvr( result.first );
101  quality_ = result.second;
102 
103  if ( !tvr.isNull() )
104  {
106 
107  recovertex_ = tv;
108 
109  return true;
110  }
111 
112  return false;
113 }
114 
T getUntrackedParameter(std::string const &, T const &) const
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:94
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
std::string trackAssociator_
Definition: VertexHistory.h:88
bool bestMatchByMaxValue_
Definition: VertexHistory.h:76
edm::InputTag trackProducer_
Definition: VertexHistory.h:82
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:96
tuple vertexCollection
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: VertexHistory.h:40
edm::InputTag trackingTruth_
Definition: VertexHistory.h:86
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:92
tuple result
Definition: query.py:137
bool enableRecoToSim_
Definition: VertexHistory.h:78
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:247
const T & get() const
Definition: EventSetup.h:55
VertexHistory(const edm::ParameterSet &)
Constructor by pset.
Definition: VertexHistory.cc:6
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::string vertexAssociator_
Definition: VertexHistory.h:90
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
bool enableSimToReco_
Definition: VertexHistory.h:78
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
edm::InputTag vertexProducer_
Definition: VertexHistory.h:84