CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/SimTracker/TrackHistory/plugins/JetVetoedTracksAssociatorAtVertex.cc

Go to the documentation of this file.
00001 // \class JetVetoedTracksAssociatorAtVertex JetTracksAssociatorAtVertex.cc
00002 //
00003 // Original Author:  Andrea Rizzi
00004 //         Created:  Wed Apr 12 11:12:49 CEST 2006
00005 // Accommodated for Jet Package by: Fedor Ratnikov Jul. 30, 2007
00006 // $Id: JetVetoedTracksAssociatorAtVertex.cc,v 1.4 2010/02/20 21:02:06 wmtan Exp $
00007 //
00008 //
00009 
00010 #include "DataFormats/Common/interface/EDProductfwd.h"
00011 #include "DataFormats/Common/interface/View.h"
00012 #include "DataFormats/JetReco/interface/Jet.h"
00013 #include "DataFormats/TrackReco/interface/Track.h"
00014 #include "DataFormats/JetReco/interface/JetTracksAssociation.h"
00015 
00016 #include "FWCore/Framework/interface/Event.h"
00017 #include "FWCore/Framework/interface/EDProducer.h"
00018 #include "FWCore/Framework/interface/MakerMacros.h"
00019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00020 #include "FWCore/Utilities/interface/InputTag.h"
00021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00022 
00023 #include "SimTracker/TrackHistory/interface/JetVetoedTracksAssociatorDRVertex.h"
00024 
00025 class JetVetoedTracksAssociatorAtVertex : public edm::EDProducer
00026 {
00027 public:
00028     JetVetoedTracksAssociatorAtVertex(const edm::ParameterSet&);
00029     virtual ~JetVetoedTracksAssociatorAtVertex();
00030     virtual void produce(edm::Event&, const edm::EventSetup&);
00031 private:
00032     edm::InputTag mJets;
00033     edm::InputTag mTracks;
00034     JetVetoedTracksAssociationDRVertex mAssociator;
00035     TrackClassifier classifier;
00036 };
00037 
00038 JetVetoedTracksAssociatorAtVertex::JetVetoedTracksAssociatorAtVertex(const edm::ParameterSet& fConfig)
00039         : mJets (fConfig.getParameter<edm::InputTag> ("jets")),
00040         mTracks (fConfig.getParameter<edm::InputTag> ("tracks")),
00041         mAssociator (fConfig.getParameter<double> ("coneSize")),
00042         classifier(fConfig)
00043 {
00044     produces<reco::JetTracksAssociation::Container> ();
00045 }
00046 
00047 JetVetoedTracksAssociatorAtVertex::~JetVetoedTracksAssociatorAtVertex() {}
00048 
00049 void JetVetoedTracksAssociatorAtVertex::produce(edm::Event& fEvent, const edm::EventSetup& fSetup)
00050 {
00051     // Gather contextual information for TrackCategories
00052     classifier.newEvent(fEvent, fSetup);
00053 
00054     edm::Handle <edm::View <reco::Jet> > jets_h;
00055     fEvent.getByLabel (mJets, jets_h);
00056     edm::Handle <reco::TrackCollection> tracks_h;
00057     fEvent.getByLabel (mTracks, tracks_h);
00058 
00059     std::auto_ptr<reco::JetTracksAssociation::Container> jetTracks (new reco::JetTracksAssociation::Container (reco::JetRefBaseProd(jets_h)));
00060 
00061     // format inputs
00062     std::vector <edm::RefToBase<reco::Jet> > allJets;
00063     allJets.reserve (jets_h->size());
00064     for (unsigned i = 0; i < jets_h->size(); ++i) allJets.push_back (jets_h->refAt(i));
00065     std::vector <reco::TrackRef> allTracks;
00066     allTracks.reserve (tracks_h->size());
00067     for (unsigned i = 0; i < tracks_h->size(); ++i) allTracks.push_back (reco::TrackRef (tracks_h, i));
00068     // run algo
00069     mAssociator.produce (&*jetTracks, allJets, allTracks, classifier);
00070     // store output
00071     fEvent.put (jetTracks);
00072 }
00073 
00074 DEFINE_FWK_MODULE(JetVetoedTracksAssociatorAtVertex);
00075