CMS 3D CMS Logo

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

#include <MyTemporarySubSystem/PackedCandidateGenAssociationProducer/plugins/PackedCandidateGenAssociationProducer.cc>

Inheritance diagram for PackedCandidateGenAssociationProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PackedCandidateGenAssociationProducer (const edm::ParameterSet &)
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genToPrunedToken_
 
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genToPrunedWSOToken_
 
edm::EDGetTokenT< edm::View< reco::Track > > tracksToken_
 
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > trackToGenToken_
 
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > trackToPcToken_
 

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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 41 of file PackedCandidateGenAssociationProducer.cc.

Constructor & Destructor Documentation

◆ PackedCandidateGenAssociationProducer()

PackedCandidateGenAssociationProducer::PackedCandidateGenAssociationProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 56 of file PackedCandidateGenAssociationProducer.cc.

58  iConfig.getParameter<edm::InputTag>("trackToGenAssoc"))),
60  iConfig.getParameter<edm::InputTag>("trackToPackedCandidatesAssoc"))),
62  iConfig.getParameter<edm::InputTag>("genToPrunedAssoc"))),
64  iConfig.getParameter<edm::InputTag>("genToPrunedAssocWithStatusOne"))),
66  produces<edm::Association<reco::GenParticleCollection>>();
67 }

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 132 of file PackedCandidateGenAssociationProducer.cc.

132  {
134  desc.add<edm::InputTag>("genToPrunedAssoc", edm::InputTag("prunedGenParticles"));
135  desc.add<edm::InputTag>("genToPrunedAssocWithStatusOne", edm::InputTag("prunedGenParticlesWithStatusOne"));
136  desc.add<edm::InputTag>("trackToPackedCandidatesAssoc", edm::InputTag("packedPFCandidates"));
137  desc.add<edm::InputTag>("trackToGenAssoc");
138  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
139 
140  descriptions.add("packedCandidatesGenAssociationDefault", desc);
141 }

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

◆ produce()

void PackedCandidateGenAssociationProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 69 of file PackedCandidateGenAssociationProducer.cc.

71  {
72  using namespace edm;
73 
75  auto pcCollection = trackToPackedCandidatesAssoc.ref();
76 
77  const auto& genToPrunedAssoc = iEvent.get(genToPrunedToken_);
78  auto prunedCollection = genToPrunedAssoc.ref();
79 
80  const auto& genToPrunedAssocWSO = iEvent.get(genToPrunedWSOToken_);
81 
82  auto trackHandle = iEvent.getHandle(tracksToken_);
83  const auto& tracks = *trackHandle;
84 
85  auto out = std::make_unique<edm::Association<reco::GenParticleCollection>>(prunedCollection);
86 
87  auto trackToGenAssocHandle = iEvent.getHandle(trackToGenToken_);
88  if (not trackToGenAssocHandle.isValid() or not trackToGenAssocHandle->contains(trackHandle.id())) {
89  // not track to gen association available, possibly an old AODSIM, or a missing RECOSIM step
90  // alternatively, the track association may not contain our tracks, as in the case of RECOSIM run on an old RAWSIM
91  // early exit with an empty collection to avoid crash
92  iEvent.put(std::move(out));
93  return;
94  }
95 
96  const auto& trackToGenAssoc = *trackToGenAssocHandle;
97 
99 
100  std::vector<int> indices(pcCollection->size(), -1);
101 
102  for (size_t i = 0; i < tracks.size(); i++) {
103  auto track = tracks.refAt(i);
104 
106  if (pc.isNull()) {
107  continue;
108  }
109 
110  auto gen = trackToGenAssoc[track];
111  if (gen.isNull()) {
112  continue;
113  }
114 
115  auto newGenWSO = genToPrunedAssocWSO[gen];
116  if (newGenWSO.isNull()) {
117  continue;
118  }
119 
120  auto newGen = genToPrunedAssoc[newGenWSO];
121  if (newGen.isNull()) {
122  continue;
123  }
124 
125  indices[pc.index()] = newGen.index();
126  }
127  filler.insert(pcCollection, indices.begin(), indices.end());
128  filler.fill();
129  iEvent.put(std::move(out));
130 }

References trigObjTnPSource_cfi::filler, relval_steps::gen(), genToPrunedToken_, genToPrunedWSOToken_, mps_fire::i, iEvent, dqmdumpme::indices, eostools::move(), or, MillePedeFileConverter_cfg::out, HLT_FULL_cff::track, tracks, tracksToken_, genParticleAssociation_cff::trackToGenAssoc, trackToGenToken_, genParticleAssociation_cff::trackToPackedCandidatesAssoc, and trackToPcToken_.

Member Data Documentation

◆ genToPrunedToken_

edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > PackedCandidateGenAssociationProducer::genToPrunedToken_
private

Definition at line 52 of file PackedCandidateGenAssociationProducer.cc.

Referenced by produce().

◆ genToPrunedWSOToken_

edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > PackedCandidateGenAssociationProducer::genToPrunedWSOToken_
private

Definition at line 53 of file PackedCandidateGenAssociationProducer.cc.

Referenced by produce().

◆ tracksToken_

edm::EDGetTokenT<edm::View<reco::Track> > PackedCandidateGenAssociationProducer::tracksToken_
private

Definition at line 54 of file PackedCandidateGenAssociationProducer.cc.

Referenced by produce().

◆ trackToGenToken_

edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > PackedCandidateGenAssociationProducer::trackToGenToken_
private

Definition at line 50 of file PackedCandidateGenAssociationProducer.cc.

Referenced by produce().

◆ trackToPcToken_

edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection> > PackedCandidateGenAssociationProducer::trackToPcToken_
private

Definition at line 51 of file PackedCandidateGenAssociationProducer.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
edm::Association::Filler
Definition: Association.h:78
PackedCandidateGenAssociationProducer::genToPrunedWSOToken_
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genToPrunedWSOToken_
Definition: PackedCandidateGenAssociationProducer.cc:53
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PackedCandidateGenAssociationProducer::genToPrunedToken_
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genToPrunedToken_
Definition: PackedCandidateGenAssociationProducer.cc:52
PackedCandidateGenAssociationProducer::trackToPcToken_
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > trackToPcToken_
Definition: PackedCandidateGenAssociationProducer.cc:51
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PackedCandidateGenAssociationProducer::tracksToken_
edm::EDGetTokenT< edm::View< reco::Track > > tracksToken_
Definition: PackedCandidateGenAssociationProducer.cc:54
gen
Definition: PythiaDecays.h:13
genParticleAssociation_cff.trackToPackedCandidatesAssoc
trackToPackedCandidatesAssoc
Definition: genParticleAssociation_cff.py:9
edm::View
Definition: CaloClusterFwd.h:14
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::Association
Definition: Association.h:18
PackedCandidateGenAssociationProducer::trackToGenToken_
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > trackToGenToken_
Definition: PackedCandidateGenAssociationProducer.cc:50
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
relval_steps.gen
def gen(fragment, howMuch)
Production test section ####.
Definition: relval_steps.py:506
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:159
dqmdumpme.indices
indices
Definition: dqmdumpme.py:50
genParticleAssociation_cff.trackToGenAssoc
trackToGenAssoc
Definition: genParticleAssociation_cff.py:4
edm::InputTag
Definition: InputTag.h:15