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 
75  if ( !tpr.isNull() )
76  {
78 
79  recotrack_ = tr;
80 
81  return true;
82  }
83 
84  return false;
85 }
86 
87 
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:78
reco::SimToRecoCollection simToReco_
Definition: TrackHistory.h:92
tuple result
Definition: query.py:137
edm::InputTag trackProducer_
Definition: TrackHistory.h:82
reco::RecoToSimCollection recoToSim_
Definition: TrackHistory.h:90
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
bool enableRecoToSim_
Definition: TrackHistory.h:78
edm::InputTag trackAssociator_
Definition: TrackHistory.h:86
TrackHistory(const edm::ParameterSet &, edm::ConsumesCollector &&)
Constructor by pset.
Definition: TrackHistory.cc:6
double quality_
Definition: TrackHistory.h:80
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
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: TrackHistory.h:41
bool bestMatchByMaxValue_
Definition: TrackHistory.h:76
edm::InputTag trackingTruth_
Definition: TrackHistory.h:84
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:88