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 Types | Private Member Functions | Private Attributes | Static Private Attributes
edm::Principal Class Referenceabstract

#include <Principal.h>

Inheritance diagram for edm::Principal:
edm::EDProductGetter edm::EventPrincipal edm::LuminosityBlockPrincipal edm::RunPrincipal

Public Types

typedef std::vector< BasicHandleBasicHandleVec
 
typedef boost::filter_iterator
< FilledGroupPtr,
GroupCollection::const_iterator > 
const_iterator
 
typedef Group const * ConstGroupPtr
 
typedef std::vector
< boost::shared_ptr< Group > > 
GroupCollection
 
typedef std::string ProcessName
 
typedef
ProcessHistory::const_iterator 
ProcessNameConstIterator
 
typedef boost::shared_ptr< GroupSharedGroupPtr
 
typedef GroupCollection::size_type size_type
 

Public Member Functions

void addGroupInput (boost::shared_ptr< ConstBranchDescription > bd)
 
void addGroupScheduled (boost::shared_ptr< ConstBranchDescription > bd)
 
void addGroupSource (boost::shared_ptr< ConstBranchDescription > bd)
 
void addOnDemandGroup (boost::shared_ptr< ConstBranchDescription > bd)
 
void adjustIndexesAfterProductRegistryAddition ()
 
bool adjustToNewProductRegistry (ProductRegistry const &reg)
 
const_iterator begin () const
 
BranchType const & branchType () const
 
void clearPrincipal ()
 
void deleteProduct (BranchID const &id)
 
const_iterator end () const
 
void fillPrincipal (ProcessHistoryID const &hist, DelayedReader *reader)
 
ProductData const * findGroupByTag (TypeID const &typeID, InputTag const &tag) const
 
void getAllProvenance (std::vector< Provenance const * > &provenances) const
 
BasicHandle getByLabel (TypeID const &tid, std::string const &label, std::string const &productInstanceName, std::string const &processName, size_t &cachedOffset, int &fillCount) const
 
BasicHandle getBySelector (TypeID const &tid, SelectorBase const &s) const
 
BasicHandle getByType (TypeID const &tid) const
 
OutputHandle getForOutput (BranchID const &bid, bool getProd) const
 
ConstGroupPtr getGroup (BranchID const &oid, bool resolveProd, bool fillOnDemand) const
 
void getMany (TypeID const &tid, SelectorBase const &, BasicHandleVec &results) const
 
void getManyByType (TypeID const &tid, BasicHandleVec &results) const
 
size_t getMatchingSequence (TypeID const &typeID, SelectorBase const &selector, BasicHandle &result) const
 
Provenance getProvenance (BranchID const &bid) const
 
void maybeFlushCache (TypeID const &tid, InputTag const &tag) const
 
 Principal (boost::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc, BranchType bt, HistoryAppender *historyAppender)
 
ProcessConfiguration const & processConfiguration () const
 
ProcessHistory const & processHistory () const
 
ProcessHistoryID const & processHistoryID () const
 
EDProductGetter const * prodGetter () const
 
ProductRegistry const & productRegistry () const
 
DelayedReaderreader () const
 
void recombine (Principal &other, std::vector< BranchID > const &bids)
 
size_t size () const
 
virtual ~Principal ()
 
- Public Member Functions inherited from edm::EDProductGetter
 EDProductGetter ()
 
virtual ~EDProductGetter ()
 

Protected Member Functions

void addGroup_ (std::auto_ptr< Group > g)
 
void addGroupOrThrow (std::auto_ptr< Group > g)
 
void checkUniquenessAndType (WrapperOwningHolder const &prod, Group const *group) const
 
GroupgetExistingGroup (BranchID const &branchID)
 
GroupgetExistingGroup (Group const &g)
 
ConstGroupPtr getGroupByIndex (ProductTransientIndex const &oid, bool resolveProd, bool fillOnDemand) const
 
void putOrMerge (WrapperOwningHolder const &prod, Group const *group) const
 
void putOrMerge (WrapperOwningHolder const &prod, ProductProvenance &prov, Group *group)
 
void resolveProduct (Group const &g, bool fillOnDemand) const
 

Private Types

typedef TransientProductLookupMap TypeLookup
 

Private Member Functions

size_t findGroup (TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandle &result) const
 
ProductData const * findGroupByLabel (TypeID const &typeID, TypeLookup const &typeLookup, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, size_t &cachedOffset, int &fillCount) const
 
size_t findGroups (TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandleVec &results) const
 
virtual WrapperHolder getIt (ProductID const &) const
 
virtual void resolveProduct_ (Group const &, bool) const
 
virtual bool unscheduledFill (std::string const &moduleLabel) const =0
 

Private Attributes

BranchType branchType_
 
GroupCollection groups_
 
HistoryAppenderhistoryAppender_
 
boost::shared_ptr
< ProductRegistry const > 
preg_
 
ProcessConfiguration const * processConfiguration_
 
ProcessHistoryID processHistoryID_
 
ProcessHistory const * processHistoryPtr_
 
std::set< void const * > productPtrs_
 
DelayedReaderreader_
 

Static Private Attributes

static ProcessHistory emptyProcessHistory_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProductGetter
static void assignEDProductGetter (EDProductGetter const *&)
 
static EDProductGetter const * switchProductGetter (EDProductGetter const *)
 These can only be used internally by the framework. More...
 

Detailed Description

Definition at line 52 of file Principal.h.

Member Typedef Documentation

Definition at line 58 of file Principal.h.

typedef boost::filter_iterator<FilledGroupPtr, GroupCollection::const_iterator> edm::Principal::const_iterator

Definition at line 55 of file Principal.h.

Definition at line 57 of file Principal.h.

typedef std::vector<boost::shared_ptr<Group> > edm::Principal::GroupCollection

Definition at line 54 of file Principal.h.

typedef std::string edm::Principal::ProcessName

Definition at line 62 of file Principal.h.

Definition at line 56 of file Principal.h.

typedef boost::shared_ptr<Group> edm::Principal::SharedGroupPtr

Definition at line 61 of file Principal.h.

typedef GroupCollection::size_type edm::Principal::size_type

Definition at line 59 of file Principal.h.

Definition at line 193 of file Principal.h.

Constructor & Destructor Documentation

edm::Principal::Principal ( boost::shared_ptr< ProductRegistry const >  reg,
ProcessConfiguration const &  pc,
BranchType  bt,
HistoryAppender historyAppender 
)

Definition at line 99 of file Principal.cc.

References addGroupInput(), addGroupScheduled(), addGroupSource(), addOnDemandGroup(), branchType_, edm::InEvent, and LaserTracksInput_cfi::source.

