1 #ifndef FWCore_Framework_ThinningProducer_h
2 #define FWCore_Framework_ThinningProducer_h
28 template <
typename Collection,
typename Selector>
46 template <
typename Collection,
typename Selector>
49 selector_(new
Selector(pset, consumesCollector())) {
54 produces<Collection>();
55 produces<ThinnedAssociation>();
58 template <
typename Collection,
typename Selector>
62 template <
typename Collection,
typename Selector>
66 desc.
setComment(
"Produces thinned collections and associations to them");
68 Selector::fillDescription(desc);
72 template <
typename Collection,
typename Selector>
77 event.getByToken(inputToken_, inputCollection);
80 selector_->preChoose(inputCollection, constEvent, eventSetup);
82 std::auto_ptr<Collection> thinnedCollection(
new Collection);
85 unsigned int iIndex = 0;
86 for(
auto iter = inputCollection->begin(), iterEnd = inputCollection->end();
87 iter != iterEnd; ++iter, ++iIndex) {
88 if(selector_->choose(iIndex, *iter)) {
89 thinnedCollection->push_back(*iter);
90 thinnedAssociation->push_back(iIndex);
95 thinnedAssociation->setParentCollectionID(inputCollection.
id());
96 thinnedAssociation->setThinnedCollectionID(orphanHandle.
id());
97 event.put(thinnedAssociation);
100 template <
typename Collection,
typename Selector>
119 std::vector<BranchID> parentCollectionIDs;
122 for(
auto const& product : productList) {
126 desc.
moduleLabel() == moduleDescription().moduleLabel() &&
129 thinnedCollectionID = desc.
branchID();
133 if(inputTag_.willSkipCurrentProcess()) {
135 parentCollectionIDs.push_back(desc.
branchID());
137 }
else if (inputTag_.process().empty() || inputTag_.process() == desc.
processName()) {
141 parentCollectionIDs.push_back(desc.
branchID());
148 desc.
moduleLabel() == moduleDescription().moduleLabel() &&
154 if(parentCollectionIDs.empty()) {
160 for(
auto const& parentCollectionID : parentCollectionIDs) {
161 thinnedAssociationsHelper.
addAssociation(parentCollectionID, associationID, thinnedCollectionID);
T getParameter(std::string const &) const
void addAssociation(BranchID const &, BranchID const &, BranchID const &)
std::map< BranchKey, BranchDescription > ProductList
std::string const & processName() const
ProductList const & productList() const
void setComment(std::string const &value)
void addDefault(ParameterSetDescription const &psetDescription)
std::string const & moduleLabel() const
virtual ~ThinningProducer()
std::string const & productInstanceName() const
ThinningProducer(ParameterSet const &pset)
edm::EDGetTokenT< Collection > inputToken_
virtual void produce(Event &event, EventSetup const &eventSetup) override
BranchID const & branchID() const
TypeWithDict const & unwrappedType() const
std::type_info const & typeInfo() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Functor that operates on <T>
virtual void registerThinnedAssociations(ProductRegistry const &productRegistry, ThinnedAssociationsHelper &thinnedAssociationsHelper) override
std::unique_ptr< Selector > selector_
BranchID const & originalBranchID() const
static void fillDescriptions(ConfigurationDescriptions &descriptions)