CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::PrincipalCache Class Reference

#include <PrincipalCache.h>

Public Member Functions

void adjustEventsToNewProductRegistry (std::shared_ptr< ProductRegistry const > reg)
 
void adjustIndexesAfterProductRegistryAddition ()
 
void deleteRun (ProcessHistoryID const &phid, RunNumber_t run)
 
EventPrincipaleventPrincipal (unsigned int iStreamIndex) const
 
std::shared_ptr< LuminosityBlockPrincipalgetAvailableLumiPrincipalPtr ()
 
bool hasRunPrincipal () const
 
void insert (std::shared_ptr< EventPrincipal > ep)
 
void insert (std::shared_ptr< RunPrincipal > rp)
 
void insert (std::unique_ptr< LuminosityBlockPrincipal > lbp)
 
void merge (std::shared_ptr< RunAuxiliary > aux, std::shared_ptr< ProductRegistry const > reg)
 
void preReadFile ()
 
 PrincipalCache ()
 
 PrincipalCache (PrincipalCache &&)=default
 
RunPrincipalrunPrincipal () const
 
RunPrincipalrunPrincipal (ProcessHistoryID const &phid, RunNumber_t run) const
 
std::shared_ptr< RunPrincipal > const & runPrincipalPtr () const
 
std::shared_ptr< RunPrincipal > const & runPrincipalPtr (ProcessHistoryID const &phid, RunNumber_t run) const
 
void setNumberOfConcurrentPrincipals (PreallocationConfiguration const &)
 
void setProcessHistoryRegistry (ProcessHistoryRegistry const &phr)
 
 ~PrincipalCache ()
 

Private Member Functions

void throwLumiMissing () const
 
void throwRunMissing () const
 

Private Attributes

std::vector< std::shared_ptr< EventPrincipal > > eventPrincipals_
 
ProcessHistoryID inputProcessHistoryID_
 
LuminosityBlockNumber_t lumi_
 
edm::ReusableObjectHolder< LuminosityBlockPrincipallumiHolder_
 
ProcessHistoryRegistry const * processHistoryRegistry_
 
ProcessHistoryID reducedInputProcessHistoryID_
 
RunNumber_t run_
 
std::shared_ptr< RunPrincipalrunPrincipal_
 

Detailed Description

Definition at line 47 of file PrincipalCache.h.

Constructor & Destructor Documentation

◆ PrincipalCache() [1/2]

edm::PrincipalCache::PrincipalCache ( )

Definition at line 12 of file PrincipalCache.cc.

12 : run_(0U), lumi_(0U) {}

◆ ~PrincipalCache()

edm::PrincipalCache::~PrincipalCache ( )

Definition at line 14 of file PrincipalCache.cc.

14 {}

◆ PrincipalCache() [2/2]

edm::PrincipalCache::PrincipalCache ( PrincipalCache &&  )
default

Member Function Documentation

◆ adjustEventsToNewProductRegistry()

void edm::PrincipalCache::adjustEventsToNewProductRegistry ( std::shared_ptr< ProductRegistry const >  reg)

◆ adjustIndexesAfterProductRegistryAddition()

void edm::PrincipalCache::adjustIndexesAfterProductRegistryAddition ( )

Definition at line 130 of file PrincipalCache.cc.

130  {
131  if (runPrincipal_) {
132  runPrincipal_->adjustIndexesAfterProductRegistryAddition();
133  }
134  //Need to temporarily hold all the lumis to clear out the lumiHolder_
135  std::vector<std::shared_ptr<LuminosityBlockPrincipal>> temp;
136  while (auto p = lumiHolder_.tryToGet()) {
137  p->adjustIndexesAfterProductRegistryAddition();
138  temp.emplace_back(std::move(p));
139  }
140  }

References lumiHolder_, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, runPrincipal_, and groupFilesInBlocks::temp.

Referenced by edm::EventProcessor::readFile().

◆ deleteRun()

void edm::PrincipalCache::deleteRun ( ProcessHistoryID const &  phid,
RunNumber_t  run 
)

Definition at line 103 of file PrincipalCache.cc.

103  {
104  if (runPrincipal_.get() == nullptr) {
105  throw edm::Exception(edm::errors::LogicError) << "PrincipalCache::deleteRun\n"
106  << "Illegal attempt to delete run from cache\n"
107  << "There is no run in cache to delete\n"
108  << "Contact a Framework Developer\n";
109  }
110  if (reducedInputProcessHistoryID_ != phid || run != run_) {
112  << "PrincipalCache::deleteRun\n"
113  << "Illegal attempt to delete run from cache\n"
114  << "Run number or reduced ProcessHistoryID inconsistent with those in cache\n"
115  << "Contact a Framework Developer\n";
116  }
117  runPrincipal_.reset();
118  }

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

Referenced by edm::SubProcess::deleteRunFromCache(), edm::EventProcessor::deleteRunFromCache(), and edm::test::TestProcessor::endRun().

◆ eventPrincipal()

EventPrincipal& edm::PrincipalCache::eventPrincipal ( unsigned int  iStreamIndex) const
inline

◆ getAvailableLumiPrincipalPtr()

