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 ) : HistoryBase()
9 {
10  // Name of the track collection
11  trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" );
12 
13  // Name of the traking pariticle collection
14  trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" );
15 
16  // Track association record
17  trackAssociator_ = config.getUntrackedParameter<std::string> ( "trackAssociator" );
18 
19  // Association by max. value
20  bestMatchByMaxValue_ = config.getUntrackedParameter<bool> ( "bestMatchByMaxValue" );
21 
22  // Enable RecoToSim association
23  enableRecoToSim_ = config.getUntrackedParameter<bool> ( "enableRecoToSim" );
24 
25  // Enable SimToReco association
26  enableSimToReco_ = config.getUntrackedParameter<bool> ( "enableSimToReco" );
27 
28  quality_ = 0.;
29 }
30 
31 
33  const edm::Event & event, const edm::EventSetup & setup
34 )
35 {
37  {
38  // Track collection
39  edm::Handle<edm::View<reco::Track> > trackCollection;
40  event.getByLabel(trackProducer_, trackCollection);
41 
42  // Tracking particle information
44  event.getByLabel(trackingTruth_, TPCollection);
45 
46  // Get the track associator
48  setup.get<TrackAssociatorRecord>().get(trackAssociator_, associator);
49 
50  // Calculate the map between recotracks -> tp
51  if ( enableRecoToSim_ ) recoToSim_ = associator->associateRecoToSim(trackCollection, TPCollection, &event, &setup);
52 
53  // Calculate the map between recotracks <- tp
54  if ( enableSimToReco_ ) simToReco_ = associator->associateSimToReco(trackCollection, TPCollection, &event, &setup);
55  }
56 }
57 
58 
60 {
61  if ( !enableRecoToSim_ ) return false;
62 
63  std::pair<TrackingParticleRef, double> result = match(tr, recoToSim_, bestMatchByMaxValue_);
64 
65  TrackingParticleRef tpr( result.first );
66  quality_ = result.second;
67 
68  if ( !tpr.isNull() )
69  {
71 
72  recotrack_ = tr;
73 
74  return true;
75  }
76 
77  return false;
78 }
79 
80 
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
TrackHistory(const edm::ParameterSet &)
Constructor by pset.
Definition: TrackHistory.cc:6
bool enableSimToReco_
Definition: TrackHistory.h:76
reco::SimToRecoCollection simToReco_
Definition: TrackHistory.h:90
bool isNull() const
Checks for null.
Definition: Ref.h:246
tuple result
Definition: query.py:137
edm::InputTag trackProducer_
Definition: TrackHistory.h:80
reco::RecoToSimCollection recoToSim_
Definition: TrackHistory.h:88
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 enableRecoToSim_
Definition: TrackHistory.h:76
const T & get() const
Definition: EventSetup.h:55
double quality_
Definition: TrackHistory.h:78
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:39
bool bestMatchByMaxValue_
Definition: TrackHistory.h:74
edm::InputTag trackingTruth_
Definition: TrackHistory.h:82
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
std::string trackAssociator_
Definition: TrackHistory.h:84
reco::TrackBaseRef recotrack_
Definition: TrackHistory.h:86