CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
edm::ProductProvenanceLookup Class Referenceabstract

#include <ProductProvenanceLookup.h>

Inheritance diagram for edm::ProductProvenanceLookup:
edm::ProductProvenanceRetriever

Classes

class  ProducedProvenanceInfo
 

Public Member Functions

ProductProvenance const * branchIDToProvenance (BranchID const &bid) const
 
ProductProvenance const * branchIDToProvenanceForProducedOnly (BranchID const &bid) const
 
void insertIntoSet (ProductProvenance provenanceProduct) const
 
ProductProvenanceLookupoperator= (ProductProvenanceLookup const &)=delete
 
 ProductProvenanceLookup ()
 
 ProductProvenanceLookup (edm::ProductRegistry const &)
 
void update (edm::ProductRegistry const &)
 
virtual ~ProductProvenanceLookup ()
 

Protected Member Functions

virtual const
ProductProvenanceLookup
nextRetriever () const =0
 
virtual std::unique_ptr< const
std::set< ProductProvenance > > 
readProvenance () const =0
 

Protected Attributes

std::vector
< ProducedProvenanceInfo
entryInfoSet_
 
edm::propagate_const
< ProductProvenanceLookup
const * > 
parentProcessRetriever_
 
std::atomic< const std::set
< ProductProvenance > * > 
readEntryInfoSet_
 

Private Member Functions

void setupEntryInfoSet (edm::ProductRegistry const &)
 

Detailed Description

Definition at line 27 of file ProductProvenanceLookup.h.

Constructor & Destructor Documentation

edm::ProductProvenanceLookup::ProductProvenanceLookup ( )

Definition at line 12 of file ProductProvenanceLookup.cc.

std::atomic< const std::set< ProductProvenance > * > readEntryInfoSet_
edm::propagate_const< ProductProvenanceLookup const * > parentProcessRetriever_
std::vector< ProducedProvenanceInfo > entryInfoSet_
edm::ProductProvenanceLookup::ProductProvenanceLookup ( edm::ProductRegistry const &  iReg)
explicit

Definition at line 15 of file ProductProvenanceLookup.cc.

References setupEntryInfoSet().

17  setupEntryInfoSet(iReg);
18  }
std::atomic< const std::set< ProductProvenance > * > readEntryInfoSet_
edm::propagate_const< ProductProvenanceLookup const * > parentProcessRetriever_
std::vector< ProducedProvenanceInfo > entryInfoSet_
void setupEntryInfoSet(edm::ProductRegistry const &)
edm::ProductProvenanceLookup::~ProductProvenanceLookup ( )
virtual

Definition at line 20 of file ProductProvenanceLookup.cc.

References readEntryInfoSet_.

20 { delete readEntryInfoSet_.load(); }
std::atomic< const std::set< ProductProvenance > * > readEntryInfoSet_

Member Function Documentation

ProductProvenance const * edm::ProductProvenanceLookup::branchIDToProvenance ( BranchID const &  bid) const

Definition at line 59 of file ProductProvenanceLookup.cc.

References entryInfoSet_, cuda_std::lower_bound(), nextRetriever(), AlCaHLTBitMon_ParallelJobs::p, parentProcessRetriever_, readEntryInfoSet_, and readProvenance().

Referenced by edm::RootOutputFile::fillBranches(), edm::RootOutputFile::insertAncestors(), edm::Provenance::productProvenance(), and edm::ParentProcessProductResolver::productProvenancePtr_().

59  {
60  auto itFound = std::lower_bound(
61  entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) {
62  return iEntry.branchID() < iValue;
63  });
64  if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) {
65  if (auto p = itFound->productProvenance()) {
66  return p;
67  }
68  }
70  return parentProcessRetriever_->branchIDToProvenance(bid);
71  }
72  //check in source
73  if (nullptr == readEntryInfoSet_.load()) {
74  auto readProv = readProvenance();
75  std::set<ProductProvenance> const* expected = nullptr;
76  if (readEntryInfoSet_.compare_exchange_strong(expected, readProv.get())) {
77  readProv.release();
78  }
79  }
80  auto ptr = readEntryInfoSet_.load();
81  if (ptr) {
82  ProductProvenance ei(bid);
83  auto itRead = ptr->find(ei);
84  if (itRead != ptr->end()) {
85  return &*itRead;
86  }
87  }
88  auto nr = nextRetriever();
89  if (nr) {
90  return nr->branchIDToProvenance(bid);
91  }
92  return nullptr;
93  }
virtual std::unique_ptr< const std::set< ProductProvenance > > readProvenance() const =0
std::atomic< const std::set< ProductProvenance > * > readEntryInfoSet_
virtual const ProductProvenanceLookup * nextRetriever() const =0
edm::propagate_const< ProductProvenanceLookup const * > parentProcessRetriever_
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
std::vector< ProducedProvenanceInfo > entryInfoSet_
ProductProvenance const * edm::ProductProvenanceLookup::branchIDToProvenanceForProducedOnly ( BranchID const &  bid) const

