CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

edm::PrincipalCache Class Reference

#include <PrincipalCache.h>

List of all members.

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< EventPrincipal > ep)
void insert (boost::shared_ptr< RunPrincipal > rp)
void insert (boost::shared_ptr< LuminosityBlockPrincipal > lbp)
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< LuminosityBlockAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg)
void merge (boost::shared_ptr< RunAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg)
 PrincipalCache ()
RunPrincipalrunPrincipal () const
RunPrincipalrunPrincipal (ProcessHistoryID const &phid, RunNumber_t run) 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.

                                 :
    run_(0U),
    lumi_(0U) {
  }
edm::PrincipalCache::~PrincipalCache ( )

Definition at line 16 of file PrincipalCache.cc.

{ }

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().

                                                                                                 {
    if (eventPrincipal_) {
      eventPrincipal_->adjustIndexesAfterProductRegistryAddition();
      bool eventOK = eventPrincipal_->adjustToNewProductRegistry(*reg);
      assert(eventOK);
    }
  }
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().

                                                                 {
    if (runPrincipal_) {
      runPrincipal_->adjustIndexesAfterProductRegistryAddition();
    }
    if (lumiPrincipal_) {
      lumiPrincipal_->adjustIndexesAfterProductRegistryAddition();
    }
  }
void edm::PrincipalCache::deleteLumi ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
)

Definition at line 222 of file PrincipalCache.cc.

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

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

                                                                                                             {
    if (lumiPrincipal_.get() == 0) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::deleteLumi\n"
        << "Illegal attempt to delete luminosity block from cache\n"
        << "There is no luminosity block in the cache to delete\n"
        << "Contact a Framework Developer\n";
    }
    if (reducedInputProcessHistoryID_ != phid ||
        run != run_ ||
        lumi != lumi_) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::deleteLumi\n"
        << "Illegal attempt to delete luminosity block from cache\n"
        << "Run number, lumi numbers, or reduced ProcessHistoryID inconsistent with those in cache\n"
        << "Contact a Framework Developer\n";
    }
    lumiPrincipal_.reset();
  }
void edm::PrincipalCache::deleteRun ( ProcessHistoryID const &  phid,
RunNumber_t  run 
)

Definition at line 203 of file PrincipalCache.cc.

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

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

                                                                              {
    if (runPrincipal_.get() == 0) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::deleteRun\n"
        << "Illegal attempt to delete run from cache\n"
        << "There is no run in cache to delete\n"
        << "Contact a Framework Developer\n";
    }
    if (reducedInputProcessHistoryID_ != phid ||
        run != run_) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::deleteRun\n"
        << "Illegal attempt to delete run from cache\n"
        << "Run number or reduced ProcessHistoryID inconsistent with those in cache\n"
        << "Contact a Framework Developer\n";
    }
    runPrincipal_.reset();
  }
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().

{ return *eventPrincipal_; }
void edm::PrincipalCache::insert ( boost::shared_ptr< LuminosityBlockPrincipal lbp)

Definition at line 168 of file PrincipalCache.cc.

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

                                                                           {
    if (lumiPrincipal_.get() != 0) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::insert\n"
        << "Illegal attempt to insert lumi into cache\n"
        << "Contact a Framework Developer\n";
    }
    if (runPrincipal_.get() == 0) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::insert\n"
        << "Illegal attempt to insert lumi into cache\n"
        << "Run is invalid\n"
        << "Contact a Framework Developer\n";
    }
    if (inputProcessHistoryID_ != lbp->aux().processHistoryID()) {
      if (reducedInputProcessHistoryID_ != ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(lbp->aux().processHistoryID())) {
        throw edm::Exception(edm::errors::LogicError)
          << "PrincipalCache::insert\n"
          << "Illegal attempt to insert lumi into cache\n"
          << "luminosity block has ProcessHistoryID inconsistent with run\n"
          << "Contact a Framework Developer\n";
      }
      inputProcessHistoryID_ = lbp->aux().processHistoryID();
    }
    if (lbp->run() != run_) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::insert\n"
        << "Illegal attempt to insert lumi into cache\n"
        << "luminosity block inconsistent with run number of run in cache\n"
        << "Contact a Framework Developer\n";
    }
    lumi_ = lbp->luminosityBlock();
    lumiPrincipal_ = lbp; 
  }
void edm::PrincipalCache::insert ( boost::shared_ptr< RunPrincipal rp)

Definition at line 153 of file PrincipalCache.cc.

References Exception, inputProcessHistoryID_, 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().

                                                              {
    if (runPrincipal_.get() != 0) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::insert\n"
        << "Illegal attempt to insert run into cache\n"
        << "Contact a Framework Developer\n";
    }
    if (inputProcessHistoryID_ != rp->aux().processHistoryID()) {
      reducedInputProcessHistoryID_ = ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(rp->aux().processHistoryID());
      inputProcessHistoryID_ = rp->aux().processHistoryID();
    }
    run_ = rp->run();
    runPrincipal_ = rp; 
  }
void edm::PrincipalCache::insert ( boost::shared_ptr< EventPrincipal ep) [inline]

Definition at line 64 of file PrincipalCache.h.

References eventPrincipal_.

{ eventPrincipal_ = ep; }
LuminosityBlockPrincipal & edm::PrincipalCache::lumiPrincipal ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
) const
LuminosityBlockPrincipal & edm::PrincipalCache::lumiPrincipal ( ) const

Definition at line 77 of file PrincipalCache.cc.

References lumiPrincipal_, and throwLumiMissing().

                                      {
    if (lumiPrincipal_.get() == 0) {
      throwLumiMissing();
    }
    return *lumiPrincipal_.get();
  }
