CMS 3D CMS Logo

HLTScoutingPrimaryVertexProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTrigger/JetMET
4 // Class: HLTScoutingPrimaryVertexProducer
5 
6 // system include files
7 #include <memory>
8 
9 // user include files
19 
21 public:
24 
25  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
26 
27 private:
28  void produce(edm::StreamID sid, edm::Event & iEvent, edm::EventSetup const & setup) const final;
30 };
31 
32 //
33 // constructors and destructor
34 //
36  vertexCollection_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection")))
37 {
38  //register products
39  produces<ScoutingVertexCollection>("primaryVtx");
40 
41 }
42 
44 
45 // ------------ method called to produce the data ------------
46 void
48 {
49  using namespace edm;
50 
51  //get vertices
53 
54  std::unique_ptr<ScoutingVertexCollection> outVertices(new ScoutingVertexCollection());
55 
56  if(iEvent.getByToken(vertexCollection_, vertexCollection)){
57  for(auto &vtx : *vertexCollection){
58  outVertices->emplace_back(
59  vtx.x(), vtx.y(), vtx.z(), vtx.zError(), vtx.xError(), vtx.yError(), vtx.tracksSize(), vtx.chi2(), vtx.ndof(), vtx.isValid()
60  );
61  }
62  }
63 
64  //put output
65  iEvent.put(std::move(outVertices), "primaryVtx");
66 }
67 
68 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
69 void
72  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
73  descriptions.add("hltScoutingPrimaryVertexProducer", desc);
74 
75 }
76 
77 //define this as a plug-in
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:230
std::vector< ScoutingVertex > ScoutingVertexCollection
const edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
fixed size matrix
HLT enums.
HLTScoutingPrimaryVertexProducer(const edm::ParameterSet &)
void produce(edm::StreamID sid, edm::Event &iEvent, edm::EventSetup const &setup) const final
def move(src, dest)
Definition: eostools.py:510