CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends
edm::Run Class Reference

#include <Run.h>

Inheritance diagram for edm::Run:
edm::RunBase

Public Types

typedef PrincipalGetAdapter Base
 
typedef unsigned long CacheIdentifier_t
 

Public Member Functions

CacheIdentifier_t cacheIdentifier () const
 
void getAllStableProvenance (std::vector< StableProvenance const * > &provenances) const
 
template<typename PROD >
bool getByLabel (std::string const &label, Handle< PROD > &result) const
 
template<typename PROD >
bool getByLabel (std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
 
template<typename PROD >
bool getByLabel (InputTag const &tag, Handle< PROD > &result) const
 same as above, but using the InputTag class More...
 
template<typename PROD >
bool getByToken (EDGetToken token, Handle< PROD > &result) const
 
template<typename PROD >
bool getByToken (EDGetTokenT< PROD > token, Handle< PROD > &result) const
 
template<typename PROD >
void getManyByType (std::vector< Handle< PROD > > &results) const
 
Provenance getProvenance (BranchID const &theID) const
 
RunIndex index () const
 
void labelsForToken (EDGetToken const &iToken, ProductLabels &oLabels) const
 
ModuleCallingContext const * moduleCallingContext () const
 
ProcessHistory const & processHistory () const
 
ProcessHistoryID const & processHistoryID () const
 
template<typename PROD >
void put (std::unique_ptr< PROD > product)
 Put a new product. More...
 
template<typename PROD >
void put (std::unique_ptr< PROD > product, std::string const &productInstanceName)
 Put a new product with a 'product instance name'. More...
 
 Run (RunPrincipal const &rp, ModuleDescription const &md, ModuleCallingContext const *)
 
RunAuxiliary const & runAuxiliary () const
 
void setConsumer (EDConsumerBase const *iConsumer)
 
void setSharedResourcesAcquirer (SharedResourcesAcquirer *iResourceAcquirer)
 
 ~Run ()
 
- Public Member Functions inherited from edm::RunBase
Timestamp const & beginTime () const
 
Timestamp const & endTime () const
 
template<typename PROD >
bool getByLabel (InputTag const &tag, Handle< PROD > &result) const
 same as above, but using the InputTag class More...
 
template<typename T >
bool getByLabel (InputTag const &tag, Handle< T > &result) const
 
RunID const & id () const
 
RunNumber_t run () const
 
 RunBase ()
 
virtual ~RunBase ()
 

Private Types

typedef std::vector< std::pair< edm::propagate_const< std::unique_ptr< WrapperBase > >, BranchDescription const * > > ProductPtrVec
 

Private Member Functions

void commit_ (std::vector< edm::ProductResolverIndex > const &iShouldPut)
 
virtual BasicHandle getByLabelImpl (std::type_info const &iWrapperType, std::type_info const &iProductType, InputTag const &iTag) const
 
ProductPtrVecputProducts ()
 
ProductPtrVec const & putProducts () const
 
RunPrincipal const & runPrincipal () const
 

Private Attributes

RunAuxiliary const & aux_
 
ModuleCallingContext const * moduleCallingContext_
 
PrincipalGetAdapter provRecorder_
 
ProductPtrVec putProducts_
 
SharedResourcesAcquirersharedResourcesAcquirer_
 

Static Private Attributes

static const std::string emptyString_
 

Friends

class InputSource
 
class ProducerBase
 
class RawInputSource
 
template<typename T >
class stream::ProducingModuleAdaptorBase
 

Detailed Description

Definition at line 42 of file Run.h.

Member Typedef Documentation

Definition at line 57 of file Run.h.

typedef unsigned long edm::Run::CacheIdentifier_t

If you are caching data from the Run, you should also keep this number. If this number changes then you know that the data you have cached is invalid. The value of '0' will never be returned so you can use that to denote that you have not yet checked the value.

Definition at line 76 of file Run.h.

typedef std::vector<std::pair<edm::propagate_const<std::unique_ptr<WrapperBase> >, BranchDescription const*> > edm::Run::ProductPtrVec
private

Definition at line 150 of file Run.h.

Constructor & Destructor Documentation

Run::Run ( RunPrincipal const &  rp,
ModuleDescription const &  md,
ModuleCallingContext const *  moduleCallingContext 
)

Definition at line 11 of file Run.cc.

12  :
13  provRecorder_(rp, md),
14  aux_(rp.aux()),
16  }
RunAuxiliary const & aux_
Definition: Run.h:167
ModuleCallingContext const * moduleCallingContext() const
Definition: Run.h:139
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
Run::~Run ( )