boost::shared_ptr< LuminosityBlockPrincipal > const & edm::PrincipalCache::lumiPrincipalPtr ( ) const

Definition at line 85 of file PrincipalCache.cc.

References lumiPrincipal_, and throwLumiMissing().

                                         {
    if (lumiPrincipal_.get() == 0) {
      throwLumiMissing();
    }
    return lumiPrincipal_;
  }
boost::shared_ptr< LuminosityBlockPrincipal > const & edm::PrincipalCache::lumiPrincipalPtr ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
) const
void edm::PrincipalCache::merge ( boost::shared_ptr< LuminosityBlockAuxiliary aux,
boost::shared_ptr< ProductRegistry const >  reg 
)

Definition at line 122 of file PrincipalCache.cc.

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

                                                                                                                      {
    if (lumiPrincipal_.get() == 0) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::merge\n"
        << "Illegal attempt to merge luminosity block into cache\n"
        << "There is no luminosity block in the cache to merge with\n"
        << "Contact a Framework Developer\n";
    }
    if (inputProcessHistoryID_ != aux->processHistoryID()) {
      if (reducedInputProcessHistoryID_ != ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(aux->processHistoryID())) {
        throw edm::Exception(edm::errors::LogicError)
          << "PrincipalCache::insert\n"
          << "Illegal attempt to merge run into cache\n"
          << "Reduced ProcessHistoryID inconsistent with the one already in cache\n"
          << "Contact a Framework Developer\n";
      }
      inputProcessHistoryID_ = aux->processHistoryID();
    }
    if (aux->run() != run_ ||
        aux->luminosityBlock() != lumi_) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::insert\n"
        << "Illegal attempt to merge lumi into cache\n"
        << "Run and lumi numbers are inconsistent with the ones already in the cache\n"
        << "Contact a Framework Developer\n";
    }
    bool lumiOK = lumiPrincipal_->adjustToNewProductRegistry(*reg);
    assert(lumiOK);
    lumiPrincipal_->mergeAuxiliary(*aux);
  }
void edm::PrincipalCache::merge ( boost::shared_ptr< RunAuxiliary aux,
boost::shared_ptr< ProductRegistry const >  reg 
)

Definition at line 92 of file PrincipalCache.cc.

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

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

                                                                                                          {
    if (runPrincipal_.get() == 0) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::merge\n"
        << "Illegal attempt to merge run into cache\n"
        << "There is no run in cache to merge with\n"
        << "Contact a Framework Developer\n";
    }
    if (inputProcessHistoryID_ != aux->processHistoryID()) {
      if (reducedInputProcessHistoryID_ != ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(aux->processHistoryID())) {
        throw edm::Exception(edm::errors::LogicError)
          << "PrincipalCache::insert\n"
          << "Illegal attempt to merge run into cache\n"
          << "Reduced ProcessHistoryID inconsistent with the one already in cache\n"
          << "Contact a Framework Developer\n";
      }
      inputProcessHistoryID_ = aux->processHistoryID();
    }
    if (aux->run() != run_) {
      throw edm::Exception(edm::errors::LogicError)
        << "PrincipalCache::insert\n"
        << "Illegal attempt to merge run into cache\n"
        << "Run number inconsistent with run number already in cache\n"
        << "Contact a Framework Developer\n";
    }
    bool runOK = runPrincipal_->adjustToNewProductRegistry(*reg);
    assert(runOK);
    runPrincipal_->mergeAuxiliary(*aux);
  }
RunPrincipal & edm::PrincipalCache::runPrincipal ( ProcessHistoryID const &  phid,
RunNumber_t  run 
) const
RunPrincipal & edm::PrincipalCache::runPrincipal ( ) const

Definition at line 39 of file PrincipalCache.cc.

References runPrincipal_, and throwRunMissing().

                                     {
    if (runPrincipal_.get() == 0) {
      throwRunMissing();
    }
    return *runPrincipal_.get();
  }
boost::shared_ptr< RunPrincipal > const & edm::PrincipalCache::runPrincipalPtr ( ) const

Definition at line 47 of file PrincipalCache.cc.

References runPrincipal_, and throwRunMissing().

                                        {
    if (runPrincipal_.get() == 0) {
      throwRunMissing();
    }
    return runPrincipal_;
  }
boost::shared_ptr< RunPrincipal > const & edm::PrincipalCache::runPrincipalPtr ( ProcessHistoryID const &  phid,
RunNumber_t  run 
) const
void edm::PrincipalCache::throwLumiMissing ( ) const [private]

Definition at line 268 of file PrincipalCache.cc.

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

Referenced by lumiPrincipal(), and lumiPrincipalPtr().

                                         {
    throw edm::Exception(edm::errors::LogicError)
      << "PrincipalCache::lumiPrincipal or PrincipalCache::lumiPrincipalPtr\n"
      << "Requested a luminosity block that is not in the cache (should never happen)\n"
      << "Contact a Framework Developer\n";
  }
void edm::PrincipalCache::throwRunMissing ( ) const [private]

Definition at line 260 of file PrincipalCache.cc.

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

Referenced by runPrincipal(), and runPrincipalPtr().

                                        {
    throw edm::Exception(edm::errors::LogicError)
      << "PrincipalCache::runPrincipal\n"
      << "Requested a run that is not in the cache (should never happen)\n"
      << "Contact a Framework Developer\n";
  }

Member Data Documentation

Definition at line 82 of file PrincipalCache.h.

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

Definition at line 91 of file PrincipalCache.h.

Referenced by insert(), and merge().

Definition at line 94 of file PrincipalCache.h.

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

boost::shared_ptr<RunPrincipal> edm::PrincipalCache::runPrincipal_ [private]