CMS 3D CMS Logo

TrackClassifierByProxy.h
Go to the documentation of this file.
1 
2 #ifndef TrackClassifierByProxy_h
3 #define TrackClassifierByProxy_h
4 
6 
8 
10 template <typename Collection>
12 {
13 
14 public:
15 
18 
21  proxy_( config.getUntrackedParameter<edm::InputTag>("trackProducer") ) {}
22 
24  virtual void newEvent(edm::Event const & event, edm::EventSetup const & config)
25  {
26  // Get the association part of the proxy to the collection
27  event.getByLabel(proxy_, proxyHandler_);
28  // Call the previous new event
29  TrackClassifier::newEvent(event, config);
30  }
31 
34  {
36  return *this;
37  }
38 
41  {
42  const reco::TrackRefVector * tracks = 0;
43 
44  try
45  {
46  // Get a reference to the vector of associated tracks
47  tracks = proxyHandler_->find(track)->val;
48  }
49  catch (edm::Exception& e)
50  {
51  // If association fails define the track as unknown
52  reset();
53  unknownTrack();
54  return *this;
55  }
56 
57  // Evaluate the history for a given index
58  TrackClassifier::evaluate( tracks->at(index) );
59 
60  return *this;
61  }
62 
65  {
66  const reco::TrackRefVector * tracks = 0;
67 
68  try
69  {
70  // Get a reference to the vector of associated tracks
71  tracks = proxyHandler_->find(track)->val;
72  }
73  catch (edm::Exception& e)
74  {
75  // If association fails define the track as unknown
76  reset();
77  unknownTrack();
78  return *this;
79  }
80 
81  // Loop over all the associated tracks
82  for (std::size_t index = 0; index < tracks->size(); ++index)
83  {
84  // Copy the last status for all the flags
86 
87  // Evaluate the history for a given index
89 
90  // Combine OR the flag information
91  for (std::size_t i = 0; i < flags_.size(); ++i)
92  flags_[i] = flags_[i] | flags[i];
93  }
94 
95  return *this;
96  }
97 
98 private:
99 
101 
103 
104 };
105 
106 #endif
TrackClassifierByProxy< Collection > const & evaluate(edm::Ref< Collection > const &track, std::size_t index)
Classify any Tracks in categories.
Definition: config.py:1
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
TrackClassifierByProxy(edm::ParameterSet const &config)
Constructor by ParameterSet.
void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
Get track history and classify it in function of their .
const Flags & flags() const
Returns flags with the category descriptions.
edm::AssociationMap< edm::OneToMany< Collection, reco::TrackCollection > > Association
Association type.
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:88
HLT enums.
TrackClassifierByProxy< Collection > const & evaluate(TrackingParticleRef const &track)
Classify the TrackingVertex in categories.
size_type size() const
Size of the RefVector.
Definition: RefVector.h:107
std::vector< bool > Flags
Main types associated to the class.
Flags flags_
Flag containers.
void reset()
Reset the categories flags.
edm::Handle< Association > proxyHandler_
Get track history and classification by proxy.
TrackClassifierByProxy< Collection > const & evaluate(edm::Ref< Collection > const &track)
Classify any tracks in categories.
virtual void newEvent(edm::Event const &event, edm::EventSetup const &config)
Pre-process event information (for accessing reconstraction information).
Definition: event.py:1