CMS 3D CMS Logo

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

#include <PrincipalCache.h>

Public Member Functions

void adjustEventToNewProductRegistry (boost::shared_ptr< ProductRegistry const > reg)
 
void adjustIndexesAfterProductRegistryAddition ()
 
void deleteLumi (ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)
 
void deleteRun (ProcessHistoryID const &phid, RunNumber_t run)
 
EventPrincipaleventPrincipal () const
 
void insert (boost::shared_ptr< RunPrincipal > rp)
 
void insert (boost::shared_ptr< LuminosityBlockPrincipal > lbp)
 
void insert (boost::shared_ptr< EventPrincipal > ep)
 
LuminosityBlockPrincipallumiPrincipal (ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
 
LuminosityBlockPrincipallumiPrincipal () const
 
boost::shared_ptr
< LuminosityBlockPrincipal >
const & 
lumiPrincipalPtr (ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
 
boost::shared_ptr
< LuminosityBlockPrincipal >
const & 
lumiPrincipalPtr () const
 
void merge (boost::shared_ptr< RunAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg)
 
void merge (boost::shared_ptr< LuminosityBlockAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg)
 
 PrincipalCache ()
 
RunPrincipalrunPrincipal (ProcessHistoryID const &phid, RunNumber_t run) const
 
RunPrincipalrunPrincipal () const
 
boost::shared_ptr
< RunPrincipal > const & 
runPrincipalPtr (ProcessHistoryID const &phid, RunNumber_t run) const
 
boost::shared_ptr
< RunPrincipal > const & 
runPrincipalPtr () const
 
 ~PrincipalCache ()
 

Private Member Functions

void throwLumiMissing () const
 
void throwRunMissing () const
 

Private Attributes

boost::shared_ptr< EventPrincipaleventPrincipal_
 
ProcessHistoryID inputProcessHistoryID_
 
LuminosityBlockNumber_t lumi_
 
boost::shared_ptr
< LuminosityBlockPrincipal
lumiPrincipal_
 
ProcessHistoryID reducedInputProcessHistoryID_
 
RunNumber_t run_
 
boost::shared_ptr< RunPrincipalrunPrincipal_
 

Detailed Description

Definition at line 41 of file PrincipalCache.h.

Constructor & Destructor Documentation

edm::PrincipalCache::PrincipalCache ( )

Definition at line 11 of file PrincipalCache.cc.

11  :
12  run_(0U),
13  lumi_(0U) {
14  }
LuminosityBlockNumber_t lumi_
edm::PrincipalCache::~PrincipalCache ( )

Definition at line 16 of file PrincipalCache.cc.

16 { }

Member Function Documentation

void edm::PrincipalCache::adjustEventToNewProductRegistry ( boost::shared_ptr< ProductRegistry const >  reg)

Definition at line 242 of file PrincipalCache.cc.

References eventPrincipal_.

Referenced by edm::StreamerInputSource::deserializeAndMergeWithRegistry(), edm::RootInputFileSequence::nextFile(), and edm::RootInputFileSequence::previousFile().

242  {
243  if (eventPrincipal_) {
244  eventPrincipal_->adjustIndexesAfterProductRegistryAddition();
245  bool eventOK = eventPrincipal_->adjustToNewProductRegistry(*reg);
246  assert(eventOK);
247  }
248  }
boost::shared_ptr< EventPrincipal > eventPrincipal_
void edm::PrincipalCache::adjustIndexesAfterProductRegistryAddition ( )

Definition at line 250 of file PrincipalCache.cc.

References lumiPrincipal_, and runPrincipal_.

Referenced by edm::RootInputFileSequence::nextFile(), and edm::RootInputFileSequence::previousFile().

250  {
251  if (runPrincipal_) {
252  runPrincipal_->adjustIndexesAfterProductRegistryAddition();
253  }
254  if (lumiPrincipal_) {
255  lumiPrincipal_->adjustIndexesAfterProductRegistryAddition();
256  }
257  }
boost::shared_ptr< RunPrincipal > runPrincipal_
boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
void edm::PrincipalCache::deleteLumi ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
)

Definition at line 222 of file PrincipalCache.cc.

References edm::hlt::Exception, edm::errors::LogicError, lumi_, lumiPrincipal_, reducedInputProcessHistoryID_, and run_.

Referenced by edm::SubProcess::deleteLumiFromCache().

222  {
223  if (lumiPrincipal_.get() == 0) {
225  << "PrincipalCache::deleteLumi\n"
226  << "Illegal attempt to delete luminosity block from cache\n"
227  << "There is no luminosity block in the cache to delete\n"
228  << "Contact a Framework Developer\n";
229  }
230  if (reducedInputProcessHistoryID_ != phid ||
231  run != run_ ||
232  lumi != lumi_) {
234  << "PrincipalCache::deleteLumi\n"
235  << "Illegal attempt to delete luminosity block from cache\n"
236  << "Run number, lumi numbers, or reduced ProcessHistoryID inconsistent with those in cache\n"
237  << "Contact a Framework Developer\n";
238  }
239  lumiPrincipal_.reset();
240  }
tuple lumi
Definition: fjr2json.py:35
LuminosityBlockNumber_t lumi_
ProcessHistoryID reducedInputProcessHistoryID_
boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
void edm::PrincipalCache::deleteRun ( ProcessHistoryID const &  phid,
RunNumber_t  run 
)

Definition at line 203 of file PrincipalCache.cc.

References edm::hlt::Exception, edm::errors::LogicError, reducedInputProcessHistoryID_, run_, and runPrincipal_.

Referenced by edm::SubProcess::deleteRunFromCache().

203  {
204  if (runPrincipal_.get() == 0) {
206  << "PrincipalCache::deleteRun\n"
207  << "Illegal attempt to delete run from cache\n"
208  << "There is no run in cache to delete\n"
209  << "Contact a Framework Developer\n";
210  }
211  if (reducedInputProcessHistoryID_ != phid ||
212  run != run_) {
214  << "PrincipalCache::deleteRun\n"
215  << "Illegal attempt to delete run from cache\n"
216  << "Run number or reduced ProcessHistoryID inconsistent with those in cache\n"
217  << "Contact a Framework Developer\n";
218  }
219  runPrincipal_.reset();
220  }
ProcessHistoryID reducedInputProcessHistoryID_
boost::shared_ptr< RunPrincipal > runPrincipal_
EventPrincipal& edm::PrincipalCache::eventPrincipal ( ) const
inline

Definition at line 57 of file PrincipalCache.h.

References eventPrincipal_.

Referenced by edm::InputSource::eventPrincipalCache(), and edm::SubProcess::write().

57 { return *eventPrincipal_; }
boost::shared_ptr< EventPrincipal > eventPrincipal_
void edm::PrincipalCache::insert ( boost::shared_ptr< RunPrincipal rp)

Definition at line 153 of file PrincipalCache.cc.

References edm::hlt::Exception, edm::detail::ThreadSafeRegistry< KEY, T, E >::extra(), inputProcessHistoryID_, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::errors::LogicError, reducedInputProcessHistoryID_, run_, and runPrincipal_.

Referenced by edm::SubProcess::beginLuminosityBlock(), edm::SubProcess::beginRun(), edm::InputSource::readAndCacheLumi(), edm::InputSource::readAndCacheRun(), and edm::SubProcess::SubProcess().

153  {
154  if (runPrincipal_.get() != 0) {
156  << "PrincipalCache::insert\n"
157  << "Illegal attempt to insert run into cache\n"
158  << "Contact a Framework Developer\n";
159  }
160  if (inputProcessHistoryID_ != rp->aux().processHistoryID()) {
161  reducedInputProcessHistoryID_ = ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(rp->aux().processHistoryID());
162  inputProcessHistoryID_ = rp->aux().processHistoryID();
163  }
164  run_ = rp->run();
165  runPrincipal_ = rp;
166  }
static ThreadSafeRegistry * instance()
ProcessHistoryID reducedInputProcessHistoryID_
boost::shared_ptr< RunPrincipal > runPrincipal_
ProcessHistoryID inputProcessHistoryID_
void edm::PrincipalCache::insert ( boost::shared_ptr< LuminosityBlockPrincipal lbp)

Definition at line 168 of file PrincipalCache.cc.

References edm::hlt::Exception, edm::detail::ThreadSafeRegistry< KEY, T, E >::extra(), inputProcessHistoryID_, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::errors::LogicError, lumi_, lumiPrincipal_, reducedInputProcessHistoryID_, run_, and runPrincipal_.

168  {
169  if (lumiPrincipal_.get() != 0) {
171  << "PrincipalCache::insert\n"
172  << "Illegal attempt to insert lumi into cache\n"
173  << "Contact a Framework Developer\n";
174  }
175  if (runPrincipal_.get() == 0) {
177  << "PrincipalCache::insert\n"
178  << "Illegal attempt to insert lumi into cache\n"
179  << "Run is invalid\n"
180  << "Contact a Framework Developer\n";
181  }
182  if (inputProcessHistoryID_ != lbp->aux().processHistoryID()) {
183  if (reducedInputProcessHistoryID_ != ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(lbp->aux().processHistoryID())) {
185  << "PrincipalCache::insert\n"
186  << "Illegal attempt to insert lumi into cache\n"
187  << "luminosity block has ProcessHistoryID inconsistent with run\n"
188  << "Contact a Framework Developer\n";
189  }
190  inputProcessHistoryID_ = lbp->aux().processHistoryID();
191  }
192  if (lbp->run() != run_) {
194  << "PrincipalCache::insert\n"
195  << "Illegal attempt to insert lumi into cache\n"
196  << "luminosity block inconsistent with run number of run in cache\n"
197  << "Contact a Framework Developer\n";
198  }
199  lumi_ = lbp->luminosityBlock();
200  lumiPrincipal_ = lbp;
201  }
static ThreadSafeRegistry * instance()
LuminosityBlockNumber_t lumi_
ProcessHistoryID reducedInputProcessHistoryID_
boost::shared_ptr< RunPrincipal > runPrincipal_
ProcessHistoryID inputProcessHistoryID_
boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
void edm::PrincipalCache::insert ( boost::shared_ptr< EventPrincipal ep)
inline

Definition at line 64 of file PrincipalCache.h.

References eventPrincipal_.

64 { eventPrincipal_ = ep; }
boost::shared_ptr< EventPrincipal > eventPrincipal_
LuminosityBlockPrincipal & edm::PrincipalCache::lumiPrincipal ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
) const

