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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetExtender (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~JetExtender ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 19 of file JetExtender.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file JetExtender.cc.

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

16  : mJets (fConfig.getParameter<edm::InputTag> ("jets")),
17  mJet2TracksAtVX (fConfig.getParameter<edm::InputTag> ("jet2TracksAtVX")),
18  mJet2TracksAtCALO (fConfig.getParameter<edm::InputTag> ("jet2TracksAtCALO"))
19 {
20  token_mJets = consumes<edm::View <reco::Jet> >(mJets);
21  if (!(mJet2TracksAtVX.label().empty())) token_mJet2TracksAtVX = consumes<reco::JetTracksAssociation::Container> (mJet2TracksAtVX);
22  if (!(mJet2TracksAtCALO.label().empty())) token_mJet2TracksAtCALO = consumes<reco::JetTracksAssociation::Container> (mJet2TracksAtCALO);
23 
24  produces<reco::JetExtendedAssociation::Container> ();
25 }
T getParameter(std::string const &) const
edm::InputTag mJet2TracksAtCALO
Definition: JetExtender.h:32
edm::EDGetTokenT< reco::JetTracksAssociation::Container > token_mJet2TracksAtVX
Definition: JetExtender.h:28
edm::InputTag mJet2TracksAtVX
Definition: JetExtender.h:31
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag mJets
Definition: JetExtender.h:30
edm::EDGetTokenT< edm::View< reco::Jet > > token_mJets
Definition: JetExtender.h:27
edm::EDGetTokenT< reco::JetTracksAssociation::Container > token_mJet2TracksAtCALO
Definition: JetExtender.h:29
JetExtender::~JetExtender ( )
virtual

Definition at line 27 of file JetExtender.cc.

27 {}

Member Function Documentation

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

Definition at line 29 of file JetExtender.cc.

References MillePedeFileConverter_cfg::e, edm::Event::getByToken(), edm::HandleBase::isValid(), 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, edm::Event::put(), reco::JetExtendedAssociation::setValue(), token_mJet2TracksAtCALO, token_mJet2TracksAtVX, token_mJets, reco::JetTracksAssociation::tracksNumber(), and reco::JetTracksAssociation::tracksP4().

29  {
30  // get stuff from Event
32  fEvent.getByToken (token_mJets, jets_h);
34  if (!(mJet2TracksAtVX.label().empty())) fEvent.getByToken (token_mJet2TracksAtVX, j2tVX_h);
36  if (!(mJet2TracksAtCALO.label().empty())) fEvent.getByToken (token_mJet2TracksAtCALO, j2tCALO_h);
37 
38  auto jetExtender = std::make_unique<reco::JetExtendedAssociation::Container>(reco::JetRefBaseProd(jets_h));
39 
40  // loop over jets (make sure jets in associations are the same as in collection
41 
42  for (unsigned j = 0; j < jets_h->size(); ++j) {
43  edm::RefToBase<reco::Jet> jet = jets_h->refAt(j);
45  if (j2tVX_h.isValid ()) { // fill tracks@VX summary
46  try {
48  extendedData.mTracksAtVertexP4 = reco::JetTracksAssociation::tracksP4 (*j2tVX_h, jet);
49  }
50  catch (cms::Exception e) {
51  edm::LogError ("MismatchedJets") << "Jets in original collection " << mJets
52  << " mismatch jets in j2t VX association " << mJet2TracksAtVX
53  << ". Wrong collections?";
54  throw e;
55  }
56  }
57  if (j2tCALO_h.isValid ()) { // fill tracks@CALO summary
58  try {
59  extendedData.mTracksAtCaloNumber = reco::JetTracksAssociation::tracksNumber (*j2tCALO_h, jet);
60  extendedData.mTracksAtCaloP4 = reco::JetTracksAssociation::tracksP4 (*j2tCALO_h, jet);
61  }
62  catch (cms::Exception e) {
63  edm::LogError ("MismatchedJets") << "Jets in original collection " << mJets
64  << " mismatch jets in j2t CALO association " << mJet2TracksAtCALO
65  << ". Wrong collections?";
66  throw e;
67  }
68  }
69  reco::JetExtendedAssociation::setValue (&*jetExtender, jet, extendedData);
70  }
71  fEvent.put(std::move(jetExtender));
72 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
bool setValue(Container &, const reco::JetBaseRef &, const JetExtendedData &)
associate jet with value. Returns false and associate nothing if jet is already associated ...
edm::RefToBaseProd< reco::Jet > JetRefBaseProd
Definition: JetCollection.h:14
edm::InputTag mJet2TracksAtCALO
Definition: JetExtender.h:32
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< reco::JetTracksAssociation::Container > token_mJet2TracksAtVX
Definition: JetExtender.h:28
edm::InputTag mJet2TracksAtVX
Definition: JetExtender.h:31
LorentzVector tracksP4(const Container &, const reco::JetBaseRef)
Get LorentzVector as sum of all tracks associated with jet.
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag mJets
Definition: JetExtender.h:30
int tracksNumber(const Container &, const reco::JetBaseRef)
Get number of tracks associated with jet.
edm::EDGetTokenT< edm::View< reco::Jet > > token_mJets
Definition: JetExtender.h:27
def move(src, dest)
Definition: eostools.py:510
edm::EDGetTokenT< reco::JetTracksAssociation::Container > token_mJet2TracksAtCALO
Definition: JetExtender.h:29

Member Data Documentation

edm::InputTag JetExtender::mJet2TracksAtCALO
private

Definition at line 32 of file JetExtender.h.

Referenced by JetExtender(), and produce().

edm::InputTag JetExtender::mJet2TracksAtVX
private

Definition at line 31 of file JetExtender.h.

Referenced by JetExtender(), and produce().

edm::InputTag JetExtender::mJets
private

Definition at line 30 of file JetExtender.h.

Referenced by JetExtender(), and produce().

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

Definition at line 29 of file JetExtender.h.

Referenced by JetExtender(), and produce().

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

Definition at line 28 of file JetExtender.h.

Referenced by JetExtender(), and produce().

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

Definition at line 27 of file JetExtender.h.

Referenced by JetExtender(), and produce().