Definition at line 18 of file Run.cc.

18  {
19  }

Member Function Documentation

Run::CacheIdentifier_t Run::cacheIdentifier ( ) const

Definition at line 22 of file Run.cc.

References edm::Principal::cacheIdentifier(), and runPrincipal().

22 {return runPrincipal().cacheIdentifier();}
CacheIdentifier_t cacheIdentifier() const
Definition: Principal.h:182
RunPrincipal const & runPrincipal() const
Definition: Run.cc:27
void Run::commit_ ( std::vector< edm::ProductResolverIndex > const &  iShouldPut)
private

Definition at line 79 of file Run.cc.

References begin, end, edm::get_underlying_safe(), index(), eostools::move(), AlCaHLTBitMon_ParallelJobs::p, edm::PrincipalGetAdapter::principal(), provRecorder_, edm::RunPrincipal::put(), putProducts(), runPrincipal(), and findQualityFiles::size.

Referenced by edm::stream::ProducingModuleAdaptorBase< EDProducerBase >::commit(), edm::InputSource::doBeginRun(), and edm::InputSource::doEndRun().

79  {
80  RunPrincipal const& rp = runPrincipal();
81  ProductPtrVec::iterator pit(putProducts().begin());
82  ProductPtrVec::iterator pie(putProducts().end());
83 
84  while(pit != pie) {
85  rp.put(*pit->second, std::move(get_underlying_safe(pit->first)));
86  ++pit;
87  }
88 
89  auto sz = iShouldPut.size();
90  if(sz !=0 and sz != putProducts().size()) {
91  //some were missed
92  auto& p = provRecorder_.principal();
93  for(auto index: iShouldPut){
94  auto resolver = p.getProductResolverByIndex(index);
95  if(not resolver->productResolved()) {
96  resolver->putProduct(std::unique_ptr<WrapperBase>());
97  }
98  }
99  }
100 
101  // the cleanup is all or none
102  putProducts().clear();
103  }
size
Write out results.
Principal const & principal() const
RunIndex index() const
Definition: Run.cc:24
#define end
Definition: vmac.h:37
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
RunPrincipal const & runPrincipal() const
Definition: Run.cc:27
ProductPtrVec & putProducts()
Definition: Run.h:151
#define begin
Definition: vmac.h:30
def move(src, dest)
Definition: eostools.py:510
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
void Run::getAllStableProvenance ( std::vector< StableProvenance const * > &  provenances) const

Definition at line 37 of file Run.cc.

References edm::Principal::getAllStableProvenance(), and runPrincipal().

Referenced by GlobalHitsProdHistStripper::beginRun().

37  {
38  runPrincipal().getAllStableProvenance(provenances);
39  }
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
Definition: Principal.cc:781
RunPrincipal const & runPrincipal() const
Definition: Run.cc:27
template<typename PROD >
bool Run::getByLabel ( std::string const &  label,
Handle< PROD > &  result 
) const
template<typename PROD >
bool Run::getByLabel ( std::string const &  label,
std::string const &  productInstanceName,
Handle< PROD > &  result 
) const

Definition at line 207 of file Run.h.

References edm::HandleBase::clear(), edm::convert_handle(), edm::HandleBase::failedToGet(), eostools::move(), PROD, and edm::principal_get_adapter_detail::throwOnPrematureRead().

209  {
211  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), label, productInstanceName);
212  }
213  result.clear();
214  BasicHandle bh = provRecorder_.getByLabel_(TypeID(typeid(PROD)), label, productInstanceName, emptyString_, moduleCallingContext_);
215  convert_handle(std::move(bh), result); // throws on conversion error
216  if (result.failedToGet()) {
217  return false;
218  }
219  return true;
220  }
static const std::string emptyString_
Definition: Run.h:171
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag, ModuleCallingContext const *mcc) const
void convert_handle(BasicHandle &&bh, Handle< T > &result)
Definition: ConvertHandle.h:20
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
def move(src, dest)
Definition: eostools.py:510
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
template<typename PROD >
bool Run::getByLabel ( InputTag const &  tag,
Handle< PROD > &  result 
) const

