CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
 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
 
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)
 
 ~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 &)
 
- 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::TrackCollection
tracks_
 

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

Definition at line 23 of file LowPtGSFToTrackLinker.cc.

Constructor & Destructor Documentation

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

Definition at line 36 of file LowPtGSFToTrackLinker.cc.

References edm::ParameterSet::getParameter().

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 }
const edm::EDGetTokenT< std::vector< reco::PreId > > preid_
const edm::EDGetTokenT< std::vector< reco::GsfTrack > > gsftracks_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< reco::TrackCollection > tracks_

Member Function Documentation

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

Definition at line 77 of file LowPtGSFToTrackLinker.cc.

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

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 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void LowPtGSFToTrackLinker::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup  
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 43 of file LowPtGSFToTrackLinker.cc.

References Exception, edm::Event::getHandle(), gsftracks_, edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::index(), eostools::move(), preid_, edm::Event::put(), tracks, and tracks_.

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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EDGetTokenT< std::vector< reco::PreId > > preid_
key_type index() const
Definition: Ref.h:253
auto const & tracks
cannot be loose
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
const edm::EDGetTokenT< std::vector< reco::GsfTrack > > gsftracks_
def move
Definition: eostools.py:511
const edm::EDGetTokenT< reco::TrackCollection > tracks_

Member Data Documentation

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

Definition at line 33 of file LowPtGSFToTrackLinker.cc.

Referenced by produce().

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

Definition at line 32 of file LowPtGSFToTrackLinker.cc.

Referenced by produce().

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

Definition at line 31 of file LowPtGSFToTrackLinker.cc.

Referenced by produce().