Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:18

0001 // -*- C++ -*-
0002 //
0003 // Package:    V0Producer
0004 // Class:      V0Producer
0005 //
0006 /**\class V0Producer V0Producer.cc MyProducers/V0Producer/src/V0Producer.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Brian Drell
0015 //         Created:  Fri May 18 22:57:40 CEST 2007
0016 //
0017 //
0018 
0019 #include <memory>
0020 
0021 // user include files
0022 #include "FWCore/Framework/interface/Frameworkfwd.h"
0023 #include "FWCore/Framework/interface/stream/EDProducer.h"
0024 
0025 #include "FWCore/Framework/interface/Event.h"
0026 #include "FWCore/Framework/interface/MakerMacros.h"
0027 
0028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0029 
0030 #include "FWCore/Framework/interface/ESHandle.h"
0031 
0032 #include "DataFormats/VertexReco/interface/Vertex.h"
0033 //#include "DataFormats/V0Candidate/interface/V0Candidate.h"
0034 #include "DataFormats/Candidate/interface/VertexCompositeCandidate.h"
0035 
0036 #include "V0Fitter.h"
0037 
0038 class dso_hidden V0Producer final : public edm::stream::EDProducer<> {
0039 public:
0040   explicit V0Producer(const edm::ParameterSet&);
0041 
0042 private:
0043   void produce(edm::Event&, const edm::EventSetup&) override;
0044 
0045   V0Fitter theVees;
0046 };
0047 
0048 // Constructor
0049 V0Producer::V0Producer(const edm::ParameterSet& iConfig) : theVees(iConfig, consumesCollector()) {
0050   produces<reco::VertexCompositeCandidateCollection>("Kshort");
0051   produces<reco::VertexCompositeCandidateCollection>("Lambda");
0052   //produces< reco::VertexCompositeCandidateCollection >("LambdaBar");
0053 }
0054 
0055 //
0056 // Methods
0057 //
0058 
0059 // Producer Method
0060 void V0Producer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0061   using namespace edm;
0062 
0063   // Create auto_ptr for each collection to be stored in the Event
0064   auto kShortCandidates = std::make_unique<reco::VertexCompositeCandidateCollection>();
0065 
0066   auto lambdaCandidates = std::make_unique<reco::VertexCompositeCandidateCollection>();
0067 
0068   // invoke the fitter which reconstructs the vertices and fills,
0069   //  collections of Kshorts, Lambda0s
0070   theVees.fitAll(iEvent, iSetup, *kShortCandidates, *lambdaCandidates);
0071 
0072   // Write the collections to the Event
0073   kShortCandidates->shrink_to_fit();
0074   iEvent.put(std::move(kShortCandidates), std::string("Kshort"));
0075   lambdaCandidates->shrink_to_fit();
0076   iEvent.put(std::move(lambdaCandidates), std::string("Lambda"));
0077 }
0078 
0079 //define this as a plug-in
0080 #include "FWCore/PluginManager/interface/ModuleDef.h"
0081 
0082 DEFINE_FWK_MODULE(V0Producer);
0083 //DEFINE_FWK_MODULE(V0finder);