CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::ProductResolverBase edm::InputProductResolver edm::ProducedProductResolver edm::PuttableProductResolver edm::UnscheduledProductResolver

Public Types

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

Public Member Functions

virtual void connectTo (ProductResolverBase const &, Principal const *) overridefinal
 
 DataManagingProductResolver (std::shared_ptr< BranchDescription const > bd, ProductStatus iDefaultStatus)
 
virtual void resetProductData_ (bool deleteEarly) override
 
void resetStatus ()
 
template<bool callResolver, typename FUNC >
ProductResolverBase::Resolution resolveProductImpl (FUNC resolver) const
 
- Public Member Functions inherited from edm::ProductResolverBase
BranchDescription const & branchDescription () const
 
std::string const & moduleLabel () const
 
ProductResolverBaseoperator= (ProductResolverBase const &)=delete
 
void prefetchAsync (WaitingTask *waitTask, Principal const &principal, bool skipCurrentProcess, 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 putOrMergeProduct (std::unique_ptr< WrapperBase > edp) const
 
void putProduct (std::unique_ptr< WrapperBase > edp) const
 
void resetBranchDescription (std::shared_ptr< BranchDescription const > bd)
 
virtual void resetFailedFromThisProcess ()
 
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) const
 
void setProcessHistory (ProcessHistory const &ph)
 
void setProvenance (ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)
 
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

ProductStatus defaultStatus () const
 
template<bool callResolver, typename FUNC >
Resolution resolveProductImpl (FUNC resolver) const
 
void setFailedStatus () const
 
void setProduct (std::unique_ptr< WrapperBase > edp) const
 
ProductStatus status () const
 

Private Member Functions

virtual BranchDescription const & branchDescription_ () const overridefinal
 
void checkType (WrapperBase const &prod) const
 
ProductData const & getProductData () const
 
virtual bool isFromCurrentProcess () const =0
 
void mergeProduct (std::unique_ptr< WrapperBase > edp) const
 
virtual ProductProvenance const * productProvenancePtr_ () const overridefinal
 
virtual bool productResolved_ () const overridefinal
 
virtual bool productUnavailable_ () const overridefinal
 
virtual bool productWasDeleted_ () const overridefinal
 
virtual bool productWasFetchedAndIsValid_ (bool iSkipCurrentProcess) const overridefinal
 
virtual Provenance const * provenance_ () const overridefinal
 
virtual void putOrMergeProduct_ (std::unique_ptr< WrapperBase > prod) const overridefinal
 
virtual void resetBranchDescription_ (std::shared_ptr< BranchDescription const > bd) overridefinal
 
virtual std::string const & resolvedModuleLabel_ () const overridefinal
 
virtual void setProcessHistory_ (ProcessHistory const &ph) overridefinal
 
virtual void setProvenance_ (ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid) overridefinal
 
virtual bool singleProduct_ () const overridefinal
 
void throwProductDeletedException () const
 

Private Attributes

ProductStatus const defaultStatus_
 
ProductData productData_
 
std::atomic< ProductStatustheStatus_
 

Detailed Description

Definition at line 35 of file ProductResolvers.h.

Member Enumeration Documentation

Enumerator
ProductSet 
NotPut 
ResolveFailed 
ResolveNotRun 
ProductDeleted 

Definition at line 37 of file ProductResolvers.h.

37  {
38  ProductSet,
39  NotPut,
40  ResolveFailed,
41  ResolveNotRun,
42  ProductDeleted
43  };

Constructor & Destructor Documentation

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

Definition at line 45 of file ProductResolvers.h.

46  productData_(bd),
47  theStatus_(iDefaultStatus),
48  defaultStatus_(iDefaultStatus){}
ProductStatus const defaultStatus_
std::atomic< ProductStatus > theStatus_

Member Function Documentation

virtual BranchDescription const& edm::DataManagingProductResolver::branchDescription_ ( ) const
inlinefinaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 81 of file ProductResolvers.h.

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

