CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RunPrincipal.cc
Go to the documentation of this file.
6 
7 namespace edm {
9  boost::shared_ptr<RunAuxiliary> aux,
10  boost::shared_ptr<ProductRegistry const> reg,
11  ProcessConfiguration const& pc) :
12  Base(reg, pc, InRun),
13  aux_(aux) {
14  }
15 
16  void
18  boost::shared_ptr<BranchMapper> mapper,
19  boost::shared_ptr<DelayedReader> rtrv) {
20  if (productRegistry().anyProductProduced()) {
22  }
23  fillPrincipal(aux_->processHistoryID(), mapper, rtrv);
26  }
27  mapper->processHistoryID() = processHistoryID();
28  for (const_iterator i = this->begin(), iEnd = this->end(); i != iEnd; ++i) {
29  (*i)->setProvenance(mapper);
30  }
31  }
32 
33  void
35  ConstBranchDescription const& bd,
36  std::auto_ptr<EDProduct> edp,
37  std::auto_ptr<ProductProvenance> productProvenance) {
38 
39  assert(bd.produced());
40  if (edp.get() == 0) {
41  throw edm::Exception(edm::errors::InsertFailure,"Null Pointer")
42  << "put: Cannot put because auto_ptr to product is null."
43  << "\n";
44  }
45  branchMapperPtr()->insert(*productProvenance);
47  assert(g);
48  // Group assumes ownership
49  putOrMerge(edp, productProvenance, g);
50  }
51 
52  void
54  for (Principal::const_iterator i = begin(), iEnd = end(); i != iEnd; ++i) {
55  Group const& g = **i;
56  if (!g.branchDescription().produced()) {
57  if (!g.productUnavailable()) {
59  }
60  }
61  }
62  branchMapperPtr()->setDelayedRead(false);
63  }
64 
65  void
67  if (g.branchDescription().produced()) return; // nothing to do.
68 
69  // must attempt to load from persistent store
70  BranchKey const bk = BranchKey(g.branchDescription());
71  std::auto_ptr<EDProduct> edp(store()->getProduct(bk, this));
72 
73  // Now fix up the Group
74  if (edp.get() != 0) {
75  putOrMerge(edp, &g);
76  }
77  }
78 
79  void
81  ProcessHistory ph;
82  ProcessHistoryRegistry::instance()->getMapped(aux_->processHistoryID(), ph);
83  std::string const& processName = processConfiguration().processName();
84  for (ProcessHistory::const_iterator it = ph.begin(), itEnd = ph.end(); it != itEnd; ++it) {
85  if (processName == it->processName()) {
86  throw edm::Exception(errors::Configuration, "Duplicate Process")
87  << "The process name " << processName << " was previously used on these products.\n"
88  << "Please modify the configuration file to use a distinct process name.\n";
89  }
90  }
91  }
92 
93  void
97  //OPTIMIZATION NOTE: As of 0_9_0_pre3
98  // For very simple Sources (e.g. EmptySource) this routine takes up nearly 50% of the time per event.
99  // 96% of the time for this routine is being spent in computing the
100  // ProcessHistory id which happens because we are reconstructing the ProcessHistory for each event.
101  // (The process ID is first computed in the call to 'insertMapped(..)' below.)
102  // It would probably be better to move the ProcessHistory construction out to somewhere
103  // which persists for longer than one Event
104 
106  setProcessHistory(*this);
107  }
108 
109  void
111  swapBase(iOther);
112  std::swap(aux_, iOther.aux_);
113  }
114 }
collection_type::const_iterator const_iterator
ProductRegistry const & productRegistry() const
Definition: Principal.h:122
const_iterator begin() const
int i
Definition: DBlmapReader.cc:9
void swapBase(Principal &)
Definition: Principal.cc:647
boost::shared_ptr< DelayedReader > store() const
Definition: Principal.h:141
const_iterator end() const
Definition: Principal.h:131
Group * getExistingGroup(BranchID const &branchID)
Definition: Principal.cc:155
void putOrMerge(std::auto_ptr< EDProduct > prod, Group const *group) const
Definition: Principal.cc:623
void checkProcessHistory() const
Definition: RunPrincipal.cc:80
bool getMapped(key_type const &k, value_type &result) const
boost::shared_ptr< RunAuxiliary > aux_
Definition: RunPrincipal.h:94
bool insertMapped(value_type const &v)
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 readImmediate() const
Definition: RunPrincipal.cc:53
std::string const & processName() const
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:116
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void setProcessHistory(Principal const &principal)
Definition: Principal.cc:201
void addToProcessHistory()
Definition: RunPrincipal.cc:94
void fillPrincipal(ProcessHistoryID const &hist, boost::shared_ptr< BranchMapper > mapper, boost::shared_ptr< DelayedReader > rtrv)
Definition: Principal.cc:138
BranchID const & branchID() const
void fillRunPrincipal(boost::shared_ptr< BranchMapper > mapper=boost::shared_ptr< BranchMapper >(new BranchMapper), boost::shared_ptr< DelayedReader > rtrv=boost::shared_ptr< DelayedReader >(new NoDelayedReader))
Definition: RunPrincipal.cc:17
T const * getProduct(RefCore const &ref)
Definition: RefCoreGet.h:37
ProcessConfiguration const & processConfiguration() const
Definition: Principal.h:120
void swap(RunPrincipal &)
void push_back(const_reference t)
const_iterator begin() const
Definition: Principal.h:130
RunPrincipal(boost::shared_ptr< RunAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc)
Definition: RunPrincipal.cc:8
bool anyProductProduced() const
const_iterator end() const
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator
Definition: Principal.h:48
void put(ConstBranchDescription const &bd, std::auto_ptr< EDProduct > edp, std::auto_ptr< ProductProvenance > productProvenance)
Definition: RunPrincipal.cc:34
boost::shared_ptr< BranchMapper > branchMapperPtr() const
Definition: Principal.h:139
static ThreadSafeRegistry * instance()
bool productUnavailable() const
Definition: Group.h:72
void resolveProductImmediate(Group const &g) const
Definition: RunPrincipal.cc:66
ProcessHistory & processHistoryUpdate()
Definition: Principal.h:149
ConstBranchDescription const & branchDescription() const
Definition: Group.h:90