CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EmbeddingHltPixelVerticesProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: tautrigger/EmbeddingHltPixelVerticesProducer
4 // Class: EmbeddingHltPixelVerticesProducer
5 //
13 //
14 // Original Author: Sebastian Brommer
15 // Created: Thu, 02 Aug 2018 12:05:59 GMT
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
28 
31 
36 
40 
42 
44 public:
47 
48  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
49 
50 private:
51  void beginStream(edm::StreamID) override;
52  void produce(edm::Event &, const edm::EventSetup &) override;
53  void endStream() override;
55 
56  // ----------member data ---------------------------
57 };
58 
60  vertexPositionLabel = edm::InputTag("externalLHEProducer", "vertexPosition");
61  consumes<math::XYZTLorentzVectorD>(vertexPositionLabel);
62  produces<reco::VertexCollection>();
63 }
64 
66 
67 // ------------ method called to produce the data ------------
69  using namespace edm;
70  std::unique_ptr<reco::VertexCollection> embeddingVertex(new reco::VertexCollection);
71  Handle<math::XYZTLorentzVectorD> vertex_position;
72  iEvent.getByLabel(vertexPositionLabel, vertex_position);
73  math::XYZPoint genVertex =
74  math::XYZPoint(vertex_position.product()->x(), vertex_position.product()->y(), vertex_position.product()->z());
76  // Try to produce an nonfake Vertex
77  // Need at least 5 ndof so the vertex Quality is considered good
78  reco::Vertex saveVertex = reco::Vertex(genVertex, Error, 1.0, 6.0, 6);
79  embeddingVertex->push_back(saveVertex);
80  iEvent.put(std::move(embeddingVertex));
81 }
82 
83 // ------------ method called once each stream before processing any runs, lumis or events ------------
85 
86 // ------------ method called once each stream after processing all runs, lumis and events ------------
88 
90  // The following says we do not know what parameters are allowed so do no validation
91  // Please change this to state exactly what you do use, even if it is no parameters
93  desc.setUnknown();
94  descriptions.addDefault(desc);
95 }
96 
97 // define this as a plug-in
edm::ErrorSummaryEntry Error
T const * product() const
Definition: Handle.h:70
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
ErrorD< N >::type type
Definition: Error.h:32
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::Event &, const edm::EventSetup &) override
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
EmbeddingHltPixelVerticesProducer(const edm::ParameterSet &)
HLT enums.
def move(src, dest)
Definition: eostools.py:511