1 #ifndef art_Framework_IO_ProductMix_MixOp_h 2 #define art_Framework_IO_ProductMix_MixOp_h 17 #include "canvas/Persistency/Provenance/Compatibility/BranchIDList.h" 21 #include "cetlib/exempt_ptr.h" 27 template <
typename PROD,
typename OPROD>
31 template <
typename PROD,
typename OPROD>
34 template <
typename FUNC>
39 bool compactMissingProducts,
58 cet::exempt_ptr<BranchIDLists const> branchIDLists)
override;
78 template <
typename PROD,
typename OPROD>
79 template <
typename FUNC>
83 bool const outputProduct,
84 bool const compactMissingProducts,
97 template <
typename PROD,
typename OPROD>
104 template <
typename PROD,
typename OPROD>
111 template <
typename PROD,
typename OPROD>
118 template <
typename PROD,
typename OPROD>
122 auto rProd = std::make_unique<OPROD>();
123 std::vector<PROD const*> inConverted;
127 for (
auto i = cbegin(
inProducts_); i != endIter; ++i) {
128 auto const prod = (*i)->product();
130 inConverted.emplace_back(prod);
134 catch (std::bad_cast
const&) {
136 <<
"Unable to obtain correctly-typed product from wrapper.\n";
138 if (
mixFunc_(inConverted, *rProd, remap)) {
141 <<
"Returned true (output product to be put in event) from a mix " 143 <<
"declared with outputProduct=false.\n";
146 e.
put(std::move(rProd));
153 template <
typename PROD,
typename OPROD>
160 <<
"Unable to find requested product " <<
inputTag_ <<
" of type " 165 std::vector<TypeID>
const types{
TypeID{
typeid(PROD)}};
169 template <
typename PROD,
typename OPROD>
176 template <
typename PROD,
typename OPROD>
182 TypeID const outputType{
typeid(OPROD)};
183 BranchKey const key{outputType.friendlyClassName(),
191 <<
"MixOp unable to find branch id for a product (" 192 << outputType.className() <<
") that should have been registered!\n";
194 result = I->second.productID();
199 template <
typename PROD,
typename OPROD>
203 cet::exempt_ptr<BranchIDLists const> branchIDLists)
214 auto const b = seq.cbegin(),
e = seq.cend();
215 for (
auto i = b; i !=
e; ++i) {
216 auto fit = std::find(b, i, *i);
224 std::advance(pit, std::distance(b, fit));
230 template <
typename PROD,
typename OPROD>
TypeID const & inputType() const override
MixFunc< PROD, OPROD > const mixFunc_
void mixAndPut(Event &e, PtrRemapper const &remap) const override
BranchType const branchType_
std::string friendlyClassName() const
bool findBranchInfo(InputTag const &tag, RootBranchInfo &rbInfo) const
std::string const & branchName() const
void configureStreamers(cet::exempt_ptr< BranchIDLists const > branchIDLists)
ProductID incomingProductID() const override
std::string const moduleLabel_
std::vector< std::shared_ptr< Wrapper< PROD >>> SpecProdList
InputTag const & inputTag() const override
MixOp(InputTag const &inputTag, std::string const &outputInstanceLabel, FUNC mixFunc, bool outputProduct, bool compactMissingProducts, BranchType bt)
std::string const outputInstanceLabel_
ProductID put(std::unique_ptr< PROD > &&product)
BranchType branchType() const override
ProductID outgoingProductID() const override
bool const outputProduct_
std::function< bool(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &)> MixFunc
void initializeBranchInfo(RootBranchInfoList const &rbiList) override
std::vector< FileIndex::EntryNumber_t > EntryNumberSequence
bool const compactMissingProducts_
std::string const processName_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
RootBranchInfo branchInfo_
void readFromFile(EntryNumberSequence const &seq, cet::exempt_ptr< BranchIDLists const > branchIDLists) override
TBranch const * branch() const
void checkForMissingDictionaries(std::vector< TypeID > const &types) noexcept( false)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
std::string const & outputInstanceLabel() const override