CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PATVertexSlimmer.cc
Go to the documentation of this file.
1 #include <string>
2 #include <memory>
3 
4 // user include files
8 
12 
13 namespace pat {
15  public:
16  explicit PATVertexSlimmer(const edm::ParameterSet&);
18 
19  virtual void produce(edm::Event&, const edm::EventSetup&);
20  private:
22  };
23 }
24 
26  src_(consumes<std::vector<reco::Vertex> >(iConfig.getParameter<edm::InputTag>("src")))
27 {
28  produces<std::vector<reco::Vertex> >();
29 }
30 
32 
35  iEvent.getByToken(src_, vertices);
36  std::auto_ptr<std::vector<reco::Vertex> > outPtr(new std::vector<reco::Vertex>());
37 
38  outPtr->reserve(vertices->size());
39  for (unsigned int i = 0, n = vertices->size(); i < n; ++i) {
40  const reco::Vertex &v = (*vertices)[i];
41  outPtr->push_back(reco::Vertex(v.position(), v.error(), v.chi2(), v.ndof(), 0));
42  }
43 
44  iEvent.put(outPtr);
45 }
46 
int i
Definition: DBlmapReader.cc:9
PATVertexSlimmer(const edm::ParameterSet &)
virtual void produce(edm::Event &, const edm::EventSetup &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
const Point & position() const
position
Definition: Vertex.h:106
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
double chi2() const
chi-squares
Definition: Vertex.h:95
double ndof() const
Definition: Vertex.h:102
Error error() const
return SMatrix
Definition: Vertex.h:129
edm::EDGetTokenT< std::vector< reco::Vertex > > src_