81 {return *getProductData().branchDescription();}
std::shared_ptr< BranchDescription const > const & branchDescription() const
Definition: ProductData.h:26
ProductData const & getProductData() const
void edm::DataManagingProductResolver::checkType ( WrapperBase const &  prod) const
private

Definition at line 477 of file ProductResolvers.cc.

References edm::ProductResolverBase::branchDescription(), edm::BranchDescription::branchName(), edm::BranchDescription::className(), edm::WrapperBase::dynamicTypeInfo(), edm::errors::EventCorruption, Exception, and edm::BranchDescription::unwrappedTypeID().

Referenced by mergeProduct(), and setProduct().

477  {
478  // Check if the types match.
479  TypeID typeID(prod.dynamicTypeInfo());
480  if(typeID != branchDescription().unwrappedTypeID()) {
481  // Types do not match.
483  << "Product on branch " << branchDescription().branchName() << " is of wrong type.\n"
484  << "It is supposed to be of type " << branchDescription().className() << ".\n"
485  << "It is actually of type " << typeID.className() << ".\n";
486  }
487  }
std::string const & branchName() const
std::string const & className() const
TypeID unwrappedTypeID() const
BranchDescription const & branchDescription() const
void edm::DataManagingProductResolver::connectTo ( ProductResolverBase const &  iOther,
Principal const *   
)
finaloverridevirtual

Implements edm::ProductResolverBase.

Definition at line 459 of file ProductResolvers.cc.

References assert().

459  {
460  assert(false);
461  }
assert(m_qm.get())
ProductStatus edm::DataManagingProductResolver::defaultStatus ( ) const
inlineprotected
ProductData const& edm::DataManagingProductResolver::getProductData ( ) const
inlineprivate
virtual bool edm::DataManagingProductResolver::isFromCurrentProcess ( ) const
privatepure virtual
void edm::DataManagingProductResolver::mergeProduct ( std::unique_ptr< WrapperBase edp) const
private

Definition at line 77 of file ProductResolvers.cc.

References assert(), edm::ProductResolverBase::branchDescription(), checkType(), getProductData(), definitions::original, ProductSet, status(), and edm::ProductData::unsafe_wrapper().

Referenced by putOrMergeProduct_().

77  {
79  if(not iFrom) { return;}
80 
81  checkType(*iFrom);
82 
84  if(original->isMergeable()) {
85  original->mergeProduct(iFrom.get());
86  } else if(original->hasIsProductEqual()) {
87  if(!original->isProductEqual(iFrom.get())) {
88  auto const& bd = branchDescription();
89  edm::LogError("RunLumiMerging")
90  << "ProductResolver::mergeTheProduct\n"
91  << "Two run/lumi products for the same run/lumi which should be equal are not\n"
92  << "Using the first, ignoring the second\n"
93  << "className = " << bd.className() << "\n"
94  << "moduleLabel = " << bd.moduleLabel() << "\n"
95  << "instance = " << bd.productInstanceName() << "\n"
96  << "process = " << bd.processName() << "\n";
97  }
98  } else {
99  auto const& bd = branchDescription();
100  edm::LogWarning("RunLumiMerging")
101  << "ProductResolver::mergeTheProduct\n"
102  << "Run/lumi product has neither a mergeProduct nor isProductEqual function\n"
103  << "Using the first, ignoring the second in merge\n"
104  << "className = " << bd.className() << "\n"
105  << "moduleLabel = " << bd.moduleLabel() << "\n"
106  << "instance = " << bd.productInstanceName() << "\n"
107  << "process = " << bd.processName() << "\n";
108  }
109  }
void checkType(WrapperBase const &prod) const
list original
Definition: definitions.py:57
assert(m_qm.get())
ProductStatus status() const
BranchDescription const & branchDescription() const
ProductData const & getProductData() const
WrapperBase * unsafe_wrapper() const
Definition: ProductData.h:34
ProductProvenance const * edm::DataManagingProductResolver::productProvenancePtr_ ( ) const
finaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 547 of file ProductResolvers.cc.

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

