CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions
edm::MergeableInputProductResolver Class Reference

#include <ProductResolvers.h>

Inheritance diagram for edm::MergeableInputProductResolver:
edm::DataManagingProductResolver edm::DataManagingOrAliasProductResolver edm::ProductResolverBase edm::DelayedReaderInputProductResolver edm::PutOnReadInputProductResolver

Public Member Functions

 MergeableInputProductResolver (std::shared_ptr< BranchDescription const > bd, ProductStatus iDefaultStatus)
 
- Public Member Functions inherited from edm::DataManagingProductResolver
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 mergeProduct (std::shared_ptr< WrapperBase > edp, MergeableRunProductMetadata const *) const
 
void setOrMergeProduct (std::shared_ptr< WrapperBase > prod, MergeableRunProductMetadata const *mergeableRunProductMetadata) const
 
- Protected Member Functions inherited from edm::DataManagingProductResolver
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
 

Additional Inherited Members

- Public Types inherited from edm::DataManagingProductResolver
enum  ProductStatus {
  ProductStatus::ProductSet, ProductStatus::NotPut, ProductStatus::ResolveFailed, ProductStatus::ResolveNotRun,
  ProductStatus::ProductDeleted
}
 

Detailed Description

Definition at line 105 of file ProductResolvers.h.

Constructor & Destructor Documentation

◆ MergeableInputProductResolver()

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

Definition at line 107 of file ProductResolvers.h.

108  : DataManagingProductResolver(bd, iDefaultStatus) {}

Member Function Documentation

◆ mergeProduct()

void edm::MergeableInputProductResolver::mergeProduct ( std::shared_ptr< WrapperBase edp,
MergeableRunProductMetadata const *  mergeableRunProductMetadata 
) const
protected

Definition at line 80 of file ProductResolvers.cc.

81  {
82  // if its not mergeable and the previous read failed, go ahead and use this one
84  setProduct(std::move(iFrom));
85  return;
86  }
87 
89  if (not iFrom) {
90  return;
91  }
92 
93  checkType(*iFrom);
94 
96  if (original->isMergeable()) {
97  if (original->isPresent() != iFrom->isPresent()) {
99  << "Merge of Run or Lumi product failed for branch " << branchDescription().branchName() << "\n"
100  << "Was trying to merge objects where one product had been put in the input file and the other had not "
101  "been."
102  << "\n"
103  << "The solution is to drop the branch on input. Or better do not create inconsistent files\n"
104  << "that need to be merged in the first place.\n";
105  }
106  if (original->isPresent()) {
107  BranchDescription const& desc = branchDescription();
108  if (mergeableRunProductMetadata == nullptr || desc.branchType() != InRun) {
109  original->mergeProduct(iFrom.get());
110  } else {
112  mergeableRunProductMetadata->getMergeDecision(desc.processName());
113  if (decision == MergeableRunProductMetadata::MERGE) {
114  original->mergeProduct(iFrom.get());
115  } else if (decision == MergeableRunProductMetadata::REPLACE) {
116  // Note this swaps the content of the product where the
117  // both products branches are present and the product is
118  // also present (was put) in the branch. A module might
119  // have already gotten a pointer to the product so we
120  // keep those pointers valid. This does not call swap
121  // on the Wrapper.
122  original->swapProduct(iFrom.get());
123  }
124  // If the decision is IGNORE, do nothing
125  }
126  }
127  // If both have isPresent false, do nothing
128 
129  } else if (original->hasIsProductEqual()) {
130  if (original->isPresent() && iFrom->isPresent()) {
131  if (!original->isProductEqual(iFrom.get())) {
132  auto const& bd = branchDescription();
133  edm::LogError("RunLumiMerging")
134  << "ProductResolver::mergeTheProduct\n"
135  << "Two run/lumi products for the same run/lumi which should be equal are not\n"
136  << "Using the first, ignoring the second\n"
137  << "className = " << bd.className() << "\n"
138  << "moduleLabel = " << bd.moduleLabel() << "\n"
139  << "instance = " << bd.productInstanceName() << "\n"
140  << "process = " << bd.processName() << "\n";
141  }
142  } else if (!original->isPresent() && iFrom->isPresent()) {
143  setProduct(std::move(iFrom));
144  }
145  // if not iFrom->isPresent(), do nothing
146  } else {
147  auto const& bd = branchDescription();
148  edm::LogWarning("RunLumiMerging") << "ProductResolver::mergeTheProduct\n"
149  << "Run/lumi product has neither a mergeProduct nor isProductEqual function\n"
150  << "Using the first, ignoring the second in merge\n"
151  << "className = " << bd.className() << "\n"
152  << "moduleLabel = " << bd.moduleLabel() << "\n"
153  << "instance = " << bd.productInstanceName() << "\n"
154  << "process = " << bd.processName() << "\n";
155  if (!original->isPresent() && iFrom->isPresent()) {
156  setProduct(std::move(iFrom));
157  }
158  // In other cases, do nothing
159  }
160  }

