CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackHistory.cc
Go to the documentation of this file.
1 
4 
5 
8  edm::ConsumesCollector&& collector
9 ) : HistoryBase()
10 {
11  // Name of the track collection
12  trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" );
13  collector.consumes<edm::View<reco::Track> >(trackProducer_);
14 
15  // Name of the traking pariticle collection
16  trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" );
17  collector.consumes<TrackingParticleCollection>(trackingTruth_);
18 
19  // Track association record
20  trackAssociator_ = config.getUntrackedParameter<edm::InputTag> ( "trackAssociator" );
21 
22  // Association by max. value
23  bestMatchByMaxValue_ = config.getUntrackedParameter<bool> ( "bestMatchByMaxValue" );
24 
25  // Enable RecoToSim association
26  enableRecoToSim_ = config.getUntrackedParameter<bool> ( "enableRecoToSim" );
27 
28  // Enable SimToReco association
29  enableSimToReco_ = config.getUntrackedParameter<bool> ( "enableSimToReco" );
30 
31  if(enableRecoToSim_ or enableSimToReco_) {
33  }
34 
35  quality_ = 0.;
36 }
37 
38 
40  const edm::Event & event, const edm::EventSetup & setup
41 )
42 {
44  {
45  // Track collection
47  event.getByLabel(trackProducer_, trackCollection);
48 
49  // Tracking particle information
51  event.getByLabel(trackingTruth_, TPCollection);
52 
53  // Get the track associator
55  event.getByLabel(trackAssociator_, associator);
56 
57  // Calculate the map between recotracks -> tp
58  if ( enableRecoToSim_ ) recoToSim_ = associator->associateRecoToSim(trackCollection, TPCollection);
59 
60  // Calculate the map between recotracks <- tp
61  if ( enableSimToReco_ ) simToReco_ = associator->associateSimToReco(trackCollection, TPCollection );
62  }
63 }
64 
65 
67 {
68  if ( !enableRecoToSim_ ) return false;
69 
70  std::pair<TrackingParticleRef, double> result = match(tr, recoToSim_, bestMatchByMaxValue_);
71 
72  TrackingParticleRef tpr( result.first );
73  quality_ = result.second;
74  trackingParticle_ = tpr;
75 
76  if ( !tpr.isNull() )
77  {
79 
80  recotrack_ = tr;
81 
82  return true;
83  }
84 
85  return false;
86 }
87 
88 
T getUntrackedParameter(std::string const &, T const &) const
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
Definition: TrackHistory.cc:39
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
bool enableSimToReco_
Definition: TrackHistory.h:88
reco::SimToRecoCollection simToReco_
Definition: TrackHistory.h:104
tuple result
Definition: mps_fire.py:84
edm::InputTag trackProducer_
Definition: TrackHistory.h:92
reco::RecoToSimCollection recoToSim_
Definition: TrackHistory.h:102
TrackingParticleRef trackingParticle_
Definition: TrackHistory.h:100
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
bool enableRecoToSim_
Definition: TrackHistory.h:88
edm::InputTag trackAssociator_
Definition: TrackHistory.h:96
TrackHistory(const edm::ParameterSet &, edm::ConsumesCollector &&)
Constructor by pset.
Definition: TrackHistory.cc:6
double quality_
Definition: TrackHistory.h:90
Base class to all the history types.
Definition: HistoryBase.h:12
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:135
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: TrackHistory.h:41
bool bestMatchByMaxValue_
Definition: TrackHistory.h:86
edm::InputTag trackingTruth_
Definition: TrackHistory.h:94
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:98