same as above, but using the InputTag class

Definition at line 225 of file Run.h.

References edm::HandleBase::clear(), edm::convert_handle(), edm::HandleBase::failedToGet(), edm::InputTag::instance(), edm::InputTag::label(), eostools::move(), PROD, and edm::principal_get_adapter_detail::throwOnPrematureRead().

225  {
227  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), tag.label(), tag.instance());
228  }
229  result.clear();
230  BasicHandle bh = provRecorder_.getByLabel_(TypeID(typeid(PROD)), tag, moduleCallingContext_);
231  convert_handle(std::move(bh), result); // throws on conversion error
232  if (result.failedToGet()) {
233  return false;
234  }
235  return true;
236  }
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag, ModuleCallingContext const *mcc) const
void convert_handle(BasicHandle &&bh, Handle< T > &result)
Definition: ConvertHandle.h:20
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
def move(src, dest)
Definition: eostools.py:510
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
BasicHandle Run::getByLabelImpl ( std::type_info const &  iWrapperType,
std::type_info const &  iProductType,
InputTag const &  iTag 
) const
privatevirtual

Implements edm::RunBase.

Definition at line 116 of file Run.cc.

References edm::PrincipalGetAdapter::getByLabel_(), h, moduleCallingContext_, and provRecorder_.

116  {
117  BasicHandle h = provRecorder_.getByLabel_(TypeID(iProductType), iTag, moduleCallingContext_);
118  return h;
119  }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag, ModuleCallingContext const *mcc) const
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
template<typename PROD >
bool Run::getByToken ( EDGetToken  token,
Handle< PROD > &  result 
) const

Definition at line 240 of file Run.h.

References edm::HandleBase::clear(), edm::convert_handle(), edm::HandleBase::failedToGet(), eostools::move(), PROD, edm::PRODUCT_TYPE, and edm::principal_get_adapter_detail::throwOnPrematureRead().

Referenced by L1GtAnalyzer::analyzeConditionsInRunBlock(), L1GtAnalyzer::analyzeL1GtTriggerMenuLite(), HLTPrescaleRecorder::beginRun(), pat::PATTriggerEventProducer::beginRun(), RunHistogramManager::beginRun(), LHEWriter::endRun(), GenXSecAnalyzer::endRun(), edm::GetterOfProducts< trigger::HLTPrescaleTable >::fillHandles(), EDMtoMEConverter::Tokens< T >::getData(), AlignmentProducerAsAnalyzer::getTkFittedLasBeamCollection(), AlignmentProducerAsAnalyzer::getTsosVectorCollection(), PrescaleWeightProvider::initRun(), and L1GtUtils::retrieveL1GtTriggerMenuLite().

240  {
242  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), token);
243  }
244  result.clear();
245  BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)),PRODUCT_TYPE, token, moduleCallingContext_);
246  convert_handle(std::move(bh), result); // throws on conversion error
247  if (result.failedToGet()) {
248  return false;
249  }
250  return true;
251  }
BasicHandle getByToken_(TypeID const &id, KindOfType kindOfType, EDGetToken token, ModuleCallingContext const *mcc) const
void convert_handle(BasicHandle &&bh, Handle< T > &result)
Definition: ConvertHandle.h:20
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
def move(src, dest)
Definition: eostools.py:510
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
template<typename PROD >
bool Run::getByToken ( EDGetTokenT< PROD token,
Handle< PROD > &  result 
) const

Definition at line 255 of file Run.h.

References edm::HandleBase::clear(), edm::convert_handle(), edm::HandleBase::failedToGet(), eostools::move(), PROD, edm::PRODUCT_TYPE, and edm::principal_get_adapter_detail::throwOnPrematureRead().

255  {
257  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), token);
258  }
259  result.clear();
260  BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)),PRODUCT_TYPE, token, moduleCallingContext_);
261  convert_handle(std::move(bh), result); // throws on conversion error
262  if (result.failedToGet()) {
263  return false;
264  }
265  return true;
266  }
BasicHandle getByToken_(TypeID const &id, KindOfType kindOfType, EDGetToken token, ModuleCallingContext const *mcc) const
void convert_handle(BasicHandle &&bh, Handle< T > &result)
Definition: ConvertHandle.h:20
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
def move(src, dest)
Definition: eostools.py:510
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
template<typename PROD >
void Run::getManyByType ( std::vector< Handle< PROD > > &  results) const