547  {
548  return provenance()->productProvenance();
549  }
Provenance const * provenance() const
ProductProvenance const * productProvenance() const
Definition: Provenance.cc:31
bool edm::DataManagingProductResolver::productResolved_ ( ) const
finaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 513 of file ProductResolvers.cc.

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

513  {
514  auto s = status();
515  return (s != defaultStatus() ) or (s == ProductStatus::ProductDeleted);
516  }
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
ProductStatus status() const
ProductStatus defaultStatus() const
bool edm::DataManagingProductResolver::productUnavailable_ ( ) const
finaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 504 of file ProductResolvers.cc.

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

504  {
505  auto presentStatus = status();
506  if(presentStatus == ProductStatus::ProductSet) {
507  return !(getProductData().wrapper()->isPresent());
508  }
509  return presentStatus != ProductStatus::ResolveNotRun;
510  }
ProductStatus status() const
WrapperBase const * wrapper() const
Definition: ProductData.h:32
bool isPresent() const
Definition: WrapperBase.h:22
ProductData const & getProductData() const
bool edm::DataManagingProductResolver::productWasDeleted_ ( ) const
finaloverrideprivatevirtual
bool edm::DataManagingProductResolver::productWasFetchedAndIsValid_ ( bool  iSkipCurrentProcess) const
finaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 526 of file ProductResolvers.cc.

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

526  {
527  if (iSkipCurrentProcess and isFromCurrentProcess() ) {
528  return false;
529  }
531  if(getProductData().wrapper()->isPresent()) {
532  return true;
533  }
534  }
535  return false;
536  }
ProductStatus status() const
virtual bool isFromCurrentProcess() const =0
ProductData const & getProductData() const
static HepMC::HEPEVT_Wrapper wrapper
virtual Provenance const* edm::DataManagingProductResolver::provenance_ ( ) const
inlinefinaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 83 of file ProductResolvers.h.

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

83 {return &productData_.provenance();}
Provenance const & provenance() const
Definition: ProductData.h:30
void edm::DataManagingProductResolver::putOrMergeProduct_ ( std::unique_ptr< WrapperBase prod) const
finaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 464 of file ProductResolvers.cc.

References defaultStatus(), mergeProduct(), eostools::move(), edm::ProductResolverBase::putProduct(), and status().

464  {
465  if(not prod) {return;}
466  if(status() == defaultStatus()) {
467  //resolveProduct has not been called or it failed
468  putProduct(std::move(prod));
469  } else {
470  mergeProduct(std::move(prod));
471  }
472  }
ProductStatus status() const
void putProduct(std::unique_ptr< WrapperBase > edp) const
def move
Definition: eostools.py:510
void mergeProduct(std::unique_ptr< WrapperBase > edp) const
ProductStatus defaultStatus() const
virtual void edm::DataManagingProductResolver::resetBranchDescription_ ( std::shared_ptr< BranchDescription const >  bd)
inlinefinaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 82 of file ProductResolvers.h.

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

void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
Definition: ProductData.cc:27
void edm::DataManagingProductResolver::resetProductData_ ( bool  deleteEarly)
overridevirtual
void edm::DataManagingProductResolver::resetStatus ( )
inline

Definition at line 52 of file ProductResolvers.h.

References defaultStatus_, and theStatus_.

Referenced by resetProductData_().

ProductStatus const defaultStatus_
std::atomic< ProductStatus > theStatus_
virtual std::string const& edm::DataManagingProductResolver::resolvedModuleLabel_ ( ) const
inlinefinaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 85 of file ProductResolvers.h.

References edm::ProductResolverBase::moduleLabel().

