CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
JetTracksAssociationToTrackRefs Class Reference
Inheritance diagram for JetTracksAssociationToTrackRefs:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetTracksAssociationToTrackRefs (const edm::ParameterSet &iConfig)
 
void produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< reco::JetTracksAssociation::ContainerassociationToken_
 
edm::EDGetTokenT< reco::JetCorrectorcorrectorToken_
 
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
 
const double ptMin_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

The purpose of this producer is to convert AssociationVector<JetRefBaseProd, vector<RefVector<Track> > to a RefVector<Track> of the (unique) values.

Definition at line 23 of file JetTracksAssociationToTrackRefs.cc.

Constructor & Destructor Documentation

◆ JetTracksAssociationToTrackRefs()

JetTracksAssociationToTrackRefs::JetTracksAssociationToTrackRefs ( const edm::ParameterSet iConfig)

Definition at line 38 of file JetTracksAssociationToTrackRefs.cc.

40  consumes<reco::JetTracksAssociation::Container>(iConfig.getParameter<edm::InputTag>("association"))),
42  correctorToken_(consumes<reco::JetCorrector>(iConfig.getParameter<edm::InputTag>("corrector"))),
43  ptMin_(iConfig.getParameter<double>("correctedPtMin")) {
44  produces<reco::TrackRefVector>();
45 }
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::JetCorrector > correctorToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::JetTracksAssociation::Container > associationToken_

Member Function Documentation

◆ fillDescriptions()

void JetTracksAssociationToTrackRefs::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 47 of file JetTracksAssociationToTrackRefs.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

47  {
49  desc.add<edm::InputTag>("association", edm::InputTag("ak4JetTracksAssociatorAtVertexPF"));
50  desc.add<edm::InputTag>("jets", edm::InputTag("ak4PFJetsCHS"));
51  desc.add<edm::InputTag>("corrector", edm::InputTag("ak4PFL1FastL2L3Corrector"));
52  desc.add<double>("correctedPtMin", 0);
53  descriptions.add("jetTracksAssociationToTrackRefs", desc);
54 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void JetTracksAssociationToTrackRefs::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 56 of file JetTracksAssociationToTrackRefs.cc.

References associationToken_, pfClustersFromHGC3DClusters_cfi::corrector, correctorToken_, mps_fire::i, iEvent, metsig::jet, PDWG_EXODelayedJetMET_cff::jets, jetToken_, eostools::move(), ptMin_, runTheMatrix::ret, and L1EGammaClusterEmuProducer_cfi::scale.

56  {
58  iEvent.getByToken(associationToken_, h_assoc);
60 
62  iEvent.getByToken(jetToken_, h_jets);
63  const edm::View<reco::Jet>& jets = *h_jets;
64 
66  iEvent.getByToken(correctorToken_, h_corrector);
67  const reco::JetCorrector& corrector = *h_corrector;
68 
69  auto ret = std::make_unique<reco::TrackRefVector>();
70  std::unordered_set<reco::TrackRefVector::key_type> alreadyAdded;
71 
72  // Exctract tracks only for jets passing certain pT threshold after
73  // correction
74  for (size_t i = 0; i < jets.size(); ++i) {
75  edm::RefToBase<reco::Jet> jetRef = jets.refAt(i);
76  const reco::Jet& jet = *jetRef;
77 
78  auto p4 = jet.p4();
79 
80  // Energy correction in the most general way
81  if (!corrector.vectorialCorrection()) {
82  double scale = 1;
83  if (!corrector.refRequired()) {
84  scale = corrector.correction(jet);
85  } else {
86  scale = corrector.correction(jet, jetRef);
87  }
88  p4 = p4 * scale;
89  } else {
90  corrector.correction(jet, jetRef, p4);
91  }
92 
93  if (p4.pt() <= ptMin_)
94  continue;
95 
96  for (const auto& trackRef : association[jetRef]) {
97  if (alreadyAdded.find(trackRef.key()) == alreadyAdded.end()) {
98  ret->push_back(trackRef);
99  alreadyAdded.insert(trackRef.key());
100  }
101  }
102  }
103 
104  iEvent.put(std::move(ret));
105 }
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
ret
prodAgent to be discontinued
Base class for all types of Jets.
Definition: Jet.h:20
edm::EDGetTokenT< reco::JetCorrector > correctorToken_
int iEvent
Definition: GenABIO.cc:224
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
edm::EDGetTokenT< reco::JetTracksAssociation::Container > associationToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ associationToken_

edm::EDGetTokenT<reco::JetTracksAssociation::Container> JetTracksAssociationToTrackRefs::associationToken_
private

Definition at line 32 of file JetTracksAssociationToTrackRefs.cc.

Referenced by produce().

◆ correctorToken_

edm::EDGetTokenT<reco::JetCorrector> JetTracksAssociationToTrackRefs::correctorToken_
private

Definition at line 34 of file JetTracksAssociationToTrackRefs.cc.

Referenced by produce().

◆ jetToken_

edm::EDGetTokenT<edm::View<reco::Jet> > JetTracksAssociationToTrackRefs::jetToken_
private

Definition at line 33 of file JetTracksAssociationToTrackRefs.cc.

Referenced by produce().

◆ ptMin_

const double JetTracksAssociationToTrackRefs::ptMin_
private

Definition at line 35 of file JetTracksAssociationToTrackRefs.cc.

Referenced by produce().