Definition at line 55 of file PrincipalCache.cc.

References lumi_, lumiPrincipal_, reducedInputProcessHistoryID_, run_, and throwLumiMissing().

Referenced by edm::InputSource::markLumi(), and edm::SubProcess::writeLumi().

55  {
56  if (phid != reducedInputProcessHistoryID_ ||
57  run != run_ ||
58  lumi != lumi_ ||
59  lumiPrincipal_.get() == 0) {
61  }
62  return *lumiPrincipal_.get();
63  }
tuple lumi
Definition: fjr2json.py:35
void throwLumiMissing() const
LuminosityBlockNumber_t lumi_
ProcessHistoryID reducedInputProcessHistoryID_
boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
LuminosityBlockPrincipal & edm::PrincipalCache::lumiPrincipal ( ) const

Definition at line 77 of file PrincipalCache.cc.

References lumiPrincipal_, and throwLumiMissing().

77  {
78  if (lumiPrincipal_.get() == 0) {
80  }
81  return *lumiPrincipal_.get();
82  }
void throwLumiMissing() const
boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
boost::shared_ptr< LuminosityBlockPrincipal > const & edm::PrincipalCache::lumiPrincipalPtr ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
) const

Definition at line 66 of file PrincipalCache.cc.

References lumi_, lumiPrincipal_, reducedInputProcessHistoryID_, run_, and throwLumiMissing().