102  :
103  EDProductGetter(),
107  groups_(reg->constProductList().size(), SharedGroupPtr()),
108  preg_(reg),
109  reader_(),
110  productPtrs_(),
111  branchType_(bt),
112  historyAppender_(historyAppender) {
113 
114  //Now that these have been set, we can create the list of Branches we need.
115  std::string const source("source");
116  ProductRegistry::ProductList const& prodsList = reg->productList();
117  for(ProductRegistry::ProductList::const_iterator itProdInfo = prodsList.begin(),
118  itProdInfoEnd = prodsList.end();
119  itProdInfo != itProdInfoEnd;
120  ++itProdInfo) {
121  if(itProdInfo->second.branchType() == branchType_) {
122  boost::shared_ptr<ConstBranchDescription> bd(new ConstBranchDescription(itProdInfo->second));
123  if(bd->produced()) {
124  if(bd->moduleLabel() == source) {
125  addGroupSource(bd);
126  } else if(bd->onDemand()) {
127  assert(bt == InEvent);
128  addOnDemandGroup(bd);
129  } else {
130  addGroupScheduled(bd);
131  }
132  } else {
133  addGroupInput(bd);
134  }
135  }
136  }
137  }
BranchType branchType_
Definition: Principal.h:236
void addGroupScheduled(boost::shared_ptr< ConstBranchDescription > bd)
Definition: Principal.cc:181
DelayedReader * reader_
Definition: Principal.h:231
HistoryAppender * historyAppender_
Definition: Principal.h:241
std::map< BranchKey, BranchDescription > ProductList
ProcessHistoryID processHistoryID_
Definition: Principal.h:218
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
ProcessHistory const * processHistoryPtr_
Definition: Principal.h:216
void addGroupSource(boost::shared_ptr< ConstBranchDescription > bd)
Definition: Principal.cc:187
GroupCollection groups_
Definition: Principal.h:223
boost::shared_ptr< Group > SharedGroupPtr
Definition: Principal.h:61
std::set< void const * > productPtrs_
Definition: Principal.h:234
void addGroupInput(boost::shared_ptr< ConstBranchDescription > bd)
Definition: Principal.cc:193
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:220
void addOnDemandGroup(boost::shared_ptr< ConstBranchDescription > bd)
Definition: Principal.cc:199
edm::Principal::~Principal ( )
virtual

Definition at line 139 of file Principal.cc.

139  {
140  }

Member Function Documentation

void edm::Principal::addGroup_ ( std::auto_ptr< Group g)
protected

Definition at line 282 of file Principal.cc.

References edm::ConstBranchDescription::branchID(), edm::ConstBranchDescription::className(), edm::ConstBranchDescription::friendlyClassName(), g, groups_, getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, edm::ConstBranchDescription::moduleLabel(), preg_, and edm::ConstBranchDescription::processName().

Referenced by addGroupOrThrow().

282  {
283  ConstBranchDescription const& bd = group->branchDescription();
284  assert (!bd.className().empty());
285  assert (!bd.friendlyClassName().empty());
286  assert (!bd.moduleLabel().empty());
287  assert (!bd.processName().empty());
288  SharedGroupPtr g(group);
289 
290  ProductTransientIndex index = preg_->indexFrom(bd.branchID());
291  assert(index != ProductRegistry::kInvalidIndex);
292  groups_[index] = g;
293  }
static ProductTransientIndex const kInvalidIndex
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
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 g
Definition: Activities.doc:4
GroupCollection groups_
Definition: Principal.h:223
boost::shared_ptr< Group > SharedGroupPtr
Definition: Principal.h:61
void edm::Principal::addGroupInput ( boost::shared_ptr< ConstBranchDescription bd)

Definition at line 193 of file Principal.cc.

References addGroupOrThrow(), and g.

Referenced by adjustIndexesAfterProductRegistryAddition(), and Principal().

193  {
194  std::auto_ptr<Group> g(new InputGroup(bd));
196  }
void addGroupOrThrow(std::auto_ptr< Group > g)
Definition: Principal.cc:296
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 g
Definition: Activities.doc:4
void edm::Principal::addGroupOrThrow ( std::auto_ptr< Group g)
protected

Definition at line 296 of file Principal.cc.

References addGroup_(), edm::hlt::Exception, edm::ConstBranchDescription::friendlyClassName(), g, getExistingGroup(), edm::errors::InsertFailure, edm::ConstBranchDescription::moduleLabel(), edm::ConstBranchDescription::processName(), and edm::ConstBranchDescription::productInstanceName().

Referenced by addGroupInput(), addGroupScheduled(), addGroupSource(), and addOnDemandGroup().

296  {
297  Group const* g = getExistingGroup(*group);
298  if(g != 0) {
299  ConstBranchDescription const& bd = group->branchDescription();
300  throw Exception(errors::InsertFailure, "AlreadyPresent")
301  << "addGroupOrThrow: Problem found while adding product, "
302  << "product already exists for ("
303  << bd.friendlyClassName() << ","
304  << bd.moduleLabel() << ","
305  << bd.productInstanceName() << ","
306  << bd.processName()
307  << ")\n";
308  }
309  addGroup_(group);
310  }
void addGroup_(std::auto_ptr< Group > g)
Definition: Principal.cc:282
Group * getExistingGroup(BranchID const &branchID)
Definition: Principal.cc:267
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 g
Definition: Activities.doc:4
void edm::Principal::addGroupScheduled ( boost::shared_ptr< ConstBranchDescription bd)

Definition at line 181 of file Principal.cc.

References addGroupOrThrow(), and g.

Referenced by Principal().

181  {
182  std::auto_ptr<Group> g(new ScheduledGroup(bd));
184  }
void addGroupOrThrow(std::auto_ptr< Group > g)
Definition: Principal.cc:296
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 g
Definition: Activities.doc:4
void edm::Principal::addGroupSource ( boost::shared_ptr< ConstBranchDescription bd)

Definition at line 187 of file Principal.cc.

References addGroupOrThrow(), and g.

Referenced by Principal().

187  {
188  std::auto_ptr<Group> g(new SourceGroup(bd));
190  }
void addGroupOrThrow(std::auto_ptr< Group > g)
Definition: Principal.cc:296
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 g
Definition: Activities.doc:4
void edm::Principal::addOnDemandGroup ( boost::shared_ptr< ConstBranchDescription bd)

Definition at line 199 of file Principal.cc.

References addGroupOrThrow(), and g.

Referenced by Principal().

199  {
200  std::auto_ptr<Group> g(new UnscheduledGroup(bd));
202  }
void addGroupOrThrow(std::auto_ptr< Group > g)
Definition: Principal.cc:296
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 g
Definition: Activities.doc:4
void edm::Principal::adjustIndexesAfterProductRegistryAddition ( )

Definition at line 783 of file Principal.cc.

References addGroupInput(), begin(), branchType_, end(), groups_, i, getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, and preg_.

