CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::DataManagingProductResolver Class Referenceabstract

#include <ProductResolvers.h>

Inheritance diagram for edm::DataManagingProductResolver:
edm::DataManagingOrAliasProductResolver edm::ProductResolverBase edm::MergeableInputProductResolver edm::ProducedProductResolver edm::DelayedReaderInputProductResolver edm::PutOnReadInputProductResolver edm::PuttableProductResolver edm::UnscheduledProductResolver

Public Types

enum  ProductStatus {
  ProductStatus::ProductSet, ProductStatus::NotPut, ProductStatus::ResolveFailed, ProductStatus::ResolveNotRun,
  ProductStatus::ProductDeleted
}
 

Public Member Functions

void connectTo (ProductResolverBase const &, Principal const *) final
 
 DataManagingProductResolver (std::shared_ptr< BranchDescription const > bd, ProductStatus iDefaultStatus)
 
void resetProductData_ (bool deleteEarly) override
 
void resetStatus ()
 
- Public Member Functions inherited from edm::DataManagingOrAliasProductResolver
 DataManagingOrAliasProductResolver ()
 
- Public Member Functions inherited from edm::ProductResolverBase
BranchDescription const & branchDescription () const
 
std::string const & moduleLabel () const
 
ProductResolverBaseoperator= (ProductResolverBase const &)=delete
 
