LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::MixOp< Prod, OProd > Class Template Reference

#include "MixOp.h"

Inheritance diagram for art::MixOp< Prod, OProd >:
art::MixOpBase

Public Member Functions

template<typename FUNC >
 MixOp (std::string const &moduleLabel, InputTag const &inputTag, std::string const &outputInstanceLabel, FUNC mixFunc, bool outputProduct, bool compactMissingProducts, BranchType bt)
 
InputTag const & inputTag () const override
 
TypeID inputType () const override
 
EDProduct const * newIncomingWrappedProduct () const override
 
ProductID incomingProductID () const override
 
ProductID outgoingProductID () const override
 
BranchType branchType () const override
 

Private Member Functions

void mixAndPut (Event &e, SpecProdList const &inProducts, PtrRemapper const &remap) const override
 
void setIncomingProductID (ProductID) override
 

Private Attributes

InputTag const inputTag_
 
std::string const outputInstanceLabel_
 
TypeID const inputType_
 
MixFunc< Prod, OProd > const mixFunc_
 
std::string const processName_
 
std::string const moduleLabel_
 
bool const outputProduct_
 
bool const compactMissingProducts_
 
BranchType const branchType_
 
ProductID incomingProductID_ {ProductID::invalid()}
 

Detailed Description

template<typename Prod, typename OProd>
class art::MixOp< Prod, OProd >

Definition at line 30 of file MixOp.h.

Constructor & Destructor Documentation

template<typename Prod , typename OProd >
template<typename FUNC >
art::MixOp< Prod, OProd >::MixOp ( std::string const &  moduleLabel,
InputTag const &  inputTag,
std::string const &  outputInstanceLabel,
FUNC  mixFunc,
bool  outputProduct,
bool  compactMissingProducts,
BranchType  bt 
)

Definition at line 80 of file MixOp.h.

References art::MixOp< Prod, OProd >::branchType_, art::MixOp< Prod, OProd >::compactMissingProducts_, art::MixOp< Prod, OProd >::inputType_, art::Globals::instance(), art::MixOp< Prod, OProd >::mixFunc_, art::MixOp< Prod, OProd >::moduleLabel_, art::MixOp< Prod, OProd >::outputInstanceLabel_, art::MixOp< Prod, OProd >::outputProduct_, art::Globals::processName(), and art::MixOp< Prod, OProd >::processName_.

88  , outputInstanceLabel_{outputInstanceLabel}
89  , inputType_{typeid(Prod)}
90  , mixFunc_{mixFunc}
92  , moduleLabel_{moduleLabel}
93  , outputProduct_{outputProduct}
94  , compactMissingProducts_{compactMissingProducts}
95  , branchType_{bt}
96  {}
std::string const moduleLabel_
Definition: MixOp.h:71
BranchType const branchType_
Definition: MixOp.h:74
InputTag const & inputTag() const override
Definition: MixOp.h:42
bool const outputProduct_
Definition: MixOp.h:72
std::string const outputInstanceLabel_
Definition: MixOp.h:67
InputTag const inputTag_
Definition: MixOp.h:66
bool const compactMissingProducts_
Definition: MixOp.h:73
std::string const processName_
Definition: MixOp.h:70
MixFunc< Prod, OProd > const mixFunc_
Definition: MixOp.h:69
std::string const & processName() const
Definition: Globals.cc:48
TypeID const inputType_
Definition: MixOp.h:68
static Globals * instance()
Definition: Globals.cc:17

Member Function Documentation

template<typename Prod , typename OProd >
BranchType art::MixOp< Prod, OProd >::branchType ( ) const
inlineoverridevirtual

Implements art::MixOpBase.

Definition at line 167 of file MixOp.h.

References art::MixOp< Prod, OProd >::branchType_.

Referenced by art::MixOp< Prod, OProd >::newIncomingWrappedProduct().

168  {
169  return branchType_;
170  }
BranchType const branchType_
Definition: MixOp.h:74
template<typename Prod , typename OProd >
ProductID art::MixOp< Prod, OProd >::incomingProductID ( ) const
overridevirtual

Implements art::MixOpBase.

Definition at line 142 of file MixOp.h.

References art::MixOp< Prod, OProd >::incomingProductID_.

Referenced by art::MixOp< Prod, OProd >::newIncomingWrappedProduct().

143  {
144  return incomingProductID_;
145  }
ProductID incomingProductID_
Definition: MixOp.h:75
template<typename Prod , typename OProd >
InputTag const& art::MixOp< Prod, OProd >::inputTag ( ) const
inlineoverridevirtual

Implements art::MixOpBase.

Definition at line 42 of file MixOp.h.

References art::MixOp< Prod, OProd >::inputTag_.

43  {
44  return inputTag_;
45  }
InputTag const inputTag_
Definition: MixOp.h:66
template<typename Prod , typename OProd >
TypeID art::MixOp< Prod, OProd >::inputType ( ) const
inlineoverridevirtual

Implements art::MixOpBase.

Definition at line 47 of file MixOp.h.

References art::MixOp< Prod, OProd >::inputType_.