References cms::cuda::assert(), edm::ProductResolverBase::branchDescription(), edm::BranchDescription::branchName(), edm::DataManagingProductResolver::checkType(), submitPVResolutionJobs::desc, Exception, edm::MergeableRunProductMetadata::getMergeDecision(), edm::DataManagingProductResolver::getProductData(), edm::InRun, edm::MergeableRunProductMetadata::MERGE, edm::errors::MismatchedInputFiles, eostools::move(), definitions::original, edm::DataManagingProductResolver::ProductSet, edm::MergeableRunProductMetadata::REPLACE, edm::DataManagingProductResolver::ResolveFailed, edm::DataManagingProductResolver::setProduct(), edm::DataManagingProductResolver::status(), and edm::ProductData::unsafe_wrapper().

Referenced by setOrMergeProduct().

◆ setOrMergeProduct()

void edm::MergeableInputProductResolver::setOrMergeProduct ( std::shared_ptr< WrapperBase prod,
MergeableRunProductMetadata const *  mergeableRunProductMetadata 
) const
protected
edm::errors::MismatchedInputFiles
Definition: EDMException.h:52
edm::DataManagingProductResolver::DataManagingProductResolver
DataManagingProductResolver(std::shared_ptr< BranchDescription const > bd, ProductStatus iDefaultStatus)
Definition: ProductResolvers.h:53
edm::MergeableRunProductMetadata::MERGE
Definition: MergeableRunProductMetadata.h:54
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
cms::cuda::assert
assert(be >=bs)
edm::DataManagingProductResolver::defaultStatus
ProductStatus defaultStatus() const
Definition: ProductResolvers.h:69
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
edm::InRun
Definition: BranchType.h:11
edm::MergeableInputProductResolver::mergeProduct
void mergeProduct(std::shared_ptr< WrapperBase > edp, MergeableRunProductMetadata const *) const
Definition: ProductResolvers.cc:80
edm::DataManagingProductResolver::setProduct
void setProduct(std::unique_ptr< WrapperBase > edp) const
Definition: ProductResolvers.cc:527
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
edm::DataManagingProductResolver::ProductStatus::ProductSet
definitions.original
original
Definition: definitions.py:57
edm::MergeableRunProductMetadata::MergeDecision
MergeDecision
Definition: MergeableRunProductMetadata.h:54
edm::BranchDescription::branchName
std::string const & branchName() const
Definition: BranchDescription.h:120
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::DataManagingProductResolver::checkType
void checkType(WrapperBase const &prod) const
Definition: ProductResolvers.cc:515
edm::ProductData::unsafe_wrapper
WrapperBase * unsafe_wrapper() const
Definition: ProductData.h:36
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
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
Exception
Definition: hltDiff.cc:245
edm::MergeableRunProductMetadata::REPLACE
Definition: MergeableRunProductMetadata.h:54
edm::DataManagingProductResolver::ProductStatus::ResolveFailed