CMS 3D CMS Logo

TrackHistory.cc
Go to the documentation of this file.
1 
4 
6  // Name of the track collection
7  trackProducer_ = config.getUntrackedParameter<edm::InputTag>("trackProducer");
8  collector.consumes<edm::View<reco::Track>>(trackProducer_);
9 
10  // Name of the traking pariticle collection
11  trackingTruth_ = config.getUntrackedParameter<edm::InputTag>("trackingTruth");
12  collector.consumes<TrackingParticleCollection>(trackingTruth_);
13 
14  // Track association record
15  trackAssociator_ = config.getUntrackedParameter<edm::InputTag>("trackAssociator");
16 
17  // Association by max. value
18  bestMatchByMaxValue_ = config.getUntrackedParameter<bool>("bestMatchByMaxValue");
19 
20  // Enable RecoToSim association
21  enableRecoToSim_ = config.getUntrackedParameter<bool>("enableRecoToSim");
22 
23  // Enable SimToReco association
24  enableSimToReco_ = config.getUntrackedParameter<bool>("enableSimToReco");
25 
26  if (enableRecoToSim_ or enableSimToReco_) {
28  }
29 
30  quality_ = 0.;
31 }
32 
35  // Track collection
37  event.getByLabel(trackProducer_, trackCollection);
38 
39  // Tracking particle information
41  event.getByLabel(trackingTruth_, TPCollection);
42 
43  // Get the track associator
45  event.getByLabel(trackAssociator_, associator);
46 
47  // Calculate the map between recotracks -> tp
48  if (enableRecoToSim_)
49  recoToSim_ = associator->associateRecoToSim(trackCollection, TPCollection);
50 
51  // Calculate the map between recotracks <- tp
52  if (enableSimToReco_)
53  simToReco_ = associator->associateSimToReco(trackCollection, TPCollection);
54  }
55 }
56 
58  if (!enableRecoToSim_)
59  return false;
60 
61  std::pair<TrackingParticleRef, double> result = match(tr, recoToSim_, bestMatchByMaxValue_);
62 
63  TrackingParticleRef tpr(result.first);
64  quality_ = result.second;
65  trackingParticle_ = tpr;
66 
67  if (!tpr.isNull()) {
69 
70  recotrack_ = tr;
71 
72  return true;
73  }
74 
75  return false;
76 }
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
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:33
std::vector< TrackingParticle > TrackingParticleCollection
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
Definition: config.py:1
bool enableSimToReco_
Definition: TrackHistory.h:73
reco::SimToRecoCollection simToReco_
Definition: TrackHistory.h:89
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
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:248
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track >> &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
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:5
double quality_
Definition: TrackHistory.h:75
Base class to all the history types.
Definition: HistoryBase.h:12
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
Definition: event.py:1
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:83