void prefetchAsync (WaitingTaskHolder waitTask, Principal const &principal, bool skipCurrentProcess, ServiceToken const &token, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
std::string const & processName () const
 
ProductID const & productID () const
 
std::string const & productInstanceName () const
 
ProductProvenance const * productProvenancePtr () const
 
bool productResolved () const
 
 ProductResolverBase ()
 
 ProductResolverBase (ProductResolverBase const &)=delete
 
TypeID productType () const
 
bool productUnavailable () const
 
bool productWasDeleted () const
 
bool productWasFetchedAndIsValid (bool iSkipCurrentProcess) const
 
Provenance const * provenance () const
 
bool provenanceAvailable () const
 
void resetBranchDescription (std::shared_ptr< BranchDescription const > bd)
 
void resetProductData ()
 
std::string const & resolvedModuleLabel () const
 
Resolution resolveProduct (Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
void retrieveAndMerge (Principal const &principal, MergeableRunProductMetadata const *mergeableRunProductMetadata) const
 
void setMergeableRunProductMetadata (MergeableRunProductMetadata const *mrpm)
 
void setProductID (ProductID const &pid)
 
void setProductProvenanceRetriever (ProductProvenanceRetriever const *provRetriever)
 
virtual void setupUnscheduled (UnscheduledConfigurator const &)
 
bool singleProduct () const
 
StableProvenance const * stableProvenance () const
 
void unsafe_deleteProduct () const
 
bool unscheduledWasNotRun () const
 
void write (std::ostream &os) const
 
virtual ~ProductResolverBase ()
 

Protected Member Functions

void checkType (WrapperBase const &prod) const
 
ProductStatus defaultStatus () const
 
ProductData const & getProductData () const final
 
template<bool callResolver, typename FUNC >
ProductResolverBase::Resolution resolveProductImpl (FUNC resolver) const
 
template<bool callResolver, typename FUNC >
Resolution resolveProductImpl (FUNC resolver) const
 
void setFailedStatus () const
 
void setMergeableRunProductMetadataInProductData (MergeableRunProductMetadata const *)
 
void setProduct (std::shared_ptr< WrapperBase > edp) const
 
void setProduct (std::unique_ptr< WrapperBase > edp) const
 
ProductStatus status () const
 

Private Member Functions

BranchDescription const & branchDescription_ () const final
 
virtual bool isFromCurrentProcess () const =0
 
ProductProvenance const * productProvenancePtr_ () const final
 
bool productResolved_ () const final
 
bool productUnavailable_ () const final
 
bool productWasDeleted_ () const final
 
bool productWasFetchedAndIsValid_ (bool iSkipCurrentProcess) const final
 
Provenance const * provenance_ () const final
 
void resetBranchDescription_ (std::shared_ptr< BranchDescription const > bd) final
 
std::string const & resolvedModuleLabel_ () const final
 
void setProductID_ (ProductID const &pid) final
 
void setProductProvenanceRetriever_ (ProductProvenanceRetriever const *provRetriever) final
 
bool singleProduct_ () const final
 
void throwProductDeletedException () const
 

Private Attributes

const ProductStatus defaultStatus_
 
ProductData productData_
 
std::atomic< ProductStatustheStatus_
 

Detailed Description

Definition at line 49 of file ProductResolvers.h.

Member Enumeration Documentation

◆ ProductStatus

Enumerator
ProductSet 
NotPut 
ResolveFailed 
ResolveNotRun 
ProductDeleted 

Definition at line 51 of file ProductResolvers.h.

51 { ProductSet, NotPut, ResolveFailed, ResolveNotRun, ProductDeleted };

Constructor & Destructor Documentation

◆ DataManagingProductResolver()

edm::DataManagingProductResolver::DataManagingProductResolver ( std::shared_ptr< BranchDescription const >  bd,
ProductStatus  iDefaultStatus 
)
inline

Definition at line 53 of file ProductResolvers.h.

56  theStatus_(iDefaultStatus),
57  defaultStatus_(iDefaultStatus) {}

Member Function Documentation

◆ branchDescription_()

BranchDescription const& edm::DataManagingProductResolver::branchDescription_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 88 of file ProductResolvers.h.

88 { return *getProductData().branchDescription(); }

References edm::ProductData::branchDescription(), and getProductData().

◆ checkType()

void edm::DataManagingProductResolver::checkType ( WrapperBase const &  prod) const
protected

Definition at line 515 of file ProductResolvers.cc.

515  {
516  // Check if the types match.
517  TypeID typeID(prod.dynamicTypeInfo());
518  if (typeID != TypeID{branchDescription().unwrappedType().unvalidatedTypeInfo()}) {
519  // Types do not match.
521  << "Product on branch " << branchDescription().branchName() << " is of wrong type.\n"
522  << "It is supposed to be of type " << branchDescription().className() << ".\n"
523  << "It is actually of type " << typeID.className() << ".\n";
524  }
525  }

References edm::ProductResolverBase::branchDescription(), edm::BranchDescription::branchName(), edm::BranchDescription::className(), edm::errors::EventCorruption, Exception, dumpMFGeometry_cfg::prod, edm::TypeWithDict::unvalidatedTypeInfo(), and edm::BranchDescription::unwrappedType().

Referenced by edm::MergeableInputProductResolver::mergeProduct(), and setProduct().

◆ connectTo()

void edm::DataManagingProductResolver::connectTo ( ProductResolverBase const &  iOther,
Principal const *   
)
finalvirtual

Implements edm::ProductResolverBase.

Definition at line 513 of file ProductResolvers.cc.

513 { assert(false); }

References cms::cuda::assert().

◆ defaultStatus()

ProductStatus edm::DataManagingProductResolver::defaultStatus ( ) const
inlineprotected

◆ getProductData()

ProductData const& edm::DataManagingProductResolver::getProductData ( ) const
inlinefinalprotectedvirtual

◆ isFromCurrentProcess()

virtual bool edm::DataManagingProductResolver::isFromCurrentProcess ( ) const
privatepure virtual

◆ productProvenancePtr_()

ProductProvenance const * edm::DataManagingProductResolver::productProvenancePtr_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 588 of file ProductResolvers.cc.

588  {
589  return provenance()->productProvenance();
590  }

References edm::Provenance::productProvenance(), and edm::ProductResolverBase::provenance().

◆ productResolved_()

bool edm::DataManagingProductResolver::productResolved_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 557 of file ProductResolvers.cc.

557  {
558  auto s = status();
559  return (s != defaultStatus()) or (s == ProductStatus::ProductDeleted);
560  }

References defaultStatus(), or, ProductDeleted, alignCSCRings::s, and status().

◆ productUnavailable_()

bool edm::DataManagingProductResolver::productUnavailable_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 549 of file ProductResolvers.cc.

549  {
550  auto presentStatus = status();
551  if (presentStatus == ProductStatus::ProductSet) {
552  return !(getProductData().wrapper()->isPresent());
553  }
554  return presentStatus != ProductStatus::ResolveNotRun;
555  }

References getProductData(), edm::WrapperBase::isPresent(), ProductSet, ResolveNotRun, status(), and edm::ProductData::wrapper().

◆ productWasDeleted_()

bool edm::DataManagingProductResolver::productWasDeleted_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 563 of file ProductResolvers.cc.

563 { return status() == ProductStatus::ProductDeleted; }

References ProductDeleted, and status().

◆ productWasFetchedAndIsValid_()

bool edm::DataManagingProductResolver::productWasFetchedAndIsValid_ ( bool  iSkipCurrentProcess) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 565 of file ProductResolvers.cc.

565  {
566  if (iSkipCurrentProcess and isFromCurrentProcess()) {
567  return false;
568  }
570  if (getProductData().wrapper()->isPresent()) {
571  return true;
572  }
573  }
574  return false;
575  }

References getProductData(), isFromCurrentProcess(), ProductSet, status(), and wrapper.

◆ provenance_()

Provenance const* edm::DataManagingProductResolver::provenance_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 92 of file ProductResolvers.h.

92 { return &productData_.provenance(); }

References productData_, and edm::ProductData::provenance().

◆ resetBranchDescription_()

void edm::DataManagingProductResolver::resetBranchDescription_ ( std::shared_ptr< BranchDescription const >  bd)
inlinefinalprivatevirtual

◆ resetProductData_()

void edm::DataManagingProductResolver::resetProductData_ ( bool  deleteEarly)
overridevirtual

◆ resetStatus()

void edm::DataManagingProductResolver::resetStatus ( )
inline

Definition at line 61 of file ProductResolvers.h.

References defaultStatus_, and theStatus_.

Referenced by resetProductData_().

◆ resolvedModuleLabel_()

std::string const& edm::DataManagingProductResolver::resolvedModuleLabel_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 94 of file ProductResolvers.h.

94 { return moduleLabel(); }

References edm::ProductResolverBase::moduleLabel().

◆ resolveProductImpl() [1/2]

template<bool callResolver, typename FUNC >
ProductResolverBase::Resolution edm::DataManagingProductResolver::resolveProductImpl ( FUNC  resolver) const
protected

Definition at line 48 of file ProductResolvers.cc.

48  {
49  if (productWasDeleted()) {
51  }
52  auto presentStatus = status();
53 
54  if (callResolver && presentStatus == ProductStatus::ResolveNotRun) {
55  //if resolver fails because of exception or not setting product
56  // make sure the status goes to failed
57  auto failedStatusSetter = [this](ProductStatus* iPresentStatus) {
58  if (this->status() == ProductStatus::ResolveNotRun) {
59  this->setFailedStatus();
60  }
61  *iPresentStatus = this->status();
62  };
63  std::unique_ptr<ProductStatus, decltype(failedStatusSetter)> failedStatusGuard(&presentStatus,
64  failedStatusSetter);
65 
66  //If successful, this will call setProduct
67  resolver();
68  }
69 
70  if (presentStatus == ProductStatus::ProductSet) {
71  auto pd = &getProductData();
72  if (pd->wrapper()->isPresent()) {
73  return Resolution(pd);
74  }
75  }
76 
77  return Resolution(nullptr);
78  }

References getProductData(), ProductSet, edm::ProductResolverBase::productWasDeleted(), Resolution, ResolveNotRun, setFailedStatus(), status(), and throwProductDeletedException().

◆ resolveProductImpl() [2/2]

template<bool callResolver, typename FUNC >
Resolution edm::DataManagingProductResolver::resolveProductImpl ( FUNC  resolver) const
protected

◆ setFailedStatus()

void edm::DataManagingProductResolver::setFailedStatus ( ) const
inlineprotected

◆ setMergeableRunProductMetadataInProductData()

void edm::DataManagingProductResolver::setMergeableRunProductMetadataInProductData ( MergeableRunProductMetadata const *  mrpm)
protected

◆ setProduct() [1/2]

void edm::DataManagingProductResolver::setProduct ( std::shared_ptr< WrapperBase edp) const
protected

Definition at line 536 of file ProductResolvers.cc.

536  {
537  if (edp) {
538  checkType(*edp);
541  } else {
542  setFailedStatus();
543  }
544  }

References checkType(), eostools::move(), productData_, ProductSet, setFailedStatus(), theStatus_, and edm::ProductData::unsafe_setWrapper().

◆ setProduct() [2/2]

void edm::DataManagingProductResolver::setProduct ( std::unique_ptr< WrapperBase edp) const
protected

◆ setProductID_()

void edm::DataManagingProductResolver::setProductID_ ( ProductID const &  pid)
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 581 of file ProductResolvers.cc.

581 { productData_.setProductID(pid); }

References productData_, and edm::ProductData::setProductID().

◆ setProductProvenanceRetriever_()

void edm::DataManagingProductResolver::setProductProvenanceRetriever_ ( ProductProvenanceRetriever const *  provRetriever)
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 577 of file ProductResolvers.cc.

577  {
578  productData_.setProvenance(provRetriever);
579  }

References productData_, and edm::ProductData::setProvenance().

◆ singleProduct_()

bool edm::DataManagingProductResolver::singleProduct_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 603 of file ProductResolvers.cc.

603 { return true; }

◆ status()

ProductStatus edm::DataManagingProductResolver::status ( void  ) const
inlineprotected

◆ throwProductDeletedException()

void edm::DataManagingProductResolver::throwProductDeletedException ( ) const
private

Definition at line 34 of file ProductResolvers.cc.

34  {
36  exception << "DataManagingProductResolver::resolveProduct_: The product matching all criteria was already deleted\n"
37  << "Looking for type: " << branchDescription().unwrappedTypeID() << "\n"
38  << "Looking for module label: " << moduleLabel() << "\n"
39  << "Looking for productInstanceName: " << productInstanceName() << "\n"
40  << (processName().empty() ? "" : "Looking for process: ") << processName() << "\n"
41  << "This means there is a configuration error.\n"
42  << "The module which is asking for this data must be configured to state that it will read this data.";
43  throw exception;
44  }

References edm::ProductResolverBase::branchDescription(), cppFunctionSkipper::exception, edm::ProductResolverBase::moduleLabel(), edm::ProductResolverBase::processName(), edm::ProductResolverBase::productInstanceName(), and edm::BranchDescription::unwrappedTypeID().

Referenced by resolveProductImpl().

Member Data Documentation

◆ defaultStatus_

const ProductStatus edm::DataManagingProductResolver::defaultStatus_
private

Definition at line 102 of file ProductResolvers.h.

Referenced by defaultStatus(), and resetStatus().

◆ productData_

ProductData edm::DataManagingProductResolver::productData_
private

◆ theStatus_

std::atomic<ProductStatus> edm::DataManagingProductResolver::theStatus_
mutableprivate
edm::ProductResolverBase::provenance
Provenance const * provenance() const
Definition: ProductResolverBase.cc:31
edm::DataManagingOrAliasProductResolver::DataManagingOrAliasProductResolver
DataManagingOrAliasProductResolver()
Definition: ProductResolvers.h:42
edm::BranchDescription::unwrappedType
TypeWithDict const & unwrappedType() const
Definition: BranchDescription.h:95
edm::ProductData::wrapper
WrapperBase const * wrapper() const
Definition: ProductData.h:35
edm::TypeWithDict::unvalidatedTypeInfo
std::type_info const & unvalidatedTypeInfo() const
Definition: TypeWithDict.h:81
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
edm::Provenance::productProvenance
ProductProvenance const * productProvenance() const
Definition: Provenance.cc:24
edm::errors::EventCorruption
Definition: EDMException.h:43
edm::DataManagingProductResolver::theStatus_
std::atomic< ProductStatus > theStatus_
Definition: ProductResolvers.h:101
cms::cuda::assert
assert(be >=bs)
edm::DataManagingProductResolver::ProductStatus::ProductDeleted
wrapper
static HepMC::HEPEVT_Wrapper wrapper
Definition: BeamHaloProducer.cc:47
edm::DataManagingProductResolver::defaultStatus_
const ProductStatus defaultStatus_
Definition: ProductResolvers.h:102
edm::DataManagingProductResolver::defaultStatus
ProductStatus defaultStatus() const
Definition: ProductResolvers.h:69
edm::ProductData::provenance
Provenance const & provenance() const
Definition: ProductData.h:33
edm::DataManagingProductResolver::productData_
ProductData productData_
Definition: ProductResolvers.h:100
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::ProductData::resetBranchDescription
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
Definition: ProductData.cc:20
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
edm::ProductResolverBase::processName
std::string const & processName() const
Definition: ProductResolverBase.h:130
edm::BranchDescription::unwrappedTypeID
TypeID unwrappedTypeID() const
Definition: BranchDescription.h:98
edm::DataManagingProductResolver::throwProductDeletedException
void throwProductDeletedException() const
Definition: ProductResolvers.cc:34
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
Resolution
Definition: trackSplitPlot.h:33
edm::ProductData::setProvenance
void setProvenance(ProductProvenanceRetriever const *provRetriever)
Definition: ProductData.h:56
edm::DataManagingProductResolver::ProductStatus
ProductStatus
Definition: ProductResolvers.h:51
edm::DataManagingProductResolver::ProductStatus::ProductSet
edm::DataManagingProductResolver::ProductStatus::ResolveNotRun
edm::BranchDescription::branchName
std::string const & branchName() const
Definition: BranchDescription.h:120
edm::ProductResolverBase::moduleLabel
std::string const & moduleLabel() const
Definition: ProductResolverBase.h:119
cms::cuda::device::unique_ptr
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
Definition: device_unique_ptr.h:33
ProductDeletedException
edm::DataManagingProductResolver::checkType
void checkType(WrapperBase const &prod) const
Definition: ProductResolvers.cc:515
edm::DataManagingProductResolver::status
ProductStatus status() const
Definition: ProductResolvers.h:68
edm::DataManagingProductResolver::getProductData
ProductData const & getProductData() const final
Definition: ProductResolvers.h:74
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ProductResolverBase::branchDescription
BranchDescription const & branchDescription() const
Definition: ProductResolverBase.h:110
edm::WrapperBase::isPresent
bool isPresent() const
Definition: WrapperBase.h:30
edm::ProductData::setMergeableRunProductMetadata
void setMergeableRunProductMetadata(MergeableRunProductMetadataBase const *mrpm)
Definition: ProductData.h:60
edm::ProductData::branchDescription
std::shared_ptr< BranchDescription const > const & branchDescription() const
Definition: ProductData.h:29
Exception
Definition: hltDiff.cc:245
edm::DataManagingProductResolver::setFailedStatus
void setFailedStatus() const
Definition: ProductResolvers.h:70
edm::ProductResolverBase::productWasDeleted
bool productWasDeleted() const
Definition: ProductResolverBase.h:100
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::DataManagingProductResolver::resetStatus
void resetStatus()
Definition: ProductResolvers.h:61
edm::BranchDescription::className
std::string const & className() const
Definition: BranchDescription.h:79
edm::ProductResolverBase::productInstanceName
std::string const & productInstanceName() const
Definition: ProductResolverBase.h:127
edm::ProductData::resetProductData
void resetProductData()
Definition: ProductData.h:52
edm::ProductData::setProductID
void setProductID(ProductID const &pid)
Definition: ProductData.h:58
edm::DataManagingProductResolver::isFromCurrentProcess
virtual bool isFromCurrentProcess() const =0
edm::DataManagingProductResolver::ProductStatus::ResolveFailed
edm::ProductData::unsafe_setWrapper
void unsafe_setWrapper(std::unique_ptr< WrapperBase > iValue) const
Definition: ProductData.cc:27