CMS 3D CMS Logo

ThinnedRefSet Class Reference

#include "ThinnedRefSet.h"

Detailed Description

Description: A minimal set interface (insertion, contains(), clear()) for a set of Ref keys to a thinned collection

Usage:

A ThinnedRefSet contains Ref keys to a thinned collection. The keys are inserted as Refs to the thinned collection itself, or to any parent collections of the thinned collection.

The main use case are Selector classes for edm::ThinningProducer. There, an object of the class would be stored as a member of the Selector class, filled in Selector::preChoose(), calling contains() in Selector::choose(), and cleared in Selector::reset().

Example of filling

class ExampleSelector {
...
};
void ExampleSelector::preChoose(edm::Handle<ThingCollection> tc, edm::Event const& e, edm::EventSetup const&) {
auto filler = keysToSave_.fill(edm::RefProd(tc), event.productGetter());
for (auto const& object : event.get(objectCollectionToken_) {
filler.insert(object.refToThing());
}
}

Example of querying if a key is present

bool ExampleSelector::choose(unsigned int iIndex, Thing const& iItem) const {
return keysToSave_.contains(iIndex);
}
edm::RefProd
Definition: EDProductfwd.h:25
RecoTauPiZeroBuilderPlugins_cfi.choose
choose
Definition: RecoTauPiZeroBuilderPlugins_cfi.py:30
edm::Handle
Definition: AssociativeIterator.h:50
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
edm::EventSetup
Definition: EventSetup.h:58
edm::ThinnedRefSet
Definition: ThinnedRefSet.h:57
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37