1 #ifndef FWCore_Framework_Event_h 2 #define FWCore_Framework_Event_h 46 #include <unordered_set> 48 #include <type_traits> 51 class testEventGetRefBeforePut;
56 class BranchDescription;
57 class ModuleCallingContext;
81 void setProducerCommon(
ProducerBase const* iProd, std::vector<BranchID>* previousParentage);
84 std::vector<BranchID>* previousParentage,
85 std::vector<BranchID>* gotBranchIDsFromAcquire =
nullptr);
88 std::vector<BranchID>* previousParentage,
89 std::vector<BranchID>& gotBranchIDsFromAcquire);
99 Run const& getRun()
const;
110 CacheIdentifier_t cacheIdentifier()
const;
112 template <
typename PROD>
116 template <
typename ELEMENT>
124 template <
typename PROD>
130 template <
typename PROD>
133 template <
typename PROD>
136 template <
typename PROD>
140 template <
typename PROD,
typename... Args>
143 template <
typename PROD,
typename... Args>
149 template <
typename PROD>
154 template <
typename PROD>
157 template <
typename PROD>
160 template <
typename PROD>
163 template <
typename PROD>
166 template <
typename PROD>
169 template <
typename PROD>
172 template <
typename PROD>
173 void getManyByType(std::vector<
Handle<PROD>>& results)
const;
175 template <
typename PROD>
178 template <
typename PROD>
181 template <
typename PROD>
184 template <
typename PROD>
188 template <
typename ELEMENT>
191 template <
typename ELEMENT>
196 template <
typename ELEMENT>
199 template <
typename ELEMENT>
202 template <
typename ELEMENT>
205 template <
typename ELEMENT>
208 template <
typename ELEMENT>
211 template <
typename ELEMENT>
219 void getAllProvenance(std::vector<Provenance const*>& provenances)
const;
224 void getAllStableProvenance(std::vector<StableProvenance const*>& provenances)
const;
244 provRecorder_.labelsForToken(iToken, oLabels);
247 typedef std::vector<edm::propagate_const<std::unique_ptr<WrapperBase>>>
ProductPtrVec;
253 friend class ::testEventGetRefBeforePut;
254 friend class ::testEvent;
261 BasicHandle getByLabelImpl(std::type_info
const& iWrapperType,
262 std::type_info
const& iProductType,
263 InputTag const& iTag)
const override;
268 template <
typename PROD>
271 template <
typename PROD,
typename... Args>
282 template <
typename T>
285 void commit_(std::vector<edm::ProductResolverIndex>
const& iShouldPut,
ParentageID* previousParentageId =
nullptr);
310 std::vector<BranchID>* previousBranchIDs_ =
nullptr;
311 std::vector<BranchID>* gotBranchIDsFromAcquire_ =
nullptr;
313 void addToGotBranchIDs(
Provenance const& prov)
const;
314 void addToGotBranchIDs(
BranchID const& branchID)
const;
317 mutable std::vector<std::shared_ptr<ViewBase>>
gotViews_;
325 template <
typename PROD>
329 result = convert_handle_check_type<PROD>(
std::move(bh));
337 template <
typename ELEMENT>
345 *whyFailed <<
"get View by ID failed: no product with ID = " << oid <<
"\n";
351 result = fillView_<ELEMENT>(bh);
355 template <
typename PROD>
360 maybe_inserter(product.get());
362 assert(index < putProducts().
size());
368 auto const& prodID = provRecorder_.getProductID(index);
372 template <
typename PROD>
374 if (
UNLIKELY(product.get() ==
nullptr)) {
379 auto index = provRecorder_.getPutTokenIndex(
TypeID(*product), productInstanceName);
383 template <
typename PROD>
395 template <
typename PROD>
406 provRecorder_.getTypeIDForPutTokenIndex(token.
index()));
412 template <
typename PROD,
typename... Args>
417 return emplaceImpl<PROD>(token.
index(), std::forward<Args>(
args)...);
420 template <
typename PROD,
typename... Args>
427 provRecorder_.getTypeIDForPutTokenIndex(token.
index()));
430 return emplaceImpl(token.
index(), std::forward<Args>(
args)...);
433 template <
typename PROD,
typename... Args>
435 assert(index < putProducts().
size());
442 maybe_inserter(&(wp->bareProduct()));
444 PROD
const*
prod = wp->product();
447 auto const& prodID = provRecorder_.getProductID(index);
451 template <
typename PROD>
453 auto index = provRecorder_.getPutTokenIndex(
TypeID{
typeid(
PROD)}, productInstanceName);
459 template <
typename PROD>
464 return RefProd<PROD>(provRecorder_.getProductID(token.
index()), provRecorder_.prodGetter());
467 template <
typename PROD>
474 provRecorder_.getTypeIDForPutTokenIndex(token.
index()));
476 return RefProd<PROD>(provRecorder_.getProductID(token.
index()), provRecorder_.prodGetter());
479 template <
typename PROD>
482 BasicHandle bh = provRecorder_.getByLabel_(
TypeID(
typeid(PROD)), tag, moduleCallingContext_);
483 result = convert_handle<PROD>(
std::move(bh));
490 template <
typename PROD>
494 TypeID(
typeid(PROD)), label, productInstanceName, emptyString_, moduleCallingContext_);
495 result = convert_handle<PROD>(
std::move(bh));
502 template <
typename PROD>
504 return getByLabel(label, emptyString_, result);
507 template <
typename PROD>
509 provRecorder_.getManyByType(results, moduleCallingContext_);
510 for (
typename std::vector<
Handle<PROD>>::const_iterator it = results.begin(), itEnd = results.end(); it != itEnd;
512 addToGotBranchIDs(*it->provenance());
516 template <
typename PROD>
520 result = convert_handle<PROD>(
std::move(bh));
527 template <
typename PROD>
531 result = convert_handle<PROD>(
std::move(bh));
538 template <
typename PROD>
547 template <
typename PROD>
556 template <
typename ELEMENT>
559 BasicHandle bh = provRecorder_.getMatchingSequenceByLabel_(
TypeID(
typeid(ELEMENT)), tag, moduleCallingContext_);
566 result = fillView_<ELEMENT>(bh);
570 template <
typename ELEMENT>
575 BasicHandle bh = provRecorder_.getMatchingSequenceByLabel_(
576 TypeID(
typeid(ELEMENT)), moduleLabel, productInstanceName, emptyString_, moduleCallingContext_);
583 result = fillView_<ELEMENT>(bh);
587 template <
typename ELEMENT>
589 return getByLabel(moduleLabel, emptyString_,
result);
592 template <
typename ELEMENT>
602 result = fillView_<ELEMENT>(bh);
606 template <
typename ELEMENT>
616 result = fillView_<ELEMENT>(bh);
620 template <
typename ELEMENT>
628 return fillView_<ELEMENT>(bh);
631 template <
typename ELEMENT>
636 return *fillView_<ELEMENT>(bh);
639 template <
typename ELEMENT>
641 std::vector<void const*> pointersToElements;
647 auto newview = std::make_shared<View<ELEMENT>>(pointersToElements, helpers, &(
productGetter()));
650 gotViews_.push_back(newview);
657 template <
typename T>
660 event.getByLabel(
tag, handle);
665 template <
typename T>
668 event.getByToken(token, handle);
673 template <
typename T>
675 return event.get(token);
680 #endif // FWCore_Framework_Event_h
void labelsForToken(EDGetToken const &iToken, ProductLabels &oLabels) const
std::shared_ptr< LuminosityBlock const > const luminosityBlock_
unsigned long CacheIdentifier_t
WrapperBase const * wrapper() const (true)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
EventAuxiliary const & eventAuxiliary() const override
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void throwOnPutOfUninitializedToken(char const *principalType, std::type_info const &productType)
BranchIDSet gotBranchIDs_
void getManyByType(std::vector< Handle< PROD >> &results) const
Provenance const * provenance() const (true)
EDProductGetter const * productGetter(std::atomic< void const * > const &iCache)
void fillView(ProductID const &id, std::vector< void const * > &view, FillViewHelperVector &helpers) const
ModuleCallingContext const * moduleCallingContext_
OrphanHandle< PROD > putImpl(EDPutToken::value_type token, std::unique_ptr< PROD > product)
std::vector< EventSelectionID > EventSelectionIDVector
ProductPtrVec const & putProducts() const
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&...args)
bool failedToGet() const (true)
void put(edm::Event &evt, double value, const char *instanceName)
std::vector< std::shared_ptr< ViewBase > > gotViews_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
ModuleCallingContext const * moduleCallingContext() const
bool isUninitialized() const
PrincipalGetAdapter provRecorder_
std::vector< bool > gotBranchIDsFromPrevious_
std::shared_ptr< HandleExceptionFactory > makeHandleExceptionFactory(T &&iFunctor)
std::shared_ptr< HandleExceptionFactory > const & whyFailedFactory() const (true)
bool get(ProductID const &oid, Handle< PROD > &result) const
void throwOnPutOfWrongType(std::type_info const &wrongType, TypeID const &rightType)
LuminosityBlock const & getLuminosityBlock() const
ProductPtrVec putProducts_
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
RefProd< PROD > getRefBeforePut()
void swap(HandleBase &other)
EventAuxiliary const & aux_
T const * product() const
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
static std::string const triggerResults("TriggerResults")
ProductPtrVec & putProducts()
bool isUninitialized() const
StreamID streamID() const
OrphanHandle< PROD > emplaceImpl(EDPutToken::value_type token, Args &&...args)
std::vector< edm::propagate_const< std::unique_ptr< WrapperBase > > > ProductPtrVec
static const std::string emptyString_
void throwOnPutOfNullProduct(char const *principalType, TypeID const &productType, std::string const &productInstanceName)
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
ProductID id() const (true)
std::unordered_set< BranchID::value_type > BranchIDSet
ParameterSet const & parameterSet(Provenance const &provenance)
Provenance const * provenance() const
Handle< View< ELEMENT > > fillView_(BasicHandle &bh) const