CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
JetExtender Class Reference

#include <JetExtender.h>

Inheritance diagram for JetExtender:
edm::stream::EDProducer<>

Public Member Functions

 JetExtender (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~JetExtender () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

edm::InputTag mJet2TracksAtCALO
 
edm::InputTag mJet2TracksAtVX
 
edm::InputTag mJets
 
edm::EDGetTokenT< reco::JetTracksAssociation::Containertoken_mJet2TracksAtCALO
 
edm::EDGetTokenT< reco::JetTracksAssociation::Containertoken_mJet2TracksAtVX
 
edm::EDGetTokenT< edm::View< reco::Jet > > token_mJets
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 19 of file JetExtender.h.

Constructor & Destructor Documentation

◆ JetExtender()

JetExtender::JetExtender ( const edm::ParameterSet fConfig)

Definition at line 15 of file JetExtender.cc.

16  : mJets(fConfig.getParameter<edm::InputTag>("jets")),
17  mJet2TracksAtVX(fConfig.getParameter<edm::InputTag>("jet2TracksAtVX")),
18  mJet2TracksAtCALO(fConfig.getParameter<edm::InputTag>("jet2TracksAtCALO")) {
19  token_mJets = consumes<edm::View<reco::Jet> >(mJets);
20  if (!(mJet2TracksAtVX.label().empty()))
21  token_mJet2TracksAtVX = consumes<reco::JetTracksAssociation::Container>(mJet2TracksAtVX);
22  if (!(mJet2TracksAtCALO.label().empty()))
23  token_mJet2TracksAtCALO = consumes<reco::JetTracksAssociation::Container>(mJet2TracksAtCALO);
24 
25  produces<reco::JetExtendedAssociation::Container>();
26 }

References edm::InputTag::label(), mJet2TracksAtCALO, mJet2TracksAtVX, mJets, token_mJet2TracksAtCALO, token_mJet2TracksAtVX, and token_mJets.

◆ ~JetExtender()

JetExtender::~JetExtender ( )
override

Definition at line 28 of file JetExtender.cc.

28 {}

Member Function Documentation

◆ produce()

void JetExtender::produce ( edm::Event fEvent,
const edm::EventSetup fSetup 
)
override

Definition at line 30 of file JetExtender.cc.

30  {
31  // get stuff from Event
33  fEvent.getByToken(token_mJets, jets_h);
35  if (!(mJet2TracksAtVX.label().empty()))
36  fEvent.getByToken(token_mJet2TracksAtVX, j2tVX_h);
38  if (!(mJet2TracksAtCALO.label().empty()))
39  fEvent.getByToken(token_mJet2TracksAtCALO, j2tCALO_h);
40 
41  auto jetExtender = std::make_unique<reco::JetExtendedAssociation::Container>(reco::JetRefBaseProd(jets_h));
42 
43  // loop over jets (make sure jets in associations are the same as in collection
44 
45  for (unsigned j = 0; j < jets_h->size(); ++j) {
46  edm::RefToBase<reco::Jet> jet = jets_h->refAt(j);
48  if (j2tVX_h.isValid()) { // fill tracks@VX summary
49  try {
52  } catch (cms::Exception const&) {
53  edm::LogError("MismatchedJets") << "Jets in original collection " << mJets
54  << " mismatch jets in j2t VX association " << mJet2TracksAtVX
55  << ". Wrong collections?";
56  throw;
57  }
58  }
59  if (j2tCALO_h.isValid()) { // fill tracks@CALO summary
60  try {
62  extendedData.mTracksAtCaloP4 = reco::JetTracksAssociation::tracksP4(*j2tCALO_h, jet);
63  } catch (cms::Exception const&) {
64  edm::LogError("MismatchedJets") << "Jets in original collection " << mJets
65  << " mismatch jets in j2t CALO association " << mJet2TracksAtCALO
66  << ". Wrong collections?";
67  throw;
68  }
69  }
70  reco::JetExtendedAssociation::setValue(&*jetExtender, jet, extendedData);
71  }
72  fEvent.put(std::move(jetExtender));
73 }

References hcaldqm::fEvent, edm::HandleBase::isValid(), dqmiolumiharvest::j, metsig::jet, edm::InputTag::label(), mJet2TracksAtCALO, mJet2TracksAtVX, mJets, eostools::move(), reco::JetExtendedAssociation::JetExtendedData::mTracksAtCaloNumber, reco::JetExtendedAssociation::JetExtendedData::mTracksAtCaloP4, reco::JetExtendedAssociation::JetExtendedData::mTracksAtVertexNumber, reco::JetExtendedAssociation::JetExtendedData::mTracksAtVertexP4, reco::JetExtendedAssociation::setValue(), token_mJet2TracksAtCALO, token_mJet2TracksAtVX, token_mJets, reco::JetTracksAssociation::tracksNumber(), and reco::JetTracksAssociation::tracksP4().

Member Data Documentation

◆ mJet2TracksAtCALO

edm::InputTag JetExtender::mJet2TracksAtCALO
private

Definition at line 32 of file JetExtender.h.

Referenced by JetExtender(), and produce().

◆ mJet2TracksAtVX

edm::InputTag JetExtender::mJet2TracksAtVX
private

Definition at line 31 of file JetExtender.h.

Referenced by JetExtender(), and produce().

◆ mJets

edm::InputTag JetExtender::mJets
private

Definition at line 30 of file JetExtender.h.

Referenced by JetExtender(), and produce().

◆ token_mJet2TracksAtCALO

edm::EDGetTokenT<reco::JetTracksAssociation::Container> JetExtender::token_mJet2TracksAtCALO
private

Definition at line 29 of file JetExtender.h.

Referenced by JetExtender(), and produce().

◆ token_mJet2TracksAtVX

edm::EDGetTokenT<reco::JetTracksAssociation::Container> JetExtender::token_mJet2TracksAtVX
private

Definition at line 28 of file JetExtender.h.

Referenced by JetExtender(), and produce().

◆ token_mJets

edm::EDGetTokenT<edm::View<reco::Jet> > JetExtender::token_mJets
private

Definition at line 27 of file JetExtender.h.

Referenced by JetExtender(), and produce().

reco::JetExtendedAssociation::setValue
bool setValue(Container &, const reco::JetBaseRef &, const JetExtendedData &)
associate jet with value. Returns false and associate nothing if jet is already associated
Definition: JetExtendedAssociation.cc:44
JetExtender::mJets
edm::InputTag mJets
Definition: JetExtender.h:30
reco::JetTracksAssociation::tracksP4
LorentzVector tracksP4(const Container &, const reco::JetBaseRef)
Get LorentzVector as sum of all tracks associated with jet.
Definition: JetTracksAssociation.cc:14
reco::JetExtendedAssociation::JetExtendedData::mTracksAtCaloP4
LorentzVector mTracksAtCaloP4
Definition: JetExtendedAssociation.h:74
JetExtender::token_mJet2TracksAtVX
edm::EDGetTokenT< reco::JetTracksAssociation::Container > token_mJet2TracksAtVX
Definition: JetExtender.h:28
JetExtender::token_mJet2TracksAtCALO
edm::EDGetTokenT< reco::JetTracksAssociation::Container > token_mJet2TracksAtCALO
Definition: JetExtender.h:29
reco::JetExtendedAssociation::JetExtendedData::mTracksAtCaloNumber
int mTracksAtCaloNumber
Definition: JetExtendedAssociation.h:73
edm::Handle
Definition: AssociativeIterator.h:50
reco::JetExtendedAssociation::JetExtendedData::mTracksAtVertexNumber
int mTracksAtVertexNumber
Definition: JetExtendedAssociation.h:71
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
reco::JetExtendedAssociation::JetExtendedData::mTracksAtVertexP4
LorentzVector mTracksAtVertexP4
Definition: JetExtendedAssociation.h:72
reco::JetExtendedAssociation::JetExtendedData
Definition: JetExtendedAssociation.h:67
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
hcaldqm::fEvent
Definition: DQTask.h:32
JetExtender::token_mJets
edm::EDGetTokenT< edm::View< reco::Jet > > token_mJets
Definition: JetExtender.h:27
eostools.move
def move(src, dest)
Definition: eostools.py:511
JetExtender::mJet2TracksAtCALO
edm::InputTag mJet2TracksAtCALO
Definition: JetExtender.h:32
metsig::jet
Definition: SignAlgoResolutions.h:47
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::RefToBase< reco::Jet >
cms::Exception
Definition: Exception.h:70
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
reco::JetTracksAssociation::tracksNumber
int tracksNumber(const Container &, const reco::JetBaseRef)
Get number of tracks associated with jet.
Definition: JetTracksAssociation.cc:7
edm::InputTag
Definition: InputTag.h:15
JetExtender::mJet2TracksAtVX
edm::InputTag mJet2TracksAtVX
Definition: JetExtender.h:31
edm::RefToBaseProd
Definition: RefToBase.h:65