CMS 3D CMS Logo

VertexClassifierByProxy.h
Go to the documentation of this file.
1 
2 #ifndef VertexClassifierByProxy_h
3 #define VertexClassifierByProxy_h
4 
6 
8 
10 template <typename Collection>
12 {
13 
14 public:
15 
18 
21  edm::ConsumesCollector&& collector) : VertexClassifier(config,std::move(collector)),
22  proxy_( config.getUntrackedParameter<edm::InputTag>("vertexProducer") ) {
23  collector.consumes<Association>(proxy_);
24  }
25 
27  virtual void newEvent(edm::Event const & event, edm::EventSetup const & config)
28  {
29  // Get the association part of the proxy to the collection
30  event.getByLabel(proxy_, proxyHandler_);
31  // Call the previous new event
32  VertexClassifier::newEvent(event, config);
33  }
34 
37  {
39  return *this;
40  }
41 
44  {
45  const reco::VertexRefVector * vertexes = 0;
46 
47  try
48  {
49  // Get a reference to the vector of associated vertexes
50  vertexes = &(proxyHandler_->find(vertex)->val);
51  }
52  catch (edm::Exception& e)
53  {
54  // If association fails define the vertex as unknown
55  reset();
56  unknownVertex();
57  return *this;
58  }
59 
60  // Evaluate the history for a given index
61  VertexClassifier::evaluate( vertexes->at(index) );
62 
63  return *this;
64  }
65 
68  {
69  const reco::VertexRefVector * vertexes = 0;
70 
71  try
72  {
73  // Get a reference to the vector of associated vertexes
74  vertexes = &(proxyHandler_->find(vertex)->val);
75  }
76  catch (edm::Exception& e)
77  {
78  // If association fails define the vertex as unknown
79  reset();
80  unknownVertex();
81  return *this;
82  }
83 
84  // Loop over all the associated vertexes
85  for (std::size_t index = 0; index < vertexes->size(); ++index)
86  {
87  // Copy the last status for all the flags
89 
90  // Evaluate the history for a given index
91  VertexClassifier::evaluate( vertexes->at(index) );
92 
93  // Combine OR the flag information
94  for (std::size_t i = 0; i < flags_.size(); ++i)
95  flags_[i] = flags_[i] | flags[i];
96  }
97 
98  return *this;
99  }
100 
101 private:
102 
104 
106 
107 };
108 
109 #endif
Get track history and classification by proxy.
int i
Definition: DBlmapReader.cc:9
Get track history and classify it in function of their .
void reset()
Reset the categories flags.
Definition: config.py:1
std::vector< bool > Flags
Main types associated to the class.
Flags flags_
Flag containers.
VertexClassifierByProxy< Collection > const & evaluate(edm::Ref< Collection > const &vertex, std::size_t index)
Classify any vertexes in categories.
const Flags & flags() const
Returns flags with the category descriptions.
VertexClassifierByProxy(edm::ParameterSet const &config, edm::ConsumesCollector &&collector)
Constructor by ParameterSet.
edm::Handle< Association > proxyHandler_
VertexClassifierByProxy< Collection > const & evaluate(edm::Ref< Collection > const &vertex)
Classify any vertexes in categories.
VertexClassifierByProxy< Collection > const & evaluate(TrackingVertexRef const &vertex)
Classify the TrackingVertex in categories.
edm::AssociationMap< edm::OneToMany< Collection, reco::VertexCollection > > Association
Association type.
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:88
VertexClassifier const & evaluate(reco::VertexBaseRef const &)
Classify the RecoVertex in categories.
HLT enums.
virtual void newEvent(edm::Event const &event, edm::EventSetup const &config)
Pre-process event information (for accessing reconstraction information).
size_type size() const
Size of the RefVector.
Definition: RefVector.h:107
virtual void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1