CMS 3D CMS Logo

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

Public Member Functions

 LowPtGSFToTrackLinker (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) 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 &)
 
- 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

const edm::EDGetTokenT< std::vector< reco::GsfTrack > > gsftracks_
 
const edm::EDGetTokenT< std::vector< reco::PreId > > preid_
 
const edm::EDGetTokenT< reco::TrackCollectiontracks_
 

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

Definition at line 23 of file LowPtGSFToTrackLinker.cc.

Constructor & Destructor Documentation

◆ LowPtGSFToTrackLinker()

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

Definition at line 36 of file LowPtGSFToTrackLinker.cc.

37  : tracks_{consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"))},
38  preid_{consumes<std::vector<reco::PreId> >(iConfig.getParameter<edm::InputTag>("gsfPreID"))},
39  gsftracks_{consumes<std::vector<reco::GsfTrack> >(iConfig.getParameter<edm::InputTag>("gsfTracks"))} {
40  produces<edm::Association<reco::TrackCollection> >();
41 }

References edm::ParameterSet::getParameter().

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 77 of file LowPtGSFToTrackLinker.cc.

77  {
79  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
80  desc.add<edm::InputTag>("gsfPreID", edm::InputTag("lowPtGsfElectronSeeds"));
81  desc.add<edm::InputTag>("gsfTracks", edm::InputTag("lowPtGsfEleGsfTracks"));
82  descriptions.add("lowPtGsfToTrackLinks", desc);
83 }

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

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 43 of file LowPtGSFToTrackLinker.cc.

43  {
44  auto gsftracks = iEvent.getHandle(gsftracks_);
45  auto tracks = iEvent.getHandle(tracks_);
46  auto preid = iEvent.getHandle(preid_);
47 
48  // collection sizes, for reference
49  const size_t ngsf = gsftracks->size();
50 
51  //store mapping for association
52  std::vector<int> gsf2track(ngsf, -1);
53 
54  //map Track --> GSF and fill GSF --> PackedCandidates and GSF --> Lost associations
55  for (unsigned int igsf = 0; igsf < ngsf; ++igsf) {
56  reco::GsfTrackRef gref(gsftracks, igsf);
57  reco::TrackRef trk = preid->at(gref->seedRef().castTo<reco::ElectronSeedRef>().index()).trackRef();
58 
59  if (trk.id() != tracks.id()) {
60  throw cms::Exception(
61  "WrongCollection",
62  "The reco::Track collection used to match against the GSF Tracks was not used to produce such tracks");
63  }
64 
65  size_t trkid = trk.index();
66  gsf2track[igsf] = trkid;
67  }
68 
69  // create output collections from the mappings
70  auto assoc = std::make_unique<edm::Association<reco::TrackCollection> >(tracks);
72  filler.insert(gsftracks, gsf2track.begin(), gsf2track.end());
73  filler.fill();
74  iEvent.put(std::move(assoc));
75 }

References trackingPlots::assoc, Exception, trigObjTnPSource_cfi::filler, gsftracks_, edm::Ref< C, T, F >::id(), iEvent, edm::Ref< C, T, F >::index(), eostools::move(), preid_, PDWG_EXOHSCP_cff::tracks, and tracks_.

Member Data Documentation

◆ gsftracks_

const edm::EDGetTokenT<std::vector<reco::GsfTrack> > LowPtGSFToTrackLinker::gsftracks_
private

Definition at line 33 of file LowPtGSFToTrackLinker.cc.

Referenced by produce().

◆ preid_

const edm::EDGetTokenT<std::vector<reco::PreId> > LowPtGSFToTrackLinker::preid_
private

Definition at line 32 of file LowPtGSFToTrackLinker.cc.

Referenced by produce().

◆ tracks_

const edm::EDGetTokenT<reco::TrackCollection> LowPtGSFToTrackLinker::tracks_
private

Definition at line 31 of file LowPtGSFToTrackLinker.cc.

Referenced by produce().

PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
edm::Association::Filler
Definition: Association.h:78
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Ref::index
key_type index() const
Definition: Ref.h:253
LowPtGSFToTrackLinker::gsftracks_
const edm::EDGetTokenT< std::vector< reco::GsfTrack > > gsftracks_
Definition: LowPtGSFToTrackLinker.cc:33
edm::Ref< GsfTrackCollection >
trackingPlots.assoc
assoc
Definition: trackingPlots.py:183
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
LowPtGSFToTrackLinker::tracks_
const edm::EDGetTokenT< reco::TrackCollection > tracks_
Definition: LowPtGSFToTrackLinker.cc:31
LowPtGSFToTrackLinker::preid_
const edm::EDGetTokenT< std::vector< reco::PreId > > preid_
Definition: LowPtGSFToTrackLinker.cc:32
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:246
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::InputTag
Definition: InputTag.h:15