783  {
784  if(preg_->constProductList().size() > groups_.size()) {
785  GroupCollection newGroups(preg_->constProductList().size(), SharedGroupPtr());
786  for (Principal::const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) {
787  ProductTransientIndex index = preg_->indexFrom((*i)->branchDescription().branchID());
788  assert(index != ProductRegistry::kInvalidIndex);
789  newGroups[index] = *i;
790  }
791  groups_.swap(newGroups);
792  // Now we must add new groups for any new product registry entries.
793  ProductRegistry::ProductList const& prodsList = preg_->productList();
794  for(ProductRegistry::ProductList::const_iterator itProdInfo = prodsList.begin(),
795  itProdInfoEnd = prodsList.end();
796  itProdInfo != itProdInfoEnd;
797  ++itProdInfo) {
798  if(itProdInfo->second.branchType() == branchType_) {
799  ProductTransientIndex index = preg_->indexFrom(itProdInfo->second.branchID());
800  assert(index != ProductRegistry::kInvalidIndex);
801  if(!groups_[index]) {
802  // no group. Must add one. The new entry must be an input group.
803  assert(!itProdInfo->second.produced());
804  boost::shared_ptr<ConstBranchDescription> bd(new ConstBranchDescription(itProdInfo->second));
805  addGroupInput(bd);
806  }
807  }
808  }
809  }
810  }
BranchType branchType_
Definition: Principal.h:236
int i
Definition: DBlmapReader.cc:9
const_iterator end() const
Definition: Principal.h:141
std::map< BranchKey, BranchDescription > ProductList
static ProductTransientIndex const kInvalidIndex
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
GroupCollection groups_
Definition: Principal.h:223
boost::shared_ptr< Group > SharedGroupPtr
Definition: Principal.h:61
const_iterator begin() const
Definition: Principal.h:140
void addGroupInput(boost::shared_ptr< ConstBranchDescription > bd)
Definition: Principal.cc:193
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator
Definition: Principal.h:55
std::vector< boost::shared_ptr< Group > > GroupCollection
Definition: Principal.h:54
bool edm::Principal::adjustToNewProductRegistry ( ProductRegistry const &  reg)

Definition at line 159 of file Principal.cc.

References edm::Group::branchDescription(), edm::ConstBranchDescription::branchName(), branchType_, edm::ProductRegistry::constProductList(), g, getExistingGroup(), groups_, edm::ProductRegistry::productList(), and edm::Group::resetBranchDescription().

159  {
160  if(reg.constProductList().size() > groups_.size()) {
161  return false;
162  }
163  ProductRegistry::ProductList const& prodsList = reg.productList();
164  for(ProductRegistry::ProductList::const_iterator itProdInfo = prodsList.begin(),
165  itProdInfoEnd = prodsList.end();
166  itProdInfo != itProdInfoEnd;
167  ++itProdInfo) {
168  if(!itProdInfo->second.produced() && (itProdInfo->second.branchType() == branchType_)) {
169  boost::shared_ptr<ConstBranchDescription> bd(new ConstBranchDescription(itProdInfo->second));
170  Group *g = getExistingGroup(itProdInfo->second.branchID());
171  if(g == 0 || g->branchDescription().branchName() != bd->branchName()) {
172  return false;
173  }
174  g->resetBranchDescription(bd);
175  }
176  }
177  return true;
178  }
BranchType branchType_
Definition: Principal.h:236
Group * getExistingGroup(BranchID const &branchID)
Definition: Principal.cc:267
std::map< BranchKey, BranchDescription > ProductList
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 g
Definition: Activities.doc:4
GroupCollection groups_
Definition: Principal.h:223
const_iterator edm::Principal::begin ( void  ) const
inline
BranchType const& edm::Principal::branchType ( ) const
inline

Definition at line 147 of file Principal.h.

References branchType_.

Referenced by maybeFlushCache().

147 {return branchType_;}
BranchType branchType_
Definition: Principal.h:236
void edm::Principal::checkUniquenessAndType ( WrapperOwningHolder const &  prod,
Group const *  group 
) const
protected

Definition at line 744 of file Principal.cc.

References edm::Group::branchDescription(), edm::ConstBranchDescription::branchName(), edm::Group::checkType(), edm::WrapperHolder::isValid(), parseEventContent::prod, productPtrs_, reset(), edm::second(), edm::throwCorruptionException(), and edm::WrapperHolder::wrapper().

Referenced by edm::EventPrincipal::put(), edm::EventPrincipal::putOnRead(), putOrMerge(), and edm::EventPrincipal::resolveProduct_().

744  {
745  if(!prod.isValid()) return;
746  // These are defensive checks against things that should never happen, but have.
747  // Checks that the same physical product has not already been put into the event.
748  bool alreadyPresent = !productPtrs_.insert(prod.wrapper()).second;
749  if(alreadyPresent) {
750  g->checkType(prod);
751  const_cast<WrapperOwningHolder&>(prod).reset();
752  throwCorruptionException("checkUniquenessAndType", g->branchDescription().branchName());
753  }
754  // Checks that the real type of the product matches the branch.
755  g->checkType(prod);
756  }
static void throwCorruptionException(char const *where, std::string const &branchName)
Definition: Principal.cc:55
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 g
Definition: Activities.doc:4
U second(std::pair< T, U > const &p)
std::set< void const * > productPtrs_
Definition: Principal.h:234
void reset(double vett[256])
Definition: TPedValues.cc:11
void edm::Principal::clearPrincipal ( )

Definition at line 206 of file Principal.cc.

References begin(), end(), i, processHistoryID_, processHistoryPtr_, productPtrs_, and reader_.

Referenced by edm::EventPrincipal::clearEventPrincipal().

206  {
207  processHistoryPtr_ = 0;
209  reader_ = 0;
210  for (Principal::const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) {
211  (*i)->resetProductData();
212  }
213  productPtrs_.clear();
214  }
int i
Definition: DBlmapReader.cc:9
DelayedReader * reader_
Definition: Principal.h:231
const_iterator end() const
Definition: Principal.h:141
ProcessHistoryID processHistoryID_
Definition: Principal.h:218
ProcessHistory const * processHistoryPtr_
Definition: Principal.h:216
Hash< ProcessHistoryType > ProcessHistoryID
std::set< void const * > productPtrs_
Definition: Principal.h:234
const_iterator begin() const
Definition: Principal.h:140
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator
Definition: Principal.h:55
void edm::Principal::deleteProduct ( BranchID const &  id)

Definition at line 217 of file Principal.cc.

References edm::Group::deleteProduct(), g, getExistingGroup(), edm::Group::product(), and productPtrs_.

Referenced by edm::EarlyDeleteHelper::moduleRan().

217  {
218  Group* g = getExistingGroup(id);
219  assert(0!=g);
220  auto itFound = productPtrs_.find(g->product().get());
221  if(itFound != productPtrs_.end()) {
222  productPtrs_.erase(itFound);
223  }
224  g->deleteProduct();
225  }
Group * getExistingGroup(BranchID const &branchID)
Definition: Principal.cc:267
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 g
Definition: Activities.doc:4
std::set< void const * > productPtrs_
Definition: Principal.h:234
const_iterator edm::Principal::end ( void  ) const
inline
void edm::Principal::fillPrincipal ( ProcessHistoryID const &  hist,
DelayedReader reader 
)

Definition at line 229 of file Principal.cc.

