CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/RecoVertex/V0Producer/src/V0Producer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    V0Producer
00004 // Class:      V0Producer
00005 // 
00013 //
00014 // Original Author:  Brian Drell
00015 //         Created:  Fri May 18 22:57:40 CEST 2007
00016 // $Id: V0Producer.cc,v 1.12 2010/02/20 21:02:02 wmtan Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 
00024 #include "RecoVertex/V0Producer/interface/V0Producer.h"
00025 
00026 // Constructor
00027 V0Producer::V0Producer(const edm::ParameterSet& iConfig) :
00028   theParams(iConfig) {
00029 
00030    // Registering V0 Collections
00031   //produces<reco::VertexCollection>("Kshort");
00032   //produces<reco::VertexCollection>("Lambda");
00033   //produces<reco::VertexCollection>("LambdaBar");
00034 
00035   // Trying this with Candidates instead of the simple reco::Vertex
00036   produces< reco::VertexCompositeCandidateCollection >("Kshort");
00037   produces< reco::VertexCompositeCandidateCollection >("Lambda");
00038   //produces< reco::VertexCompositeCandidateCollection >("LambdaBar");
00039 
00040 }
00041 
00042 // (Empty) Destructor
00043 V0Producer::~V0Producer() {
00044 
00045 }
00046 
00047 
00048 //
00049 // Methods
00050 //
00051 
00052 // Producer Method
00053 void V0Producer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
00054    using namespace edm;
00055 
00056    // Create V0Fitter object which reconstructs the vertices and creates
00057    //  (and contains) collections of Kshorts, Lambda0s
00058    V0Fitter theVees(theParams, iEvent, iSetup);
00059 
00060    // Create auto_ptr for each collection to be stored in the Event
00061    std::auto_ptr< reco::VertexCompositeCandidateCollection > 
00062      kShortCandidates( new reco::VertexCompositeCandidateCollection );
00063    kShortCandidates->reserve( theVees.getKshorts().size() ); 
00064 
00065    std::auto_ptr< reco::VertexCompositeCandidateCollection >
00066      lambdaCandidates( new reco::VertexCompositeCandidateCollection );
00067    lambdaCandidates->reserve( theVees.getLambdas().size() );
00068 
00069    std::copy( theVees.getKshorts().begin(),
00070               theVees.getKshorts().end(),
00071               std::back_inserter(*kShortCandidates) );
00072    std::copy( theVees.getLambdas().begin(),
00073               theVees.getLambdas().end(),
00074               std::back_inserter(*lambdaCandidates) );
00075 
00076    // Write the collections to the Event
00077    iEvent.put( kShortCandidates, std::string("Kshort") );
00078    iEvent.put( lambdaCandidates, std::string("Lambda") );
00079 
00080 }
00081 
00082 
00083 //void V0Producer::beginJob() {
00084 void V0Producer::beginJob() {
00085 }
00086 
00087 
00088 void V0Producer::endJob() {
00089 }
00090 
00091 //define this as a plug-in
00092 #include "FWCore/PluginManager/interface/ModuleDef.h"
00093 
00094 DEFINE_FWK_MODULE(V0Producer);
00095 //DEFINE_FWK_MODULE(V0finder);