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  trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" );
13 
14  // Name of the track collection
15  vertexProducer_ = config.getUntrackedParameter<edm::InputTag> ( "vertexProducer" );
16 
17  // Name of the traking pariticle collection
18  trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" );
19 
20  // Track association record
21  trackAssociator_ = config.getUntrackedParameter<edm::InputTag> ( "trackAssociator" );
22 
23  // Track association record
24  vertexAssociator_ = config.getUntrackedParameter<std::string> ( "vertexAssociator" );
25 
26  // Association by max. value
27  bestMatchByMaxValue_ = config.getUntrackedParameter<bool> ( "bestMatchByMaxValue" );
28 
29  // Enable RecoToSim association
30  enableRecoToSim_ = config.getUntrackedParameter<bool> ( "enableRecoToSim" );
31 
32  // Enable SimToReco association
33  enableSimToReco_ = config.getUntrackedParameter<bool> ( "enableSimToReco" );
34 
35  if(enableRecoToSim_ or enableSimToReco_) {
36  collector.consumes<edm::View<reco::Track>>(trackProducer_);
37  collector.consumes<edm::View<reco::Vertex>>(vertexProducer_);
38  collector.consumes<TrackingParticleCollection>(trackingTruth_);
39  collector.consumes<TrackingVertexCollection>(trackingTruth_);
41  }
42 
43  quality_ = 0.;
44 }
45 
46 
48  const edm::Event & event, const edm::EventSetup & setup
49 )
50 {
52  {
53 
54  // Track collection
56  event.getByLabel(trackProducer_, trackCollection);
57 
58  // Tracking particle information
60  event.getByLabel(trackingTruth_, TPCollection);
61 
62  // Get the track associator
64  event.getByLabel(trackAssociator_, trackAssociator);
65 
66  // Vertex collection
68  event.getByLabel(vertexProducer_, vertexCollection);
69 
70  // Tracking particle information
72  event.getByLabel(trackingTruth_, TVCollection);
73 
74  // Get the track associator
75  edm::ESHandle<VertexAssociatorBase> vertexAssociator;
76  setup.get<VertexAssociatorRecord>().get(vertexAssociator_, vertexAssociator);
77 
78  if ( enableRecoToSim_ )
79  {
80  // Get the map between recovertex -> simvertex
82  trackRecoToSim = trackAssociator->associateRecoToSim(trackCollection, TPCollection);
83 
84  // Calculate the map between recovertex -> simvertex
85  recoToSim_ = vertexAssociator->associateRecoToSim(vertexCollection, TVCollection, event, trackRecoToSim);
86  }
87 
88  if ( enableSimToReco_ )
89  {
90  // Get the map between recovertex <- simvertex
92  trackSimToReco = trackAssociator->associateSimToReco (trackCollection, TPCollection);
93 
94  // Calculate the map between recovertex <- simvertex
95  simToReco_ = vertexAssociator->associateSimToReco(vertexCollection, TVCollection, event, trackSimToReco);
96  }
97 
98  }
99 }
100 
101 
103 {
104 
105  if ( !enableRecoToSim_ ) return false;
106 
107  std::pair<TrackingVertexRef, double> result = match(tv, recoToSim_, bestMatchByMaxValue_);
108 
109  TrackingVertexRef tvr( result.first );
110  quality_ = result.second;
111 
112  if ( !tvr.isNull() )
113  {
115 
116  recovertex_ = tv;
117 
118  return true;
119  }
120 
121  return false;
122 }
123 
T getUntrackedParameter(std::string const &, T const &) const
reco::VertexRecoToSimCollection recoToSim_
Definition: VertexHistory.h:96
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
bool bestMatchByMaxValue_
Definition: VertexHistory.h:78
std::vector< TrackingParticle > TrackingParticleCollection
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
edm::InputTag trackProducer_
Definition: VertexHistory.h:84
reco::VertexSimToRecoCollection simToReco_
Definition: VertexHistory.h:98
tuple vertexCollection
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: VertexHistory.h:42
edm::InputTag trackAssociator_
Definition: VertexHistory.h:90
edm::InputTag trackingTruth_
Definition: VertexHistory.h:88
reco::VertexBaseRef recovertex_
Definition: VertexHistory.h:94
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:247
std::vector< TrackingVertex > TrackingVertexCollection
const T & get() const
Definition: EventSetup.h:55
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:92
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:86