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 
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 }
LCToCPAssociation_cfi.associator
associator
Definition: LCToCPAssociation_cfi.py:4
TrackHistory::bestMatchByMaxValue_
bool bestMatchByMaxValue_
Definition: TrackHistory.h:71
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
TrackHistory::newEvent
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
Definition: TrackHistory.cc:33
TrackHistory::recoToSim_
reco::RecoToSimCollection recoToSim_
Definition: TrackHistory.h:87
reco::TrackToTrackingParticleAssociator
Definition: TrackToTrackingParticleAssociator.h:51
TrackHistory::enableRecoToSim_
bool enableRecoToSim_
Definition: TrackHistory.h:73
TrackHistory::trackProducer_
edm::InputTag trackProducer_
Definition: TrackHistory.h:77
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::Ref< TrackingParticleCollection >
config
Definition: config.py:1
TrackHistory.h
edm::View
Definition: CaloClusterFwd.h:14
TrackHistory::trackingParticle_
TrackingParticleRef trackingParticle_
Definition: TrackHistory.h:85
TrackHistory::trackAssociator_
edm::InputTag trackAssociator_
Definition: TrackHistory.h:81
edm::ParameterSet
Definition: ParameterSet.h:47
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
TrackHistory::recotrack_
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:83
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
HistoryBase
Base class to all the history types.
Definition: HistoryBase.h:12
TrackHistory::trackingTruth_
edm::InputTag trackingTruth_
Definition: TrackHistory.h:79
edm::EventSetup
Definition: EventSetup.h:58
TrackHistory::simToReco_
reco::SimToRecoCollection simToReco_
Definition: TrackHistory.h:89
TrackAssociatorRecord.h
TrackHistory::enableSimToReco_
bool enableSimToReco_
Definition: TrackHistory.h:73
TrackHistory::TrackHistory
TrackHistory(const edm::ParameterSet &, edm::ConsumesCollector &&)
Constructor by pset.
Definition: TrackHistory.cc:5
TrackHistory::quality_
double quality_
Definition: TrackHistory.h:75
TrackingParticleCollection
std::vector< TrackingParticle > TrackingParticleCollection
Definition: TrackingParticleFwd.h:9
or
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::RefToBase< reco::Track >
TrackHistory::evaluate
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: TrackHistory.h:37
mps_fire.result
result
Definition: mps_fire.py:311
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
HistoryBase::evaluate
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:96
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45