Definition at line 95 of file ProductProvenanceLookup.cc.

References entryInfoSet_, cuda_std::lower_bound(), nextRetriever(), AlCaHLTBitMon_ParallelJobs::p, and parentProcessRetriever_.

Referenced by edm::PoolOutputModule::updateBranchParentsForOneBranch().

95  {
96  auto itFound = std::lower_bound(
97  entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) {
98  return iEntry.branchID() < iValue;
99  });
100  if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) {
101  if (auto p = itFound->productProvenance()) {
102  return p;
103  }
104  }
106  return parentProcessRetriever_->branchIDToProvenanceForProducedOnly(bid);
107  }
108  auto nr = nextRetriever();
109  if (nr) {
110  return nr->branchIDToProvenanceForProducedOnly(bid);
111  }
112  return nullptr;
113  }
virtual const ProductProvenanceLookup * nextRetriever() const =0
edm::propagate_const< ProductProvenanceLookup const * > parentProcessRetriever_
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
std::vector< ProducedProvenanceInfo > entryInfoSet_
void edm::ProductProvenanceLookup::insertIntoSet ( ProductProvenance  provenanceProduct) const

Definition at line 42 of file ProductProvenanceLookup.cc.

References edm::ProductProvenance::branchID(), entryInfoSet_, Exception, edm::BranchID::id(), edm::errors::LogicError, cuda_std::lower_bound(), edm::ProductProvenance::moveParentageID(), or, and UNLIKELY.

Referenced by edm::EventPrincipal::put(), edm::EventPrincipal::putOnRead(), and edm::SwitchBaseProductResolver::unsafe_setWrapperAndProvenance().

42  {
43  //NOTE:do not read provenance here because we only need the full
44  // provenance when someone tries to access it not when doing the insert
45  // doing the delay saves 20% of time when doing an analysis job
46  //readProvenance();
47  auto itFound =
49  entryInfoSet_.end(),
50  entryInfo.branchID(),
51  [](auto const& iEntry, edm::BranchID const& iValue) { return iEntry.branchID() < iValue; });
52  if UNLIKELY (itFound == entryInfoSet_.end() or itFound->branchID() != entryInfo.branchID()) {
53  throw edm::Exception(edm::errors::LogicError) << "ProductProvenanceLookup::insertIntoSet passed a BranchID "
54  << entryInfo.branchID().id() << " that has not been pre-registered";
55  }
56  itFound->threadsafe_set(entryInfo.moveParentageID());
57  }
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
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
#define UNLIKELY(x)
Definition: Likely.h:21
std::vector< ProducedProvenanceInfo > entryInfoSet_
virtual const ProductProvenanceLookup* edm::ProductProvenanceLookup::nextRetriever ( ) const
protectedpure virtual
ProductProvenanceLookup& edm::ProductProvenanceLookup::operator= ( ProductProvenanceLookup const &  )
delete
virtual std::unique_ptr<const std::set<ProductProvenance> > edm::ProductProvenanceLookup::readProvenance ( ) const
protectedpure virtual
void edm::ProductProvenanceLookup::setupEntryInfoSet ( edm::ProductRegistry const &  iReg)
private

Definition at line 22 of file ProductProvenanceLookup.cc.

References b, entryInfoSet_, edm::InEvent, or, AlCaHLTBitMon_ParallelJobs::p, and edm::ProductRegistry::productList().

Referenced by ProductProvenanceLookup(), and update().

22  {
23  std::set<BranchID> ids;
24  for (auto const& p : iReg.productList()) {
25  if (p.second.branchType() == edm::InEvent) {
26  if (p.second.produced() or p.second.isProvenanceSetOnRead()) {
27  ids.insert(p.second.branchID());
28  }
29  }
30  }
31  entryInfoSet_.reserve(ids.size());
32  for (auto const& b : ids) {
33  entryInfoSet_.emplace_back(b);
34  }
35  }
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
double b
Definition: hdecay.h:118
std::vector< ProducedProvenanceInfo > entryInfoSet_
void edm::ProductProvenanceLookup::update ( edm::ProductRegistry const &  iReg)

Member Data Documentation

std::vector<ProducedProvenanceInfo> edm::ProductProvenanceLookup::entryInfoSet_
protected
edm::propagate_const<ProductProvenanceLookup const*> edm::ProductProvenanceLookup::parentProcessRetriever_
protected
std::atomic<const std::set<ProductProvenance>*> edm::ProductProvenanceLookup::readEntryInfoSet_
mutableprotected