Definition at line 270 of file Run.h.

References PROD, mps_update::results, and edm::principal_get_adapter_detail::throwOnPrematureRead().

Referenced by GlobalHitsProdHistStripper::endRun().

270  {
273  }
275  }
void getManyByType(std::vector< Handle< PROD > > &results, ModuleCallingContext const *mcc) const
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
Provenance Run::getProvenance ( BranchID const &  theID) const

Definition at line 32 of file Run.cc.

References edm::Principal::getProvenance(), moduleCallingContext_, and runPrincipal().

32  {
34  }
Provenance getProvenance(BranchID const &bid, ModuleCallingContext const *mcc) const
Definition: Principal.cc:745
RunPrincipal const & runPrincipal() const
Definition: Run.cc:27
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
RunIndex Run::index ( ) const
void edm::Run::labelsForToken ( EDGetToken const &  iToken,
ProductLabels oLabels 
) const
inline

Definition at line 141 of file Run.h.

141 { provRecorder_.labelsForToken(iToken, oLabels); }
void labelsForToken(EDGetToken const &iToken, ProductLabels &oLabels) const
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
ModuleCallingContext const* edm::Run::moduleCallingContext ( ) const
inline

Definition at line 139 of file Run.h.

Referenced by DQMEDAnalyzer::beginRun(), edm::PileUp::beginRun(), edm::PileUp::endRun(), and DQMEDAnalyzer::endRunSummary().

139 { return moduleCallingContext_; }
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
ProcessHistory const & Run::processHistory ( ) const
ProcessHistoryID const & Run::processHistoryID ( ) const

Definition at line 106 of file Run.cc.

References edm::Principal::processHistoryID(), and runPrincipal().

106  {
107  return runPrincipal().processHistoryID();
108  }
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:145
RunPrincipal const & runPrincipal() const
Definition: Run.cc:27
template<typename PROD >
void edm::Run::put ( std::unique_ptr< PROD product)
inline
template<typename PROD >
void Run::put ( std::unique_ptr< PROD product,
std::string const &  productInstanceName 
)

Put a new product with a 'product instance name'.

Definition at line 176 of file Run.h.

References eostools::move(), PROD, edm::principal_get_adapter_detail::throwOnPutOfNullProduct(), and relativeConstraints::value.

176  {
177  if (product.get() == 0) { // null pointer is illegal
178  TypeID typeID(typeid(PROD));
179  principal_get_adapter_detail::throwOnPutOfNullProduct("Run", typeID, productInstanceName);
180  }
181 
182  // The following will call post_insert if T has such a function,
183  // and do nothing if T has no such function.
185  DoPostInsert<PROD>,
186  DoNotPostInsert<PROD>> maybe_inserter;
187  maybe_inserter(product.get());
188 
189  BranchDescription const& desc =
190  provRecorder_.getBranchDescription(TypeID(*product), productInstanceName);
191 
192  std::unique_ptr<Wrapper<PROD> > wp(new Wrapper<PROD>(std::move(product)));
193  putProducts().emplace_back(std::move(wp), &desc);
194 
195  // product.release(); // The object has been copied into the Wrapper.
196  // The old copy must be deleted, so we cannot release ownership.
197  }
BranchDescription const & getBranchDescription(TypeID const &type, std::string const &productInstanceName) const
ProductPtrVec & putProducts()
Definition: Run.h:151
#define PROD(A, B)
void throwOnPutOfNullProduct(char const *principalType, TypeID const &productType, std::string const &productInstanceName)
def move(src, dest)
Definition: eostools.py:510
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
ProductPtrVec& edm::Run::putProducts ( )
inlineprivate

Definition at line 151 of file Run.h.

Referenced by commit_().

151 {return putProducts_;}
ProductPtrVec putProducts_
Definition: Run.h:166
ProductPtrVec const& edm::Run::putProducts ( ) const
inlineprivate

Definition at line 152 of file Run.h.

