#include <JetExtender.h>
Public Member Functions | |
JetExtender (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
virtual | ~JetExtender () |
Private Attributes | |
edm::InputTag | mJet2TracksAtCALO |
edm::InputTag | mJet2TracksAtVX |
edm::InputTag | mJets |
Definition at line 17 of file JetExtender.h.
JetExtender::JetExtender | ( | const edm::ParameterSet & | fConfig | ) |
Definition at line 19 of file JetExtender.cc.
: mJets (fConfig.getParameter<edm::InputTag> ("jets")), mJet2TracksAtVX (fConfig.getParameter<edm::InputTag> ("jet2TracksAtVX")), mJet2TracksAtCALO (fConfig.getParameter<edm::InputTag> ("jet2TracksAtCALO")) { produces<reco::JetExtendedAssociation::Container> (); }
JetExtender::~JetExtender | ( | ) | [virtual] |
Definition at line 27 of file JetExtender.cc.
{}
void JetExtender::produce | ( | edm::Event & | fEvent, |
const edm::EventSetup & | fSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 29 of file JetExtender.cc.
References alignCSCRings::e, edm::Event::getByLabel(), edm::HandleBase::isValid(), j, metsig::jet, edm::InputTag::label(), mJet2TracksAtCALO, mJet2TracksAtVX, mJets, reco::JetExtendedAssociation::JetExtendedData::mTracksAtCaloNumber, reco::JetExtendedAssociation::JetExtendedData::mTracksAtCaloP4, reco::JetExtendedAssociation::JetExtendedData::mTracksAtVertexNumber, reco::JetExtendedAssociation::JetExtendedData::mTracksAtVertexP4, edm::Event::put(), reco::JetExtendedAssociation::setValue(), reco::JetTracksAssociation::tracksNumber(), and reco::JetTracksAssociation::tracksP4().
{ // get stuff from Event edm::Handle <edm::View <reco::Jet> > jets_h; fEvent.getByLabel (mJets, jets_h); edm::Handle <reco::JetTracksAssociation::Container> j2tVX_h; if (!(mJet2TracksAtVX.label().empty())) fEvent.getByLabel (mJet2TracksAtVX, j2tVX_h); edm::Handle <reco::JetTracksAssociation::Container> j2tCALO_h; if (!(mJet2TracksAtCALO.label().empty())) fEvent.getByLabel (mJet2TracksAtCALO, j2tCALO_h); std::auto_ptr<reco::JetExtendedAssociation::Container> jetExtender (new reco::JetExtendedAssociation::Container (reco::JetRefBaseProd(jets_h))); // loop over jets (make sure jets in associations are the same as in collection for (unsigned j = 0; j < jets_h->size(); ++j) { edm::RefToBase<reco::Jet> jet = jets_h->refAt(j); reco::JetExtendedAssociation::JetExtendedData extendedData; if (j2tVX_h.isValid ()) { // fill tracks@VX summary try { extendedData.mTracksAtVertexNumber = reco::JetTracksAssociation::tracksNumber (*j2tVX_h, jet); extendedData.mTracksAtVertexP4 = reco::JetTracksAssociation::tracksP4 (*j2tVX_h, jet); } catch (cms::Exception e) { edm::LogError ("MismatchedJets") << "Jets in original collection " << mJets << " mismatch jets in j2t VX association " << mJet2TracksAtVX << ". Wrong collections?"; throw e; } } if (j2tCALO_h.isValid ()) { // fill tracks@CALO summary try { extendedData.mTracksAtCaloNumber = reco::JetTracksAssociation::tracksNumber (*j2tCALO_h, jet); extendedData.mTracksAtCaloP4 = reco::JetTracksAssociation::tracksP4 (*j2tCALO_h, jet); } catch (cms::Exception e) { edm::LogError ("MismatchedJets") << "Jets in original collection " << mJets << " mismatch jets in j2t CALO association " << mJet2TracksAtCALO << ". Wrong collections?"; throw e; } } reco::JetExtendedAssociation::setValue (&*jetExtender, jet, extendedData); } fEvent.put (jetExtender); }
edm::InputTag JetExtender::mJet2TracksAtCALO [private] |
Definition at line 27 of file JetExtender.h.
Referenced by produce().
edm::InputTag JetExtender::mJet2TracksAtVX [private] |
Definition at line 26 of file JetExtender.h.
Referenced by produce().
edm::InputTag JetExtender::mJets [private] |
Definition at line 25 of file JetExtender.h.
Referenced by produce().