CMS 3D CMS Logo

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.6 2008/04/28 23:32:42 drell 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, and Lambda0Bars
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::VertexCollection> k0sOut(new
00062                reco::VertexCollection( theVees.getKshortCollection() ));
00063    std::auto_ptr<reco::VertexCollection> L0Out(new
00064                reco::VertexCollection( theVees.getLambdaCollection() ));
00065    std::auto_ptr<reco::VertexCollection> L0BarOut(new
00066    reco::VertexCollection( theVees.getLambdaBarCollection() ));*/
00067 
00068    std::auto_ptr< reco::VertexCompositeCandidateCollection > 
00069      kShortCandidates( new reco::VertexCompositeCandidateCollection );
00070    kShortCandidates->reserve( theVees.getKshorts().size() ); 
00071                                                                     //                 theVees.getKshorts()) );
00072    std::auto_ptr< reco::VertexCompositeCandidateCollection >
00073    lambdaCandidates( new reco::VertexCompositeCandidateCollection );
00074    lambdaCandidates->reserve( theVees.getLambdas().size() );
00075                                                                     //                 theVees.getLambdas()) );
00076    std::auto_ptr< reco::VertexCompositeCandidateCollection >
00077    lambdaBarCandidates( new reco::VertexCompositeCandidateCollection );
00078    lambdaBarCandidates->reserve( theVees.getLambdaBars().size() );
00079                                                                        //                           theVees.getLambdaBars()) );
00080    std::copy( theVees.getKshorts().begin(),
00081               theVees.getKshorts().end(),
00082               std::back_inserter(*kShortCandidates) );
00083    std::copy( theVees.getLambdas().begin(),
00084               theVees.getLambdas().end(),
00085               std::back_inserter(*lambdaCandidates) );
00086    std::copy( theVees.getLambdaBars().begin(),
00087               theVees.getLambdaBars().end(),
00088               std::back_inserter(*lambdaBarCandidates) );
00089 
00090    // Write the collections to the Event
00091    //iEvent.put( k0sOut, std::string("Kshort") );
00092    //iEvent.put( L0Out, std::string("Lambda") );
00093    //iEvent.put( L0BarOut, std::string("LambdaBar") );
00094 
00095    iEvent.put( kShortCandidates, std::string("Kshort") );
00096    iEvent.put( lambdaCandidates, std::string("Lambda") );
00097    iEvent.put( lambdaBarCandidates, std::string("LambdaBar") );
00098 
00099 }
00100 
00101 
00102 void V0Producer::beginJob(const edm::EventSetup&) {
00103 }
00104 
00105 
00106 void V0Producer::endJob() {
00107 }
00108 
00109 //define this as a plug-in
00110 #include "FWCore/PluginManager/interface/ModuleDef.h"
00111 DEFINE_SEAL_MODULE();
00112 DEFINE_ANOTHER_FWK_MODULE(V0Producer);
00113 //DEFINE_FWK_MODULE(V0finder);

Generated on Tue Jun 9 17:46:12 2009 for CMSSW by  doxygen 1.5.4