85 {return moduleLabel();}
std::string const & moduleLabel() const
template<bool callResolver, typename FUNC >
ProductResolverBase::Resolution edm::DataManagingProductResolver::resolveProductImpl ( FUNC  resolver) const

Definition at line 43 of file ProductResolvers.cc.

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

43  {
44 
45  if(productWasDeleted()) {
47  }
48  auto presentStatus = status();
49 
50  if(callResolver && presentStatus == ProductStatus::ResolveNotRun) {
51  //if resolver fails because of exception or not setting product
52  // make sure the status goes to failed
53  auto failedStatusSetter = [this](ProductStatus* presentStatus) {
54  if(this->status() == ProductStatus::ResolveNotRun) {
55  this->setFailedStatus();
56  }
57  *presentStatus = this->status();
58  };
59  std::unique_ptr<ProductStatus, decltype(failedStatusSetter)> failedStatusGuard(&presentStatus, failedStatusSetter);
60 
61  //If successful, this will call setProduct
62  resolver();
63  }
64 
65 
66  if (presentStatus == ProductStatus::ProductSet) {
67  auto pd = &getProductData();
68  if(pd->wrapper()->isPresent()) {
69  return Resolution(pd);
70  }
71  }
72 
73  return Resolution(nullptr);
74  }
ProductStatus status() const
ProductData const & getProductData() const
template<bool callResolver, typename FUNC >
Resolution edm::DataManagingProductResolver::resolveProductImpl ( FUNC  resolver) const
protected
void edm::DataManagingProductResolver::setFailedStatus ( ) const
inlineprotected
void edm::DataManagingProductResolver::setProcessHistory_ ( ProcessHistory const &  ph)
finaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 543 of file ProductResolvers.cc.

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

543  {
545  }
void setProcessHistory(ProcessHistory const &ph)
Definition: ProductData.h:59
void edm::DataManagingProductResolver::setProduct ( std::unique_ptr< WrapperBase edp) const
protected
void edm::DataManagingProductResolver::setProvenance_ ( ProductProvenanceRetriever const *  provRetriever,
ProcessHistory const &  ph,
ProductID const &  pid 
)
finaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 539 of file ProductResolvers.cc.

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

539  {
540  productData_.setProvenance(provRetriever,ph,pid);
541  }
void setProvenance(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)
Definition: ProductData.h:63
tuple pid
Definition: sysUtil.py:22
bool edm::DataManagingProductResolver::singleProduct_ ( ) const
finaloverrideprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 562 of file ProductResolvers.cc.

562  {
563  return true;
564  }
ProductStatus edm::DataManagingProductResolver::status ( void  ) const
inlineprotected
void edm::DataManagingProductResolver::throwProductDeletedException ( ) const
private

Definition at line 27 of file ProductResolvers.cc.

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

Referenced by resolveProductImpl().

27  {
29  exception << "ProductResolverBase::resolveProduct_: The product matching all criteria was already deleted\n"
30  << "Looking for type: " << branchDescription().unwrappedTypeID() << "\n"
31  << "Looking for module label: " << moduleLabel() << "\n"
32  << "Looking for productInstanceName: " << productInstanceName() << "\n"
33  << (processName().empty() ? "" : "Looking for process: ") << processName() << "\n"
34  << "This means there is a configuration error.\n"
35  << "The module which is asking for this data must be configured to state that it will read this data.";
36  throw exception;
37 
38  }
std::string const & productInstanceName() const
std::string const & processName() const
TypeID unwrappedTypeID() const
BranchDescription const & branchDescription() const
std::string const & moduleLabel() const

Member Data Documentation

ProductStatus const edm::DataManagingProductResolver::defaultStatus_
private

Definition at line 93 of file ProductResolvers.h.

Referenced by defaultStatus(), and resetStatus().

ProductData edm::DataManagingProductResolver::productData_
private
std::atomic<ProductStatus> edm::DataManagingProductResolver::theStatus_
mutableprivate