152 {return putProducts_;}
ProductPtrVec putProducts_
Definition: Run.h:166
RunAuxiliary const& edm::Run::runAuxiliary ( ) const
inlinevirtual
RunPrincipal const & Run::runPrincipal ( ) const
private

Definition at line 27 of file Run.cc.

References edm::PrincipalGetAdapter::principal(), and provRecorder_.

Referenced by cacheIdentifier(), commit_(), getAllStableProvenance(), getProvenance(), index(), and processHistoryID().

27  {
28  return dynamic_cast<RunPrincipal const&>(provRecorder_.principal());
29  }
Principal const & principal() const
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
void edm::Run::setConsumer ( EDConsumerBase const *  iConsumer)
inline

Definition at line 49 of file Run.h.

Referenced by edm::EDAnalyzer::doBeginRun(), edm::EDProducer::doBeginRun(), edm::EDFilter::doBeginRun(), edm::one::EDFilterBase::doBeginRun(), edm::one::EDProducerBase::doBeginRun(), edm::one::EDAnalyzerBase::doBeginRun(), edm::global::EDAnalyzerBase::doBeginRun(), edm::global::EDFilterBase::doBeginRun(), edm::global::EDProducerBase::doBeginRun(), edm::stream::ProducingModuleAdaptor< T, M, B >::doBeginRun(), edm::stream::EDAnalyzerAdaptor< T >::doBeginRun(), edm::EDAnalyzer::doEndRun(), edm::EDProducer::doEndRun(), edm::EDFilter::doEndRun(), edm::one::EDFilterBase::doEndRun(), edm::one::EDProducerBase::doEndRun(), edm::one::EDAnalyzerBase::doEndRun(), edm::global::EDAnalyzerBase::doEndRun(), edm::global::EDFilterBase::doEndRun(), edm::global::EDProducerBase::doEndRun(), edm::stream::ProducingModuleAdaptor< T, M, B >::doEndRun(), edm::stream::EDAnalyzerAdaptor< T >::doEndRun(), edm::global::EDAnalyzerBase::doStreamBeginRun(), edm::global::EDProducerBase::doStreamBeginRun(), edm::global::EDFilterBase::doStreamBeginRun(), edm::global::EDAnalyzerBase::doStreamEndRun(), edm::global::EDProducerBase::doStreamEndRun(), edm::global::EDFilterBase::doStreamEndRun(), edm::stream::EDAnalyzerAdaptorBase::doStreamEndRun(), and edm::stream::ProducingModuleAdaptorBase< T >::doStreamEndRun().

49  {
50  provRecorder_.setConsumer(iConsumer);
51  }
void setConsumer(EDConsumerBase const *iConsumer)
PrincipalGetAdapter provRecorder_
Definition: Run.h:165
void edm::Run::setSharedResourcesAcquirer ( SharedResourcesAcquirer iResourceAcquirer)
inline

Definition at line 53 of file Run.h.

53  {
54  provRecorder_.setSharedResourcesAcquirer(iResourceAcquirer);
55  }
void setSharedResourcesAcquirer(SharedResourcesAcquirer *iSra)
PrincipalGetAdapter provRecorder_
Definition: Run.h:165

Friends And Related Function Documentation

friend class InputSource
friend

Definition at line 158 of file Run.h.

friend class ProducerBase
friend

Definition at line 160 of file Run.h.

friend class RawInputSource
friend

Definition at line 159 of file Run.h.

template<typename T >
friend class stream::ProducingModuleAdaptorBase
friend

Definition at line 161 of file Run.h.

Member Data Documentation

RunAuxiliary const& edm::Run::aux_
private

Definition at line 167 of file Run.h.

std::string const Run::emptyString_
staticprivate

Definition at line 171 of file Run.h.

ModuleCallingContext const* edm::Run::moduleCallingContext_
private

Definition at line 168 of file Run.h.

Referenced by getByLabelImpl(), and getProvenance().

PrincipalGetAdapter edm::Run::provRecorder_
private

Definition at line 165 of file Run.h.

Referenced by commit_(), getByLabelImpl(), processHistory(), and runPrincipal().

ProductPtrVec edm::Run::putProducts_
private

Definition at line 166 of file Run.h.

SharedResourcesAcquirer* edm::Run::sharedResourcesAcquirer_
private

Definition at line 169 of file Run.h.