Public Member Functions | Private Member Functions | Private Attributes | List of all members
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
 
- Public Member Functions inherited from art::MixOpBase
virtual ~MixOpBase () noexcept=default
 

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 31 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 81 of file MixOp.h.

89  , outputInstanceLabel_{outputInstanceLabel}
90  , inputType_{typeid(Prod)}
91  , mixFunc_{mixFunc}
93  , moduleLabel_{moduleLabel}
94  , outputProduct_{outputProduct}
95  , compactMissingProducts_{compactMissingProducts}
96  , branchType_{bt}
97  {}
std::string const moduleLabel_
Definition: MixOp.h:72
BranchType const branchType_
Definition: MixOp.h:75
InputTag const & inputTag() const override
Definition: MixOp.h:43
bool const outputProduct_
Definition: MixOp.h:73
bt
Definition: tracks.py:83
std::string const outputInstanceLabel_
Definition: MixOp.h:68
InputTag const inputTag_
Definition: MixOp.h:67
bool const compactMissingProducts_
Definition: MixOp.h:74
std::string const processName_
Definition: MixOp.h:71
MixFunc< Prod, OProd > const mixFunc_
Definition: MixOp.h:70
std::string const & processName() const
Definition: Globals.cc:48
TypeID const inputType_
Definition: MixOp.h:69
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 168 of file MixOp.h.

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

Implements art::MixOpBase.

Definition at line 143 of file MixOp.h.

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

Implements art::MixOpBase.

Definition at line 43 of file MixOp.h.

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

Implements art::MixOpBase.

Definition at line 48 of file MixOp.h.

49  {
50  return inputType_;
51  }
TypeID const inputType_
Definition: MixOp.h:69
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 101 of file MixOp.h.

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

Implements art::MixOpBase.

Definition at line 53 of file MixOp.h.

54  {
55  return new Wrapper<Prod>{};
56  }
template<typename Prod , typename OProd >
ProductID art::MixOp< Prod, OProd >::outgoingProductID ( ) const
overridevirtual

Implements art::MixOpBase.

Definition at line 150 of file MixOp.h.

151  {
152  ProductID result;
153  if (outputProduct_) {
154  TypeID const outputType{typeid(OProd)};
155  // Note: Outgoing product must be InEvent.
156  auto const productName =
157  canonicalProductName(outputType.friendlyClassName(),
158  moduleLabel_,
160  processName_);
161  result = ProductID{productName};
162  }
163  return result;
164  }
std::string const moduleLabel_
Definition: MixOp.h:72
static QCString result
bool const outputProduct_
Definition: MixOp.h:73
std::string const outputInstanceLabel_
Definition: MixOp.h:68
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:71
template<typename Prod , typename OProd >
void art::MixOp< Prod, OProd >::setIncomingProductID ( ProductID  prodID)
overrideprivatevirtual

Implements art::MixOpBase.

Definition at line 136 of file MixOp.h.

137  {
138  incomingProductID_ = prodID;
139  }
ProductID incomingProductID_
Definition: MixOp.h:76

Member Data Documentation

template<typename Prod , typename OProd >
BranchType const art::MixOp< Prod, OProd >::branchType_
private

Definition at line 75 of file MixOp.h.

template<typename Prod , typename OProd >
bool const art::MixOp< Prod, OProd >::compactMissingProducts_
private

Definition at line 74 of file MixOp.h.

template<typename Prod , typename OProd >
ProductID art::MixOp< Prod, OProd >::incomingProductID_ {ProductID::invalid()}
private

Definition at line 76 of file MixOp.h.

template<typename Prod , typename OProd >
InputTag const art::MixOp< Prod, OProd >::inputTag_
private

Definition at line 67 of file MixOp.h.

template<typename Prod , typename OProd >
TypeID const art::MixOp< Prod, OProd >::inputType_
private

Definition at line 69 of file MixOp.h.

template<typename Prod , typename OProd >
MixFunc<Prod, OProd> const art::MixOp< Prod, OProd >::mixFunc_
private

Definition at line 70 of file MixOp.h.

template<typename Prod , typename OProd >
std::string const art::MixOp< Prod, OProd >::moduleLabel_
private

Definition at line 72 of file MixOp.h.

template<typename Prod , typename OProd >
std::string const art::MixOp< Prod, OProd >::outputInstanceLabel_
private

Definition at line 68 of file MixOp.h.

template<typename Prod , typename OProd >
bool const art::MixOp< Prod, OProd >::outputProduct_
private

Definition at line 73 of file MixOp.h.

template<typename Prod , typename OProd >
std::string const art::MixOp< Prod, OProd >::processName_
private

Definition at line 71 of file MixOp.h.


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