References edm::HistoryAppender::appendToProcessHistory(), branchType_, emptyProcessHistory_, edm::hlt::Exception, edm::detail::ThreadSafeRegistry< KEY, T, E >::getMapped(), estimatePileup::hist, historyAppender_, edm::CachedHistory::inputProcessHistory(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::Hash< I >::isValid(), edm::errors::LogicError, preg_, processConfiguration_, edm::CachedHistory::processHistory(), edm::CachedHistory::processHistoryID(), processHistoryID_, processHistoryPtr_, edm::ProcessConfiguration::processName(), productRegistry(), reader(), reader_, and PhysicsTools::registry.

Referenced by edm::EventPrincipal::fillEventPrincipal(), edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(), and edm::RunPrincipal::fillRunPrincipal().

229  {
230  if(reader) {
231  reader_ = reader;
232  }
233 
234  ProcessHistory const* inputProcessHistory = 0;
235  if (historyAppender_ && productRegistry().anyProductProduced()) {
236  CachedHistory const& cachedHistory =
239  processHistoryPtr_ = cachedHistory.processHistory();
240  processHistoryID_ = cachedHistory.processHistoryID();
241  inputProcessHistory = cachedHistory.inputProcessHistory();
242  }
243  else {
244  if (hist.isValid()) {
246  inputProcessHistory = registry->getMapped(hist);
247  if (inputProcessHistory == 0) {
249  << "Principal::fillPrincipal\n"
250  << "Input ProcessHistory not found in registry\n"
251  << "Contact a Framework developer\n";
252  }
253  } else {
254  inputProcessHistory = &emptyProcessHistory_;
255  }
257  processHistoryPtr_ = inputProcessHistory;
258  }
259 
260  preg_->productLookup().reorderIfNecessary(branchType_, *inputProcessHistory,
262  preg_->elementLookup().reorderIfNecessary(branchType_, *inputProcessHistory,
264  }
BranchType branchType_
Definition: Principal.h:236
ProductRegistry const & productRegistry() const
Definition: Principal.h:132
DelayedReader * reader_
Definition: Principal.h:231
HistoryAppender * historyAppender_
Definition: Principal.h:241
ProcessHistoryID processHistoryID_
Definition: Principal.h:218
static ThreadSafeRegistry * instance()
CachedHistory const & appendToProcessHistory(ProcessHistoryID const &inputPHID, ProcessConfiguration const &pc)
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
ProcessHistory const * processHistoryPtr_
Definition: Principal.h:216
edm::detail::ThreadSafeRegistry< edm::ProcessHistoryID, edm::ProcessHistory, edm::FullHistoryToReducedHistoryMap > ProcessHistoryRegistry
std::string const & processName() const
DelayedReader * reader() const
Definition: Principal.h:149
static Interceptor::Registry registry("Interceptor")
static ProcessHistory emptyProcessHistory_
Definition: Principal.h:243
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:220
size_t edm::Principal::findGroup ( TypeID const &  typeID,
TypeLookup const &  typeLookup,
SelectorBase const &  selector,
BasicHandle result 
) const
private

Definition at line 490 of file Principal.cc.

References branchType_, prof2calltree::count, edm::TransientProductLookupMap::equal_range(), getGroupByIndex(), edm::BasicHandle::isValid(), edm::SelectorBase::match(), max(), edm::maybeThrowMissingDictionaryException(), preg_, resolveProduct(), and edm::throwProductDeletedException().

Referenced by getBySelector(), getByType(), and getMatchingSequence().

493  {
494  assert(!result.isValid());
495 
496  size_t count = 0U;
497 
499  // A class without a dictionary cannot be in an Event/Lumi/Run.
500  // First, we check if the class has a dictionary. If it does not, we throw an exception.
501  // The missing dictionary might be for the class itself, the wrapped class, or a component of the class.
502  std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> const range = typeLookup.equal_range(TypeInBranchType(typeID, branchType_));
503  if(range.first == range.second) {
504  maybeThrowMissingDictionaryException(typeID, &typeLookup == &preg_->elementLookup(), preg_->missingDictionaries());
505  }
506 
507  unsigned int processLevelFound = std::numeric_limits<unsigned int>::max();
508  for(TypeLookup::const_iterator it = range.first; it != range.second; ++it) {
509  if(it->processIndex() > processLevelFound) {
510  //this is for a less recent process and we've already found a match for a more recent process
511  continue;
512  }
513 
514  if(selector.match(*(it->branchDescription()))) {
515 
516  //now see if the data is actually available
517  ConstGroupPtr const& group = getGroupByIndex(it->index(), false, false);
518  if(group && group->productWasDeleted()) {
519  throwProductDeletedException("findGroup",
520  typeID,
521  it->branchDescription()->moduleLabel(),
522  it->branchDescription()->productInstanceName(),
523  it->branchDescription()->processName());
524  }
525 
526  // Skip product if not available.
527  if(group && !group->productUnavailable()) {
528 
529  this->resolveProduct(*group, true);
530  // If the product is a dummy filler, group will now be marked unavailable.
531  // Unscheduled execution can fail to produce the EDProduct so check
532  if(group->product() && !group->productUnavailable() && !group->onDemand()) {
533  if(it->processIndex() < processLevelFound) {
534  processLevelFound = it->processIndex();
535  count = 0U;
536  }
537  if(count == 0U) {
538  // Found a unique (so far) match, save it
539  result = BasicHandle(group->productData());
540  }
541  ++count;
542  }
543  }
544  }
545  }
546  if(count != 1) result = BasicHandle();
547  return count;
548  }
BranchType branchType_
Definition: Principal.h:236
static void throwProductDeletedException(ProductID const &pid, edm::EventPrincipal::ConstGroupPtr const g)
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
void resolveProduct(Group const &g, bool fillOnDemand) const
Definition: Principal.h:178
ProductLookupIndexList::const_iterator const_iterator
Group const * ConstGroupPtr
Definition: Principal.h:57
const T & max(const T &a, const T &b)
tuple result
Definition: query.py:137
ConstGroupPtr getGroupByIndex(ProductTransientIndex const &oid, bool resolveProd, bool fillOnDemand) const
Definition: Principal.cc:322
static void maybeThrowMissingDictionaryException(TypeID const &productType, bool isElement, std::vector< std::string > const &missingDictionaries)
Definition: Principal.cc:31
std::pair< const_iterator, const_iterator > equal_range(TypeInBranchType const &) const
returns a pair of iterators that define the range for items matching the TypeInBranchType ...
TransientProductLookupMap TypeLookup
Definition: Principal.h:193
ProductData const * edm::Principal::findGroupByLabel ( TypeID const &  typeID,
TypeLookup const &  typeLookup,
std::string const &  moduleLabel,
std::string const &  productInstanceName,
std::string const &  processName,
size_t &  cachedOffset,
int &  fillCount 
) const
private

Definition at line 551 of file Principal.cc.

References edm::TransientProductLookupMap::begin(), branchType_, edm::TransientProductLookupMap::end(), edm::TransientProductLookupMap::equal_range(), edm::TransientProductLookupMap::fillCount(), getGroupByIndex(), edm::maybeThrowMissingDictionaryException(), preg_, resolveProduct(), and edm::throwProductDeletedException().

Referenced by findGroupByTag(), and getByLabel().

557  {
558 
560  bool isCached = (fillCount > 0 && fillCount == typeLookup.fillCount());
561  bool toBeCached = (fillCount >= 0 && !isCached);
562 
563  std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> range =
564  (isCached ? std::make_pair(typeLookup.begin() + cachedOffset, typeLookup.end()) : typeLookup.equal_range(TypeInBranchType(typeID, branchType_), moduleLabel, productInstanceName));
565 
566  if(toBeCached) {
567  cachedOffset = range.first - typeLookup.begin();
568  fillCount = typeLookup.fillCount();
569  }
570 
571  if(range.first == range.second) {
572  if(toBeCached) {
573  cachedOffset = typeLookup.end() - typeLookup.begin();
574  }
575  // We check for a missing dictionary. We do this only in this error leg.
576  // A class without a dictionary cannot be in an Event/Lumi/Run.
577  // We check if the class has a dictionary. If it does not, we throw an exception.
578  // The missing dictionary might be for the class itself, the wrapped class, or a component of the class.
579  std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> const typeRange = typeLookup.equal_range(TypeInBranchType(typeID, branchType_));
580  if(typeRange.first == typeRange.second) {
581  maybeThrowMissingDictionaryException(typeID, &typeLookup == &preg_->elementLookup(), preg_->missingDictionaries());
582  }
583  return 0;
584  }
585 
586  if(!processName.empty()) {
587  if(isCached) {
588  assert(processName == range.first->branchDescription()->processName());
589  range.second = range.first + 1;
590  } else if(toBeCached) {
591  bool processFound = false;
592  for(TypeLookup::const_iterator it = range.first; it != range.second; ++it) {
593  if(it->isFirst() && it != range.first) {
594  break;
595  }
596  if(processName == it->branchDescription()->processName()) {
597  processFound = true;
598  range.first = it;
599  cachedOffset = range.first - typeLookup.begin();
600  range.second = range.first + 1;
601  break;
602  }
603  }
604  if(!processFound) {
605  cachedOffset = typeLookup.end() - typeLookup.begin();
606  return 0;
607  }
608  } // end if(toBeCached)
609  }
610 
611  for(TypeLookup::const_iterator it = range.first; it != range.second; ++it) {
612  if(it->isFirst() && it != range.first) {
613  return 0;
614  }
615  if(!processName.empty() && processName != it->branchDescription()->processName()) {
616  continue;
617  }
618  //now see if the data is actually available
619  ConstGroupPtr const& group = getGroupByIndex(it->index(), false, false);
620  if(group && group->productWasDeleted()) {
621  throwProductDeletedException("findGroupByLabel",
622  typeID,
623  moduleLabel,
624  productInstanceName,
625  processName);
626  }
627 
628  // Skip product if not available.
629  if(group && !group->productUnavailable()) {
630  this->resolveProduct(*group, true);
631  // If the product is a dummy filler, group will now be marked unavailable.
632  // Unscheduled execution can fail to produce the EDProduct so check
633  if(group->product() && !group->productUnavailable() && !group->onDemand()) {
634  // Found the match
635  return &group->productData();
636  }
637  }
638  }
639  return 0;
640  }
BranchType branchType_
Definition: Principal.h:236
static void throwProductDeletedException(ProductID const &pid, edm::EventPrincipal::ConstGroupPtr const g)
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
void resolveProduct(Group const &g, bool fillOnDemand) const
Definition: Principal.h:178
ProductLookupIndexList::const_iterator const_iterator
Group const * ConstGroupPtr
Definition: Principal.h:57
ConstGroupPtr getGroupByIndex(ProductTransientIndex const &oid, bool resolveProd, bool fillOnDemand) const
Definition: Principal.cc:322
static void maybeThrowMissingDictionaryException(TypeID const &productType, bool isElement, std::vector< std::string > const &missingDictionaries)
Definition: Principal.cc:31
TransientProductLookupMap TypeLookup
Definition: Principal.h:193
ProductData const * edm::Principal::findGroupByTag ( TypeID const &  typeID,
InputTag const &  tag 
) const

Definition at line 643 of file Principal.cc.

References edm::InputTag::cachedOffset(), edm::InputTag::fillCount(), findGroupByLabel(), edm::InputTag::instance(), edm::InputTag::label(), preg_, edm::InputTag::process(), and edm::throwNotFoundException().

Referenced by edm::getProductByTag().

643  {
644  ProductData const* productData =
645  findGroupByLabel(typeID,
646  preg_->productLookup(),
647  tag.label(),
648  tag.instance(),
649  tag.process(),
650  tag.cachedOffset(),
651  tag.fillCount());
652  if(productData == 0) {
653  throwNotFoundException("findProductByTag", typeID, tag);
654  }
655  return productData;
656  }
static void throwNotFoundException(char const *where, TypeID const &productType, InputTag const &tag)
Definition: Principal.cc:93
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
ProductData const * findGroupByLabel(TypeID const &typeID, TypeLookup const &typeLookup, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, size_t &cachedOffset, int &fillCount) const
Definition: Principal.cc:551
size_t edm::Principal::findGroups ( TypeID const &  typeID,
TypeLookup const &  typeLookup,
SelectorBase const &  selector,
BasicHandleVec results 
) const
private

Definition at line 440 of file Principal.cc.

References branchType_, edm::TransientProductLookupMap::equal_range(), getGroupByIndex(), edm::SelectorBase::match(), edm::maybeThrowMissingDictionaryException(), preg_, resolveProduct(), and edm::throwProductDeletedException().

Referenced by getMany(), and getManyByType().

443  {
444  assert(results.empty());
445 
447  // A class without a dictionary cannot be in an Event/Lumi/Run.
448  // First, we check if the class has a dictionary. If it does not, we throw an exception.
449  // The missing dictionary might be for the class itself, the wrapped class, or a component of the class.
450  std::pair<TypeLookup::const_iterator, TypeLookup::const_iterator> const range = typeLookup.equal_range(TypeInBranchType(typeID, branchType_));
451  if(range.first == range.second) {
452  maybeThrowMissingDictionaryException(typeID, &typeLookup == &preg_->elementLookup(), preg_->missingDictionaries());
453  }
454 
455  results.reserve(range.second - range.first);
456 
457  for(TypeLookup::const_iterator it = range.first; it != range.second; ++it) {
458 
459  if(selector.match(*(it->branchDescription()))) {
460 
461  //now see if the data is actually available
462  ConstGroupPtr const& group = getGroupByIndex(it->index(), false, false);
463  //NOTE sometimes 'group->productUnavailable()' is true if was already deleted
464  if(group && group->productWasDeleted()) {
465  throwProductDeletedException("findGroups",
466  typeID,
467  it->branchDescription()->moduleLabel(),
468  it->branchDescription()->productInstanceName(),
469  it->branchDescription()->processName());
470  }
471 
472  // Skip product if not available.
473  if(group && !group->productUnavailable()) {
474 
475  this->resolveProduct(*group, true);
476  // If the product is a dummy filler, group will now be marked unavailable.
477  // Unscheduled execution can fail to produce the EDProduct so check
478  if(group->product() && !group->productUnavailable() && !group->onDemand()) {
479  // Found a good match, save it
480  BasicHandle bh(group->productData());
481  results.push_back(bh);
482  }
483  }
484  }
485  }
486  return results.size();
487  }
BranchType branchType_
Definition: Principal.h:236
static void throwProductDeletedException(ProductID const &pid, edm::EventPrincipal::ConstGroupPtr const g)
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
void resolveProduct(Group const &g, bool fillOnDemand) const
Definition: Principal.h:178
ProductLookupIndexList::const_iterator const_iterator
Group const * ConstGroupPtr
Definition: Principal.h:57
ConstGroupPtr getGroupByIndex(ProductTransientIndex const &oid, bool resolveProd, bool fillOnDemand) const
Definition: Principal.cc:322
static void maybeThrowMissingDictionaryException(TypeID const &productType, bool isElement, std::vector< std::string > const &missingDictionaries)
Definition: Principal.cc:31
std::pair< const_iterator, const_iterator > equal_range(TypeInBranchType const &) const
returns a pair of iterators that define the range for items matching the TypeInBranchType ...
TransientProductLookupMap TypeLookup
Definition: Principal.h:193
void edm::Principal::getAllProvenance ( std::vector< Provenance const * > &  provenances) const

Definition at line 699 of file Principal.cc.

References begin(), end(), and i.

Referenced by edm::Run::getAllProvenance(), edm::LuminosityBlock::getAllProvenance(), edm::Event::getAllProvenance(), and edm::AsciiOutputModule::write().

699  {
700  provenances.clear();
701  for (const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) {
702  if((*i)->provenanceAvailable()) {
703  // We do not attempt to get the event/lumi/run status from the provenance,
704  // because the per event provenance may have been dropped.
705  if((*i)->provenance()->product().present()) {
706  provenances.push_back((*i)->provenance());
707  }
708  }
709  }
710  }
int i
Definition: DBlmapReader.cc:9
const_iterator end() const
Definition: Principal.h:141
const_iterator begin() const
Definition: Principal.h:140
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator
Definition: Principal.h:55
BasicHandle edm::Principal::getByLabel ( TypeID const &  tid,
std::string const &  label,
std::string const &  productInstanceName,
std::string const &  processName,
size_t &  cachedOffset,
int &  fillCount 
) const

Definition at line 355 of file Principal.cc.

References findGroupByLabel(), diffTwoXMLs::label, edm::makeNotFoundException(), preg_, and query::result.

Referenced by edm::check().

360  {
361 
362  ProductData const* result = findGroupByLabel(productType,
363  preg_->productLookup(),
364  label,
365  productInstanceName,
366  processName,
367  cachedOffset,
368  fillCount);
369 
370  if(result == 0) {
371  boost::shared_ptr<cms::Exception> whyFailed = makeNotFoundException("getByLabel", productType, label, productInstanceName, processName);
372  return BasicHandle(whyFailed);
373  }
374  return BasicHandle(*result);
375  }
static boost::shared_ptr< cms::Exception > makeNotFoundException(char const *where, TypeID const &productType)
Definition: Principal.cc:62
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
ProductData const * findGroupByLabel(TypeID const &typeID, TypeLookup const &typeLookup, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, size_t &cachedOffset, int &fillCount) const
Definition: Principal.cc:551
tuple result
Definition: query.py:137
BasicHandle edm::Principal::getBySelector ( TypeID const &  tid,
SelectorBase const &  s 
) const

Definition at line 335 of file Principal.cc.

References findGroup(), edm::makeNotFoundException(), preg_, query::result, EgammaValidation_Wenu_cff::sel, and edm::throwMultiFoundException().

336  {
337  BasicHandle result;
338 
339  int nFound = findGroup(productType,
340  preg_->productLookup(),
341  sel,
342  result);
343 
344  if(nFound == 0) {
345  boost::shared_ptr<cms::Exception> whyFailed = makeNotFoundException("getBySelector", productType);
346  return BasicHandle(whyFailed);
347  }
348  if(nFound > 1) {
349  throwMultiFoundException("getBySelector", nFound, productType);
350  }
351  return result;
352  }
size_t findGroup(TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandle &result) const
Definition: Principal.cc:490
static boost::shared_ptr< cms::Exception > makeNotFoundException(char const *where, TypeID const &productType)
Definition: Principal.cc:62
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
tuple result
Definition: query.py:137
static void throwMultiFoundException(char const *where, int nFound, TypeID const &productType)
Definition: Principal.cc:40
BasicHandle edm::Principal::getByType ( TypeID const &  tid) const

Definition at line 392 of file Principal.cc.

References findGroup(), edm::makeNotFoundException(), preg_, query::result, EgammaValidation_Wenu_cff::sel, and edm::throwMultiFoundException().

392  {
393 
394  BasicHandle result;
395  MatchAllSelector sel;
396 
397  int nFound = findGroup(productType,
398  preg_->productLookup(),
399  sel,
400  result);
401 
402  if(nFound == 0) {
403  boost::shared_ptr<cms::Exception> whyFailed = makeNotFoundException("getByType", productType);
404  return BasicHandle(whyFailed);
405  }
406 
407  if(nFound > 1) {
408  throwMultiFoundException("getByType", nFound, productType);
409  }
410  return result;
411  }
size_t findGroup(TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandle &result) const
Definition: Principal.cc:490
static boost::shared_ptr< cms::Exception > makeNotFoundException(char const *where, TypeID const &productType)
Definition: Principal.cc:62
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
tuple result
Definition: query.py:137
static void throwMultiFoundException(char const *where, int nFound, TypeID const &productType)
Definition: Principal.cc:40
Group * edm::Principal::getExistingGroup ( BranchID const &  branchID)
protected

Definition at line 267 of file Principal.cc.

References groups_, getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, and preg_.

Referenced by addGroupOrThrow(), adjustToNewProductRegistry(), deleteProduct(), getExistingGroup(), edm::RunPrincipal::put(), edm::LuminosityBlockPrincipal::put(), edm::EventPrincipal::put(), and edm::EventPrincipal::putOnRead().

267  {
268  ProductTransientIndex index = preg_->indexFrom(branchID);
269  assert(index != ProductRegistry::kInvalidIndex);
270  SharedGroupPtr ptr = groups_.at(index);
271  return ptr.get();
272  }
static ProductTransientIndex const kInvalidIndex
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
GroupCollection groups_
Definition: Principal.h:223
boost::shared_ptr< Group > SharedGroupPtr
Definition: Principal.h:61
Group * edm::Principal::getExistingGroup ( Group const &  g)
protected

Definition at line 275 of file Principal.cc.

References edm::Group::branchDescription(), edm::ConstBranchDescription::branchID(), g, and getExistingGroup().

275  {
276  Group* g = getExistingGroup(group.branchDescription().branchID());
277  assert(0 == g || BranchKey(group.branchDescription()) == BranchKey(g->branchDescription()));
278  return g;
279  }
Group * getExistingGroup(BranchID const &branchID)
Definition: Principal.cc:267
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 g
Definition: Activities.doc:4
OutputHandle edm::Principal::getForOutput ( BranchID const &  bid,
bool  getProd 
) const

Definition at line 659 of file Principal.cc.

References g, getGroup(), edm::errors::LogicError, edm::throwGroupNotFoundException(), and edm::throwProductDeletedException().

Referenced by edm::check(), edm::RootOutputFile::fillBranches(), edm::StreamSerializer::serializeEvent(), and edm::ProvenanceCheckerOutputModule::write().

659  {
660  ConstGroupPtr const g = getGroup(bid, getProd, true);
661  if(g == 0) {
662  throwGroupNotFoundException("getForOutput", errors::LogicError, bid);
663  }
664  if (g->productWasDeleted()) {
665  throwProductDeletedException("getForOutput",g->productType(),
666  g->moduleLabel(),
667  g->productInstanceName(),
668  g->processName());
669  }
670  if(!g->provenance() || (!g->product() && !g->productProvenancePtr())) {
671  return OutputHandle();
672  }
673  return OutputHandle(WrapperHolder(g->product().get(), g->productData().getInterface()), &g->branchDescription(), g->productProvenancePtr());
674  }
ConstGroupPtr getGroup(BranchID const &oid, bool resolveProd, bool fillOnDemand) const
Definition: Principal.cc:313
static void throwProductDeletedException(ProductID const &pid, edm::EventPrincipal::ConstGroupPtr const g)
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 g
Definition: Activities.doc:4
Group const * ConstGroupPtr
Definition: Principal.h:57
static void throwGroupNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
Definition: Principal.cc:48
Principal::ConstGroupPtr edm::Principal::getGroup ( BranchID const &  oid,
bool  resolveProd,
bool  fillOnDemand 
) const

Definition at line 313 of file Principal.cc.

References getGroupByIndex(), getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, and preg_.

Referenced by edm::EventPrincipal::getByProductID(), getForOutput(), getProvenance(), and edm::SubProcess::propagateProducts().

313  {
314  ProductTransientIndex index = preg_->indexFrom(bid);
315  if(index == ProductRegistry::kInvalidIndex){
316  return ConstGroupPtr();
317  }
318  return getGroupByIndex(index, resolveProd, fillOnDemand);
319  }
static ProductTransientIndex const kInvalidIndex
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
Group const * ConstGroupPtr
Definition: Principal.h:57
ConstGroupPtr getGroupByIndex(ProductTransientIndex const &oid, bool resolveProd, bool fillOnDemand) const
Definition: Principal.cc:322
Principal::ConstGroupPtr edm::Principal::getGroupByIndex ( ProductTransientIndex const &  oid,
bool  resolveProd,
bool  fillOnDemand 
) const
protected

Definition at line 322 of file Principal.cc.

References g, groups_, getHLTprescales::index, and resolveProduct().

Referenced by findGroup(), findGroupByLabel(), findGroups(), and getGroup().

322  {
323 
324  ConstGroupPtr const g = groups_[index].get();
325  if(0 == g) {
326  return g;
327  }
328  if(resolveProd && !g->productUnavailable()) {
329  this->resolveProduct(*g, fillOnDemand);
330  }
331  return g;
332  }
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 g
Definition: Activities.doc:4
void resolveProduct(Group const &g, bool fillOnDemand) const
Definition: Principal.h:178
GroupCollection groups_
Definition: Principal.h:223
Group const * ConstGroupPtr
Definition: Principal.h:57
WrapperHolder edm::Principal::getIt ( ProductID const &  ) const
privatevirtual

Implements edm::EDProductGetter.

Reimplemented in edm::EventPrincipal.

Definition at line 725 of file Principal.cc.

725  {
726  assert(0);
727  return WrapperHolder();
728  }
void edm::Principal::getMany ( TypeID const &  tid,
SelectorBase const &  sel,
BasicHandleVec results 
) const

Definition at line 379 of file Principal.cc.

References findGroups(), preg_, python.entryComment::results, and EgammaValidation_Wenu_cff::sel.

381  {
382 
383  findGroups(productType,
384  preg_->productLookup(),
385  sel,
386  results);
387 
388  return;
389  }
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
size_t findGroups(TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandleVec &results) const
Definition: Principal.cc:440
void edm::Principal::getManyByType ( TypeID const &  tid,
BasicHandleVec results 
) const

Definition at line 414 of file Principal.cc.

References findGroups(), preg_, python.entryComment::results, and EgammaValidation_Wenu_cff::sel.

415  {
416 
417  MatchAllSelector sel;
418 
419  findGroups(productType,
420  preg_->productLookup(),
421  sel,
422  results);
423  return;
424  }
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
size_t findGroups(TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandleVec &results) const
Definition: Principal.cc:440
size_t edm::Principal::getMatchingSequence ( TypeID const &  typeID,
SelectorBase const &  selector,
BasicHandle result 
) const

Definition at line 427 of file Principal.cc.

References findGroup(), preg_, and query::result.

429  {
430 
431  // One new argument is the element lookup container
432  // Otherwise this just passes through the arguments to findGroup
433  return findGroup(typeID,
434  preg_->elementLookup(),
435  selector,
436  result);
437  }
size_t findGroup(TypeID const &typeID, TypeLookup const &typeLookup, SelectorBase const &selector, BasicHandle &result) const
Definition: Principal.cc:490
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
tuple result
Definition: query.py:137
Provenance edm::Principal::getProvenance ( BranchID const &  bid) const

Definition at line 677 of file Principal.cc.

References g, getGroup(), edm::errors::ProductNotFound, edm::throwGroupNotFoundException(), and unscheduledFill().

Referenced by edm::Run::getProvenance(), edm::LuminosityBlock::getProvenance(), and edm::Event::getProvenance().

677  {
678  ConstGroupPtr const g = getGroup(bid, false, true);
679  if(g == 0) {
681  }
682 
683  if(g->onDemand()) {
684  unscheduledFill(g->branchDescription().moduleLabel());
685  }
686  // We already tried to produce the unscheduled products above
687  // If they still are not there, then throw
688  if(g->onDemand()) {
689  throwGroupNotFoundException("getProvenance(onDemand)", errors::ProductNotFound, bid);
690  }
691 
692  return *g->provenance();
693  }
ConstGroupPtr getGroup(BranchID const &oid, bool resolveProd, bool fillOnDemand) const
Definition: Principal.cc:313
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 g
Definition: Activities.doc:4
Group const * ConstGroupPtr
Definition: Principal.h:57
static void throwGroupNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
Definition: Principal.cc:48
virtual bool unscheduledFill(std::string const &moduleLabel) const =0
void edm::Principal::maybeFlushCache ( TypeID const &  tid,
InputTag const &  tag 
) const

Definition at line 731 of file Principal.cc.

References edm::InputTag::branchType(), branchType(), edm::InputTag::cachedOffset(), edm::InputTag::fillCount(), edm::InputTag::productRegistry(), productRegistry(), and edm::InputTag::typeID().

Referenced by edm::getProductByTag().

731  {
732  if(tag.typeID() != tid ||
733  tag.branchType() != branchType() ||
734  tag.productRegistry() != &productRegistry()) {
735  tag.fillCount() = 0;
736  tag.cachedOffset() = 0U;
737  tag.typeID() = tid;
738  tag.branchType() = branchType();
739  tag.productRegistry() = &productRegistry();
740  }
741  }
ProductRegistry const & productRegistry() const
Definition: Principal.h:132
BranchType const & branchType() const
Definition: Principal.h:147
ProcessConfiguration const& edm::Principal::processConfiguration ( ) const
inline

Definition at line 130 of file Principal.h.

References processConfiguration_.

130 {return *processConfiguration_;}
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:220
ProcessHistory const& edm::Principal::processHistory ( ) const
inline

Definition at line 122 of file Principal.h.

References processHistoryPtr_.

Referenced by edm::StreamSerializer::serializeEvent(), and edm::AsciiOutputModule::write().

122  {
123  return *processHistoryPtr_;
124  }
ProcessHistory const * processHistoryPtr_
Definition: Principal.h:216
ProcessHistoryID const& edm::Principal::processHistoryID ( ) const
inline
EDProductGetter const* edm::Principal::prodGetter ( ) const
inline

Definition at line 89 of file Principal.h.

89 {return this;}
ProductRegistry const& edm::Principal::productRegistry ( ) const
inline

Definition at line 132 of file Principal.h.

References preg_.

Referenced by edm::EventPrincipal::fillEventPrincipal(), fillPrincipal(), maybeFlushCache(), edm::ProvenanceCheckerOutputModule::write(), and edm::SubProcess::write().

132 {return *preg_;}
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
void edm::Principal::putOrMerge ( WrapperOwningHolder const &  prod,
Group const *  group 
) const
protected

Definition at line 759 of file Principal.cc.

References edm::Group::checkType(), checkUniquenessAndType(), edm::Group::mergeProduct(), edm::Group::putOrMergeProduct(), and edm::Group::putProduct().

Referenced by edm::RunPrincipal::put(), edm::LuminosityBlockPrincipal::put(), edm::RunPrincipal::resolveProductImmediate(), and edm::LuminosityBlockPrincipal::resolveProductImmediate().

759  {
760  bool willBePut = g->putOrMergeProduct();
761  if(willBePut) {
763  g->putProduct(prod);
764  } else {
765  g->checkType(prod);
766  g->mergeProduct(prod);
767  }
768  }
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 g
Definition: Activities.doc:4
void checkUniquenessAndType(WrapperOwningHolder const &prod, Group const *group) const
Definition: Principal.cc:744
void edm::Principal::putOrMerge ( WrapperOwningHolder const &  prod,
ProductProvenance prov,
Group group 
)
protected

Definition at line 771 of file Principal.cc.

References edm::Group::checkType(), checkUniquenessAndType(), edm::Group::mergeProduct(), edm::Group::putOrMergeProduct(), and edm::Group::putProduct().

771  {
772  bool willBePut = g->putOrMergeProduct();
773  if(willBePut) {
775  g->putProduct(prod, prov);
776  } else {
777  g->checkType(prod);
778  g->mergeProduct(prod, prov);
779  }
780  }
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 g
Definition: Activities.doc:4
void checkUniquenessAndType(WrapperOwningHolder const &prod, Group const *group) const
Definition: Principal.cc:744
DelayedReader* edm::Principal::reader ( ) const
inline
void edm::Principal::recombine ( Principal other,
std::vector< BranchID > const &  bids 
)

Definition at line 713 of file Principal.cc.

References groups_, getHLTprescales::index, edm::ProductRegistry::kInvalidIndex, edm::DelayedReader::mergeReaders(), preg_, reader(), and reader_.

Referenced by edm::PoolSource::readEvent_().

713  {
714  for (std::vector<BranchID>::const_iterator it = bids.begin(), itEnd = bids.end(); it != itEnd; ++it) {
715  ProductTransientIndex index= preg_->indexFrom(*it);
716  assert(index!=ProductRegistry::kInvalidIndex);
717  ProductTransientIndex indexO = other.preg_->indexFrom(*it);
718  assert(indexO!=ProductRegistry::kInvalidIndex);
719  groups_[index].swap(other.groups_[indexO]);
720  }
721  reader_->mergeReaders(other.reader());
722  }
DelayedReader * reader_
Definition: Principal.h:231
void mergeReaders(DelayedReader *other)
Definition: DelayedReader.h:25
static ProductTransientIndex const kInvalidIndex
boost::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:227
GroupCollection groups_
Definition: Principal.h:223
void edm::Principal::resolveProduct ( Group const &  g,
bool  fillOnDemand 
) const
inlineprotected

Definition at line 178 of file Principal.h.

References resolveProduct_().

Referenced by findGroup(), findGroupByLabel(), findGroups(), and getGroupByIndex().

178 {resolveProduct_(g, fillOnDemand);}
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 g
Definition: Activities.doc:4
virtual void resolveProduct_(Group const &, bool) const
Definition: Principal.h:214
virtual void edm::Principal::resolveProduct_ ( Group const &  ,
bool   
) const
inlineprivatevirtual

Reimplemented in edm::EventPrincipal.

Definition at line 214 of file Principal.h.

Referenced by resolveProduct().

214 {}
size_t edm::Principal::size ( void  ) const

Definition at line 146 of file Principal.cc.

References begin(), edm::Group::branchDescription(), edm::ConstBranchDescription::dropped(), end(), g, edm::Group::onDemand(), and edm::Group::productUnavailable().

Referenced by edm::StreamerInputSource::deserializeEvent(), edm::SecSourceAnalyzer::getBranches(), and edm::Event::size().

146  {
147  size_t size = 0U;
148  for(const_iterator it = this->begin(), itEnd = this->end(); it != itEnd; ++it) {
149  Group const& g = **it;
150  if(!g.productUnavailable() && !g.onDemand() && !g.branchDescription().dropped()) {
151  ++size;
152  }
153  }
154  return size;
155  }
size_t size() const
Definition: Principal.cc:146
const_iterator end() const
Definition: Principal.h:141
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 g
Definition: Activities.doc:4
const_iterator begin() const
Definition: Principal.h:140
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator
Definition: Principal.h:55
virtual bool edm::Principal::unscheduledFill ( std::string const &  moduleLabel) const
privatepure virtual

Member Data Documentation

BranchType edm::Principal::branchType_
private
ProcessHistory edm::Principal::emptyProcessHistory_
staticprivate

Definition at line 243 of file Principal.h.

Referenced by fillPrincipal().

GroupCollection edm::Principal::groups_
private
HistoryAppender* edm::Principal::historyAppender_
private

Definition at line 241 of file Principal.h.

Referenced by fillPrincipal().

boost::shared_ptr<ProductRegistry const> edm::Principal::preg_
private
ProcessConfiguration const* edm::Principal::processConfiguration_
private

Definition at line 220 of file Principal.h.

Referenced by fillPrincipal(), and processConfiguration().

ProcessHistoryID edm::Principal::processHistoryID_
private

Definition at line 218 of file Principal.h.

Referenced by clearPrincipal(), fillPrincipal(), and processHistoryID().

ProcessHistory const* edm::Principal::processHistoryPtr_
private

Definition at line 216 of file Principal.h.

Referenced by clearPrincipal(), fillPrincipal(), and processHistory().

std::set<void const*> edm::Principal::productPtrs_
mutableprivate

Definition at line 234 of file Principal.h.

Referenced by checkUniquenessAndType(), clearPrincipal(), and deleteProduct().

DelayedReader* edm::Principal::reader_
private

Definition at line 231 of file Principal.h.

Referenced by clearPrincipal(), fillPrincipal(), reader(), and recombine().