CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TrackHistory.cc
Go to the documentation of this file.
1 
3 
5  // Name of the track collection
6  trackProducer_ = config.getUntrackedParameter<edm::InputTag>("trackProducer");
7  collector.consumes<edm::View<reco::Track>>(trackProducer_);
8 
9  // Name of the traking pariticle collection
10  trackingTruth_ = config.getUntrackedParameter<edm::InputTag>("trackingTruth");
11  collector.consumes<TrackingParticleCollection>(trackingTruth_);
12 
13  // Track association record
14  trackAssociator_ = config.getUntrackedParameter<edm::InputTag>("trackAssociator");
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_) {
27  }
28 
29  quality_ = 0.;
30 }
31 
34  // Track collection
36  event.getByLabel(trackProducer_, trackCollection);
37 
38  // Tracking particle information
40  event.getByLabel(trackingTruth_, TPCollection);
41 
42  // Get the track associator
44  event.getByLabel(trackAssociator_, associator);
45 
46  // Calculate the map between recotracks -> tp
47  if (enableRecoToSim_)
48  recoToSim_ = associator->associateRecoToSim(trackCollection, TPCollection);
49 
50  // Calculate the map between recotracks <- tp
51  if (enableSimToReco_)
52  simToReco_ = associator->associateSimToReco(trackCollection, TPCollection);
53  }
54 }
55 
57  if (!enableRecoToSim_)
58  return false;
59 
60  std::pair<TrackingParticleRef, double> result = match(tr, recoToSim_, bestMatchByMaxValue_);
61 
62  TrackingParticleRef tpr(result.first);
63  quality_ = result.second;
64  trackingParticle_ = tpr;
65 
66  if (!tpr.isNull()) {
68 
69  recotrack_ = tr;
70 
71  return true;
72  }
73 
74  return false;
75 }
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:32
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:73
reco::SimToRecoCollection simToReco_
Definition: TrackHistory.h:89
tuple result
Definition: mps_fire.py:311
edm::InputTag trackProducer_
Definition: TrackHistory.h:77
reco::RecoToSimCollection recoToSim_
Definition: TrackHistory.h:87
TrackingParticleRef trackingParticle_
Definition: TrackHistory.h:85
bool isNull() const
Checks for null.
Definition: Ref.h:235
bool enableRecoToSim_
Definition: TrackHistory.h:73
edm::InputTag trackAssociator_
Definition: TrackHistory.h:81
TrackHistory(const edm::ParameterSet &, edm::ConsumesCollector &&)
Constructor by pset.
Definition: TrackHistory.cc:4
tuple trackCollection
double quality_
Definition: TrackHistory.h:75
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
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: TrackHistory.h:37
bool bestMatchByMaxValue_
Definition: TrackHistory.h:71
edm::InputTag trackingTruth_
Definition: TrackHistory.h:79
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::vector< TrackingParticle > TrackingParticleCollection
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:83