Referenced by edm::SubProcess::beginLuminosityBlock(), edm::SubProcess::endLuminosityBlock(), edm::InputSource::luminosityBlockPrincipal(), edm::InputSource::readAndCacheLumi(), and edm::SubProcess::write().

66  {
67  if (phid != reducedInputProcessHistoryID_ ||
68  run != run_ ||
69  lumi != lumi_ ||
70  lumiPrincipal_.get() == 0) {
72  }
73  return lumiPrincipal_;
74  }
tuple lumi
Definition: fjr2json.py:35
void throwLumiMissing() const
LuminosityBlockNumber_t lumi_
ProcessHistoryID reducedInputProcessHistoryID_
boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
boost::shared_ptr< LuminosityBlockPrincipal > const & edm::PrincipalCache::lumiPrincipalPtr ( ) const

Definition at line 85 of file PrincipalCache.cc.

References lumiPrincipal_, and throwLumiMissing().

85  {
86  if (lumiPrincipal_.get() == 0) {
88  }
89  return lumiPrincipal_;
90  }
void throwLumiMissing() const
boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
void edm::PrincipalCache::merge ( boost::shared_ptr< RunAuxiliary aux,
boost::shared_ptr< ProductRegistry const >  reg 
)

Definition at line 92 of file PrincipalCache.cc.

