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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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
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<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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 }

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 47 of file JetTracksAssociationToTrackRefs.cc.

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 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_2018_cff::InputTag.

◆ 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.

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 }

References TrackValidation_cff::association, associationToken_, pfClustersFromHGC3DClusters_cfi::corrector, correctorToken_, mps_fire::i, iEvent, metsig::jet, singleTopDQM_cfi::jets, jetToken_, eostools::move(), p4, ptMin_, runTheMatrix::ret, and Scenarios_cff::scale.

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().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
reco::JetCorrector
Definition: JetCorrector.h:35
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
JetTracksAssociationToTrackRefs::ptMin_
const double ptMin_
Definition: JetTracksAssociationToTrackRefs.cc:35
pfClustersFromHGC3DClusters_cfi.corrector
corrector
Definition: pfClustersFromHGC3DClusters_cfi.py:5
JetTracksAssociationToTrackRefs::correctorToken_
edm::EDGetTokenT< reco::JetCorrector > correctorToken_
Definition: JetTracksAssociationToTrackRefs.cc:34
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
JetTracksAssociationToTrackRefs::jetToken_
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
Definition: JetTracksAssociationToTrackRefs.cc:33
edm::AssociationVector
Definition: AssociationVector.h:67
edm::View
Definition: CaloClusterFwd.h:14
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
JetTracksAssociationToTrackRefs::associationToken_
edm::EDGetTokenT< reco::JetTracksAssociation::Container > associationToken_
Definition: JetTracksAssociationToTrackRefs.cc:32
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
TrackValidation_cff.association
association
Definition: TrackValidation_cff.py:286
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
metsig::jet
Definition: SignAlgoResolutions.h:47
edm::RefToBase< reco::Jet >
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
edm::InputTag
Definition: InputTag.h:15