std::shared_ptr< LuminosityBlockPrincipal > edm::PrincipalCache::getAvailableLumiPrincipalPtr ( )

◆ hasRunPrincipal()

bool edm::PrincipalCache::hasRunPrincipal ( ) const
inline

◆ insert() [1/3]

void edm::PrincipalCache::insert ( std::shared_ptr< EventPrincipal ep)

Definition at line 97 of file PrincipalCache.cc.

97  {
98  unsigned int iStreamIndex = ep->streamID().value();
99  assert(iStreamIndex < eventPrincipals_.size());
100  eventPrincipals_[iStreamIndex] = ep;
101  }

References cms::cuda::assert(), SiStripBadComponentsDQMServiceTemplate_cfg::ep, and eventPrincipals_.

◆ insert() [2/3]

void edm::PrincipalCache::insert ( std::shared_ptr< RunPrincipal rp)

Definition at line 81 of file PrincipalCache.cc.

81  {
82  if (runPrincipal_.get() != nullptr) {
83  throw edm::Exception(edm::errors::LogicError) << "PrincipalCache::insert\n"
84  << "Illegal attempt to insert run into cache\n"
85  << "Contact a Framework Developer\n";
86  }
87  if (inputProcessHistoryID_ != rp->aux().processHistoryID()) {
89  inputProcessHistoryID_ = rp->aux().processHistoryID();
90  }
91  run_ = rp->run();
92  runPrincipal_ = rp;
93  }

References Exception, inputProcessHistoryID_, edm::errors::LogicError, processHistoryRegistry_, reducedInputProcessHistoryID_, edm::ProcessHistoryRegistry::reducedProcessHistoryID(), run_, and runPrincipal_.

Referenced by edm::test::TestProcessor::beginRun(), edm::SubProcess::doBeginRunAsync(), edm::EventProcessor::init(), edm::EventProcessor::readRun(), edm::SubProcess::SubProcess(), and edm::test::TestProcessor::TestProcessor().

◆ insert() [3/3]

void edm::PrincipalCache::insert ( std::unique_ptr< LuminosityBlockPrincipal lbp)

Definition at line 95 of file PrincipalCache.cc.

95 { lumiHolder_.add(std::move(lbp)); }

References lumiHolder_, and eostools::move().

◆ merge()

void edm::PrincipalCache::merge ( std::shared_ptr< RunAuxiliary aux,
std::shared_ptr< ProductRegistry const >  reg 
)

Definition at line 53 of file PrincipalCache.cc.

53  {
54  if (runPrincipal_.get() == nullptr) {
55  throw edm::Exception(edm::errors::LogicError) << "PrincipalCache::merge\n"
56  << "Illegal attempt to merge run into cache\n"
57  << "There is no run in cache to merge with\n"
58  << "Contact a Framework Developer\n";
59  }
60  if (inputProcessHistoryID_ != aux->processHistoryID()) {
63  << "PrincipalCache::merge\n"
64  << "Illegal attempt to merge run into cache\n"
65  << "Reduced ProcessHistoryID inconsistent with the one already in cache\n"
66  << "Contact a Framework Developer\n";
67  }
68  inputProcessHistoryID_ = aux->processHistoryID();
69  }
70  if (aux->run() != run_) {
71  throw edm::Exception(edm::errors::LogicError) << "PrincipalCache::merge\n"
72  << "Illegal attempt to merge run into cache\n"
73  << "Run number inconsistent with run number already in cache\n"
74  << "Contact a Framework Developer\n";
75  }
76  bool runOK = runPrincipal_->adjustToNewProductRegistry(*reg);
77  assert(runOK);
78  runPrincipal_->mergeAuxiliary(*aux);
79  }

References cms::cuda::assert(), printConversionInfo::aux, Exception, inputProcessHistoryID_, edm::errors::LogicError, processHistoryRegistry_, reducedInputProcessHistoryID_, edm::ProcessHistoryRegistry::reducedProcessHistoryID(), run_, and runPrincipal_.

Referenced by edm::EventProcessor::readAndMergeRun().

◆ preReadFile()

void edm::PrincipalCache::preReadFile ( )

Definition at line 142 of file PrincipalCache.cc.

142  {
143  if (runPrincipal_) {
144  runPrincipal_->preReadFile();
145  }
146  }

References runPrincipal_.

Referenced by edm::EventProcessor::readFile().

◆ runPrincipal() [1/2]

RunPrincipal & edm::PrincipalCache::runPrincipal ( ) const

Definition at line 35 of file PrincipalCache.cc.

35  {
36  if (runPrincipal_.get() == nullptr) {
38  }
39  return *runPrincipal_.get();
40  }

References runPrincipal_, and throwRunMissing().

◆ runPrincipal() [2/2]

RunPrincipal & edm::PrincipalCache::runPrincipal ( ProcessHistoryID const &  phid,
RunNumber_t  run 
) const

◆ runPrincipalPtr() [1/2]

std::shared_ptr< RunPrincipal > const & edm::PrincipalCache::runPrincipalPtr ( ) const

Definition at line 42 of file PrincipalCache.cc.

42  {
43  if (runPrincipal_.get() == nullptr) {
45  }
46  return runPrincipal_;
47  }

References runPrincipal_, and throwRunMissing().

◆ runPrincipalPtr() [2/2]

std::shared_ptr< RunPrincipal > const & edm::PrincipalCache::runPrincipalPtr ( ProcessHistoryID const &  phid,
RunNumber_t  run 
) const

◆ setNumberOfConcurrentPrincipals()

void edm::PrincipalCache::setNumberOfConcurrentPrincipals ( PreallocationConfiguration const &  iConfig)

◆ setProcessHistoryRegistry()

void edm::PrincipalCache::setProcessHistoryRegistry ( ProcessHistoryRegistry const &  phr)
inline

◆ throwLumiMissing()

void edm::PrincipalCache::throwLumiMissing ( ) const
private

Definition at line 154 of file PrincipalCache.cc.

154  {
156  << "PrincipalCache::lumiPrincipal or PrincipalCache::lumiPrincipalPtr\n"
157  << "Requested a luminosity block that is not in the cache (should never happen)\n"
158  << "Contact a Framework Developer\n";
159  }

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

◆ throwRunMissing()

void edm::PrincipalCache::throwRunMissing ( ) const
private

Definition at line 148 of file PrincipalCache.cc.

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

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

Referenced by runPrincipal(), and runPrincipalPtr().

Member Data Documentation

◆ eventPrincipals_

std::vector<std::shared_ptr<EventPrincipal> > edm::PrincipalCache::eventPrincipals_
private

◆ inputProcessHistoryID_

ProcessHistoryID edm::PrincipalCache::inputProcessHistoryID_
private

Definition at line 100 of file PrincipalCache.h.

Referenced by insert(), and merge().

◆ lumi_

LuminosityBlockNumber_t edm::PrincipalCache::lumi_
private

Definition at line 103 of file PrincipalCache.h.

◆ lumiHolder_

edm::ReusableObjectHolder<LuminosityBlockPrincipal> edm::PrincipalCache::lumiHolder_
private

◆ processHistoryRegistry_

ProcessHistoryRegistry const* edm::PrincipalCache::processHistoryRegistry_
private

Definition at line 91 of file PrincipalCache.h.

Referenced by insert(), merge(), and setProcessHistoryRegistry().

◆ reducedInputProcessHistoryID_

ProcessHistoryID edm::PrincipalCache::reducedInputProcessHistoryID_
private

Definition at line 101 of file PrincipalCache.h.

Referenced by deleteRun(), insert(), merge(), runPrincipal(), and runPrincipalPtr().

◆ run_

RunNumber_t edm::PrincipalCache::run_
private

Definition at line 102 of file PrincipalCache.h.

Referenced by deleteRun(), insert(), merge(), runPrincipal(), and runPrincipalPtr().

◆ runPrincipal_

std::shared_ptr<RunPrincipal> edm::PrincipalCache::runPrincipal_
private
electrons_cff.bool
bool
Definition: electrons_cff.py:372
edm::errors::LogicError
Definition: EDMException.h:37
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::Principal::adjustToNewProductRegistry
bool adjustToNewProductRegistry(ProductRegistry const &reg)
Definition: Principal.cc:310
cms::cuda::assert
assert(be >=bs)
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::Principal::adjustIndexesAfterProductRegistryAddition
void adjustIndexesAfterProductRegistryAddition()
Definition: Principal.cc:884
edm::PrincipalCache::lumi_
LuminosityBlockNumber_t lumi_
Definition: PrincipalCache.h:103
edm::PrincipalCache::eventPrincipals_
std::vector< std::shared_ptr< EventPrincipal > > eventPrincipals_
Definition: PrincipalCache.h:88
edm::PrincipalCache::runPrincipal_
std::shared_ptr< RunPrincipal > runPrincipal_
Definition: PrincipalCache.h:86
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::PrincipalCache::processHistoryRegistry_
ProcessHistoryRegistry const * processHistoryRegistry_
Definition: PrincipalCache.h:91
printConversionInfo.aux
aux
Definition: printConversionInfo.py:19
edm::PrincipalCache::throwRunMissing
void throwRunMissing() const
Definition: PrincipalCache.cc:148
edm::PrincipalCache::reducedInputProcessHistoryID_
ProcessHistoryID reducedInputProcessHistoryID_
Definition: PrincipalCache.h:101
edm::PrincipalCache::inputProcessHistoryID_
ProcessHistoryID inputProcessHistoryID_
Definition: PrincipalCache.h:100
edm::ProcessHistoryRegistry::reducedProcessHistoryID
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
Definition: ProcessHistoryRegistry.cc:23
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Exception
Definition: hltDiff.cc:246
edm::PrincipalCache::eventPrincipal
EventPrincipal & eventPrincipal(unsigned int iStreamIndex) const
Definition: PrincipalCache.h:61
edm::PrincipalCache::lumiHolder_
edm::ReusableObjectHolder< LuminosityBlockPrincipal > lumiHolder_
Definition: PrincipalCache.h:87
edm::PrincipalCache::run_
RunNumber_t run_
Definition: PrincipalCache.h:102
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86