References edm::hlt::Exception, edm::detail::ThreadSafeRegistry< KEY, T, E >::extra(), inputProcessHistoryID_, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::errors::LogicError, reducedInputProcessHistoryID_, run_, and runPrincipal_.

Referenced by edm::InputSource::readAndCacheLumi(), and edm::InputSource::readAndCacheRun().

92  {
93  if (runPrincipal_.get() == 0) {
95  << "PrincipalCache::merge\n"
96  << "Illegal attempt to merge run into cache\n"
97  << "There is no run in cache to merge with\n"
98  << "Contact a Framework Developer\n";
99  }
100  if (inputProcessHistoryID_ != aux->processHistoryID()) {
101  if (reducedInputProcessHistoryID_ != ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(aux->processHistoryID())) {
103  << "PrincipalCache::insert\n"
104  << "Illegal attempt to merge run into cache\n"
105  << "Reduced ProcessHistoryID inconsistent with the one already in cache\n"
106  << "Contact a Framework Developer\n";
107  }
108  inputProcessHistoryID_ = aux->processHistoryID();
109  }
110  if (aux->run() != run_) {
112  << "PrincipalCache::insert\n"
113  << "Illegal attempt to merge run into cache\n"
114  << "Run number inconsistent with run number already in cache\n"
115  << "Contact a Framework Developer\n";
116  }
117  bool runOK = runPrincipal_->adjustToNewProductRegistry(*reg);
118  assert(runOK);
119  runPrincipal_->mergeAuxiliary(*aux);
120  }
static ThreadSafeRegistry * instance()
ProcessHistoryID reducedInputProcessHistoryID_
boost::shared_ptr< RunPrincipal > runPrincipal_
ProcessHistoryID inputProcessHistoryID_
void edm::PrincipalCache::merge ( boost::shared_ptr< LuminosityBlockAuxiliary aux,
boost::shared_ptr< ProductRegistry const >  reg 
)

Definition at line 122 of file PrincipalCache.cc.

References edm::hlt::Exception, edm::detail::ThreadSafeRegistry< KEY, T, E >::extra(), inputProcessHistoryID_, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::errors::LogicError, lumi_, lumiPrincipal_, reducedInputProcessHistoryID_, and run_.

122  {
123  if (lumiPrincipal_.get() == 0) {
125  << "PrincipalCache::merge\n"
126  << "Illegal attempt to merge luminosity block into cache\n"
127  << "There is no luminosity block in the cache to merge with\n"
128  << "Contact a Framework Developer\n";
129  }
130  if (inputProcessHistoryID_ != aux->processHistoryID()) {
131  if (reducedInputProcessHistoryID_ != ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(aux->processHistoryID())) {
133  << "PrincipalCache::insert\n"
134  << "Illegal attempt to merge run into cache\n"
135  << "Reduced ProcessHistoryID inconsistent with the one already in cache\n"
136  << "Contact a Framework Developer\n";
137  }
138  inputProcessHistoryID_ = aux->processHistoryID();
139  }
140  if (aux->run() != run_ ||
141  aux->luminosityBlock() != lumi_) {
143  << "PrincipalCache::insert\n"
144  << "Illegal attempt to merge lumi into cache\n"
145  << "Run and lumi numbers are inconsistent with the ones already in the cache\n"
146  << "Contact a Framework Developer\n";
147  }
148  bool lumiOK = lumiPrincipal_->adjustToNewProductRegistry(*reg);
149  assert(lumiOK);
150  lumiPrincipal_->mergeAuxiliary(*aux);
151  }
static ThreadSafeRegistry * instance()
LuminosityBlockNumber_t lumi_
ProcessHistoryID reducedInputProcessHistoryID_
ProcessHistoryID inputProcessHistoryID_
boost::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
RunPrincipal & edm::PrincipalCache::runPrincipal ( ProcessHistoryID const &  phid,
RunNumber_t  run 
) const

