CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

JetTracksAssociatorAtCaloFace Class Reference

#include <JetTracksAssociatorAtCaloFace.h>

Inheritance diagram for JetTracksAssociatorAtCaloFace:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 JetTracksAssociatorAtCaloFace (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
virtual ~JetTracksAssociatorAtCaloFace ()

Private Member Functions

 JetTracksAssociatorAtCaloFace ()

Private Attributes

double dR_
bool firstRun
JetTracksAssociationXtrpCalo mAssociator
edm::InputTag mExtrapolations
edm::InputTag mJets
edm::ESHandle< CaloGeometrypGeo

Detailed Description

Definition at line 20 of file JetTracksAssociatorAtCaloFace.h.


Constructor & Destructor Documentation

JetTracksAssociatorAtCaloFace::JetTracksAssociatorAtCaloFace ( const edm::ParameterSet fConfig)

Definition at line 24 of file JetTracksAssociatorAtCaloFace.cc.

  : mJets (fConfig.getParameter<edm::InputTag> ("jets")),
    mExtrapolations (fConfig.getParameter<edm::InputTag> ("extrapolations")),
    firstRun(true),
    dR_(fConfig.getParameter<double>("coneSize"))
{
  produces<reco::JetTracksAssociation::Container> ();
}
virtual JetTracksAssociatorAtCaloFace::~JetTracksAssociatorAtCaloFace ( ) [inline, virtual]

Definition at line 23 of file JetTracksAssociatorAtCaloFace.h.

{}
JetTracksAssociatorAtCaloFace::JetTracksAssociatorAtCaloFace ( ) [inline, private]

Definition at line 31 of file JetTracksAssociatorAtCaloFace.h.

{}

Member Function Documentation

void JetTracksAssociatorAtCaloFace::beginRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
) [virtual]

Definition at line 76 of file JetTracksAssociatorAtCaloFace.cc.

{
}
void JetTracksAssociatorAtCaloFace::produce ( edm::Event fEvent,
const edm::EventSetup fSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 33 of file JetTracksAssociatorAtCaloFace.cc.

References reco::JetExtendedAssociation::allJets(), dR_, Exception, firstRun, edm::EventSetup::get(), edm::Event::getByLabel(), i, edm::ESHandleBase::isValid(), mAssociator, mExtrapolations, mJets, pGeo, JetTracksAssociationXtrpCalo::produce(), and edm::Event::put().

                                                                                         {


  // Get geometry
  if ( firstRun ) {
    fSetup.get<CaloGeometryRecord>().get(pGeo);
    firstRun = false;
  } 

  if ( !pGeo.isValid() ) {
    throw cms::Exception("InvalidInput") << "Did not get geometry" << std::endl;
  }

  // get stuff from Event
  edm::Handle <edm::View <reco::Jet> > jets_h;
  fEvent.getByLabel (mJets, jets_h);
  edm::Handle <std::vector<reco::TrackExtrapolation> > extrapolations_h;
  fEvent.getByLabel (mExtrapolations, extrapolations_h);

  // Check to make sure we have inputs
  if ( jets_h->size() == 0 ) return;
  // Check to make sure the inputs are calo jets
  reco::CaloJet const * caloJet0 = dynamic_cast<reco::CaloJet const *>( & (jets_h->at(0)) );
  // Disallowed non-CaloJet inputs
  if ( caloJet0 == 0 ) {
    throw cms::Exception("InvalidInput") << " Jet-track association is only defined for CaloJets.";
  }
  
  std::auto_ptr<reco::JetTracksAssociation::Container> jetTracks (new reco::JetTracksAssociation::Container (reco::JetRefBaseProd(jets_h)));


  // format inputs
  std::vector <edm::RefToBase<reco::Jet> > allJets;
  allJets.reserve (jets_h->size());
  for (unsigned i = 0; i < jets_h->size(); ++i) allJets.push_back (jets_h->refAt(i));
  mAssociator.produce (&*jetTracks, allJets, *extrapolations_h, *pGeo, dR_ );


  // store output
  fEvent.put (jetTracks);
}

Member Data Documentation

Definition at line 38 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

Definition at line 37 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

Definition at line 35 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

Definition at line 34 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

Definition at line 33 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().

Definition at line 36 of file JetTracksAssociatorAtCaloFace.h.

Referenced by produce().