1 #ifndef FWCore_Framework_ThinningProducer_h
2 #define FWCore_Framework_ThinningProducer_h
29 template <
typename Collection,
typename Selector>
47 template <
typename Collection,
typename Selector>
50 selector_(new
Selector(pset, consumesCollector())) {
55 produces<Collection>();
56 produces<ThinnedAssociation>();
59 template <
typename Collection,
typename Selector>
63 template <
typename Collection,
typename Selector>
67 desc.
setComment(
"Produces thinned collections and associations to them");
69 Selector::fillDescription(desc);
73 template <
typename Collection,
typename Selector>
78 event.getByToken(inputToken_, inputCollection);
81 selector_->preChoose(inputCollection, constEvent, eventSetup);
83 std::auto_ptr<Collection> thinnedCollection(
new Collection);
86 unsigned int iIndex = 0;
87 for(
auto iter = inputCollection->begin(), iterEnd = inputCollection->end();
88 iter != iterEnd; ++iter, ++iIndex) {
89 if(selector_->choose(iIndex, *iter)) {
90 thinnedCollection->push_back(*iter);
91 thinnedAssociation->push_back(iIndex);
96 thinnedAssociation->setParentCollectionID(inputCollection.
id());
97 thinnedAssociation->setThinnedCollectionID(orphanHandle.
id());
98 event.put(thinnedAssociation);
101 template <
typename Collection,
typename Selector>
120 std::vector<BranchID> parentCollectionIDs;
123 for(
auto const& product : productList) {
127 desc.
moduleLabel() == moduleDescription().moduleLabel() &&
130 thinnedCollectionID = desc.
branchID();
134 if(inputTag_.willSkipCurrentProcess()) {
136 parentCollectionIDs.push_back(desc.
branchID());
138 }
else if (inputTag_.process().empty() || inputTag_.process() == desc.
processName()) {
142 parentCollectionIDs.push_back(desc.
branchID());
149 desc.
moduleLabel() == moduleDescription().moduleLabel() &&
155 if(parentCollectionIDs.empty()) {
161 for(
auto const& parentCollectionID : parentCollectionIDs) {
162 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
edm::propagate_const< std::unique_ptr< Selector > > selector_
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
BranchID const & originalBranchID() const
static void fillDescriptions(ConfigurationDescriptions &descriptions)