Definition at line 19 of file PrincipalCache.cc.

References reducedInputProcessHistoryID_, run_, runPrincipal_, and throwRunMissing().

Referenced by edm::InputSource::markRun(), and edm::SubProcess::writeRun().

19  {
20  if (phid != reducedInputProcessHistoryID_ ||
21  run != run_ ||
22  runPrincipal_.get() == 0) {
24  }
25  return *runPrincipal_.get();
26  }
void throwRunMissing() const
ProcessHistoryID reducedInputProcessHistoryID_
boost::shared_ptr< RunPrincipal > runPrincipal_
RunPrincipal & edm::PrincipalCache::runPrincipal ( ) const

Definition at line 39 of file PrincipalCache.cc.

References runPrincipal_, and throwRunMissing().

39  {
40  if (runPrincipal_.get() == 0) {
42  }
43  return *runPrincipal_.get();
44  }
void throwRunMissing() const
boost::shared_ptr< RunPrincipal > runPrincipal_
boost::shared_ptr< RunPrincipal > const & edm::PrincipalCache::runPrincipalPtr ( ProcessHistoryID const &  phid,
RunNumber_t  run 
) const
boost::shared_ptr< RunPrincipal > const & edm::PrincipalCache::runPrincipalPtr ( ) const

Definition at line 47 of file PrincipalCache.cc.

References runPrincipal_, and throwRunMissing().

47  {
48  if (runPrincipal_.get() == 0) {
50  }
51  return runPrincipal_;
52  }
void throwRunMissing() const
boost::shared_ptr< RunPrincipal > runPrincipal_
void edm::PrincipalCache::throwLumiMissing ( ) const
private

Definition at line 268 of file PrincipalCache.cc.

References edm::hlt::Exception, and edm::errors::LogicError.

Referenced by lumiPrincipal(), and lumiPrincipalPtr().

268  {
270  << "PrincipalCache::lumiPrincipal or PrincipalCache::lumiPrincipalPtr\n"
271  << "Requested a luminosity block that is not in the cache (should never happen)\n"
272  << "Contact a Framework Developer\n";
273  }
void edm::PrincipalCache::throwRunMissing ( ) const
private

Definition at line 260 of file PrincipalCache.cc.

References edm::hlt::Exception, and edm::errors::LogicError.

Referenced by runPrincipal(), and runPrincipalPtr().

260  {
262  << "PrincipalCache::runPrincipal\n"
263  << "Requested a run that is not in the cache (should never happen)\n"
264  << "Contact a Framework Developer\n";
265  }

Member Data Documentation

boost::shared_ptr<EventPrincipal> edm::PrincipalCache::eventPrincipal_
private

Definition at line 82 of file PrincipalCache.h.

Referenced by adjustEventToNewProductRegistry(), eventPrincipal(), and insert().

ProcessHistoryID edm::PrincipalCache::inputProcessHistoryID_
private

Definition at line 91 of file PrincipalCache.h.

Referenced by insert(), and merge().

LuminosityBlockNumber_t edm::PrincipalCache::lumi_
private

Definition at line 94 of file PrincipalCache.h.

Referenced by deleteLumi(), insert(), lumiPrincipal(), lumiPrincipalPtr(), and merge().

boost::shared_ptr<LuminosityBlockPrincipal> edm::PrincipalCache::lumiPrincipal_
private
ProcessHistoryID edm::PrincipalCache::reducedInputProcessHistoryID_
private
RunNumber_t edm::PrincipalCache::run_
private
boost::shared_ptr<RunPrincipal> edm::PrincipalCache::runPrincipal_
private