48  {
49  return inputType_;
50  }
TypeID const inputType_
Definition: MixOp.h:68
template<typename Prod , typename OProd >
void art::MixOp< Prod, OProd >::mixAndPut ( Event e,
SpecProdList const &  inProducts,
PtrRemapper const &  remap 
) const
overrideprivatevirtual

Implements art::MixOpBase.

Definition at line 100 of file MixOp.h.

References art::MixOp< Prod, OProd >::compactMissingProducts_, art::errors::DataCorruption, art::errors::LogicError, art::MixOp< Prod, OProd >::mixFunc_, art::MixOp< Prod, OProd >::outputInstanceLabel_, art::MixOp< Prod, OProd >::outputProduct_, and art::Event::put().

Referenced by art::MixOp< Prod, OProd >::newIncomingWrappedProduct().

103  {
104  std::vector<Prod const*> inConverted;
105  inConverted.reserve(inProducts.size());
106  try {
107  for (auto const& ep : inProducts) {
108  auto const prod =
109  std::dynamic_pointer_cast<Wrapper<Prod> const>(ep)->product();
110  if (prod || !compactMissingProducts_) {
111  inConverted.emplace_back(prod);
112  }
113  }
114  }
115  catch (std::bad_cast const&) {
117  << "Unable to obtain correctly-typed product from wrapper.\n";
118  }
119 
120  auto rProd = std::make_unique<OProd>();
121  // False means don't want this in the event.
122  if (mixFunc_(inConverted, *rProd, remap)) {
123  if (!outputProduct_) {
125  << "Returned true (output product to be put in event) from a mix "
126  "function\n"
127  << "declared with outputProduct=false.\n";
128  }
129  e.put(std::move(rProd), outputInstanceLabel_);
130  }
131  }
bool const outputProduct_
Definition: MixOp.h:72
std::string const outputInstanceLabel_
Definition: MixOp.h:67
bool const compactMissingProducts_
Definition: MixOp.h:73
MixFunc< Prod, OProd > const mixFunc_
Definition: MixOp.h:69
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Float_t e
Definition: plot.C:35
template<typename Prod , typename OProd >
EDProduct const* art::MixOp< Prod, OProd >::newIncomingWrappedProduct ( ) const
inlineoverridevirtual
template<typename Prod , typename OProd >
ProductID art::MixOp< Prod, OProd >::outgoingProductID ( ) const
overridevirtual

Implements art::MixOpBase.

Definition at line 149 of file MixOp.h.

References art::canonicalProductName(), art::MixOp< Prod, OProd >::moduleLabel_, art::MixOp< Prod, OProd >::outputInstanceLabel_, art::MixOp< Prod, OProd >::outputProduct_, and art::MixOp< Prod, OProd >::processName_.

Referenced by art::MixOp< Prod, OProd >::newIncomingWrappedProduct().

150  {
151  ProductID result;
152  if (outputProduct_) {
153  TypeID const outputType{typeid(OProd)};
154  // Note: Outgoing product must be InEvent.
155  auto const productName =
156  canonicalProductName(outputType.friendlyClassName(),
157  moduleLabel_,
159  processName_);
160  result = ProductID{productName};
161  }
162  return result;
163  }
std::string const moduleLabel_
Definition: MixOp.h:71
bool const outputProduct_
Definition: MixOp.h:72
std::string const outputInstanceLabel_
Definition: MixOp.h:67
std::string canonicalProductName(std::string const &friendlyClassName, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName)
std::string const processName_
Definition: MixOp.h:70
template<typename Prod , typename OProd >
void art::MixOp< Prod, OProd >::setIncomingProductID ( ProductID  prodID)
overrideprivatevirtual

Implements art::MixOpBase.

Definition at line 135 of file MixOp.h.

References art::MixOp< Prod, OProd >::incomingProductID_.

Referenced by art::MixOp< Prod, OProd >::newIncomingWrappedProduct().

136  {
137  incomingProductID_ = prodID;
138  }
ProductID incomingProductID_
Definition: MixOp.h:75

Member Data Documentation

template<typename Prod , typename OProd >
BranchType const art::MixOp< Prod, OProd >::branchType_
private
template<typename Prod , typename OProd >
bool const art::MixOp< Prod, OProd >::compactMissingProducts_
private
template<typename Prod , typename OProd >
ProductID art::MixOp< Prod, OProd >::incomingProductID_ {ProductID::invalid()}
private
template<typename Prod , typename OProd >
InputTag const art::MixOp< Prod, OProd >::inputTag_
private

Definition at line 66 of file MixOp.h.

Referenced by art::MixOp< Prod, OProd >::inputTag().

template<typename Prod , typename OProd >
TypeID const art::MixOp< Prod, OProd >::inputType_
private
template<typename Prod , typename OProd >
MixFunc<Prod, OProd> const art::MixOp< Prod, OProd >::mixFunc_
private
template<typename Prod , typename OProd >
std::string const art::MixOp< Prod, OProd >::moduleLabel_
private
template<typename Prod , typename OProd >
std::string const art::MixOp< Prod, OProd >::outputInstanceLabel_
private
template<typename Prod , typename OProd >
bool const art::MixOp< Prod, OProd >::outputProduct_
private
template<typename Prod , typename OProd >
std::string const art::MixOp< Prod, OProd >::processName_
private

The documentation for this class was generated from the following file: