|
|
Go to the documentation of this file. 1 #ifndef UtilAlgos_UniqueMerger_h
2 #define UtilAlgos_UniqueMerger_h
37 typedef std::set<typename OutputCollection::value_type>
set_type;
47 typedef std::vector<edm::EDGetTokenT<InputCollection> >
vtoken;
56 template <
typename InputCollection,
typename OutputCollection,
typename P>
60 skipNulls_(par.getParameter<
bool>(
"skipNulls")),
61 warnOnSkip_(par.getParameter<
bool>(
"warnOnSkip")) {
62 produces<OutputCollection>();
65 template <
typename InputCollection,
typename OutputCollection,
typename P>
68 template <
typename InputCollection,
typename OutputCollection,
typename P>
73 for (
auto const&
s : srcToken_) {
74 for (
auto const&
c : evt.
get(
s)) {
75 if (!skipNulls_ || (
c.isNonnull() &&
c.isAvailable())) {
77 }
else if (warnOnSkip_) {
78 edm::LogWarning(
"InvalidPointer") <<
"Found an invalid pointer. Will not merge to collection.";
82 std::unique_ptr<OutputCollection> coll(
new OutputCollection(coll_set.size()));
83 std::copy(coll_set.begin(), coll_set.end(), coll->begin());
UniqueMerger(const edm::ParameterSet &)
constructor from parameter set
Log< level::Warning, false > LogWarning
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
vtoken srcToken_
labels of the collections to be merged
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
bool skipNulls_
choose whether to skip null/invalid pointers
std::set< typename OutputCollection::value_type > set_type
~UniqueMerger() override
destructor
std::vector< edm::EDGetTokenT< InputCollection > > vtoken
vector of strings
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
def template(fileName, svg, replaceme="REPLACEME")
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
process an event
std::pair< OmniClusterRef, TrackingParticleRef > P
bool get(ProductID const &oid, Handle< PROD > &result) const
bool warnOnSkip_
choose whether to warn when skipping pointers