test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 getAllProvenance (std::vector< Provenance 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
 
ModuleCallingContext const * moduleCallingContext () const
 
ProcessHistory const & processHistory () const
 
ProcessHistoryID const & processHistoryID () const
 
template<typename PROD >
void put (std::auto_ptr< PROD > product)
 Put a new product. More...
 
template<typename PROD >
void put (std::auto_ptr< PROD > product, std::string const &productInstanceName)
 Put a new product with a 'product instance name'. More...
 
 Run (RunPrincipal &rp, ModuleDescription const &md, ModuleCallingContext const *)
 
RunAuxiliary const & runAuxiliary () const
 
void setConsumer (EDConsumerBase const *iConsumer)
 
 ~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::set< BranchIDBranchIDSet
 
typedef std::vector< std::pair
< WrapperOwningHolder,
BranchDescription const * > > 
ProductPtrVec
 

Private Member Functions

void addToGotBranchIDs (Provenance const &prov) const
 
void commit_ ()
 
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
 
RunPrincipalrunPrincipal ()
 

Private Attributes

RunAuxiliary const & aux_
 
BranchIDSet gotBranchIDs_
 
ModuleCallingContext const * moduleCallingContext_
 
PrincipalGetAdapter provRecorder_
 
ProductPtrVec putProducts_
 

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 41 of file Run.h.

Member Typedef Documentation

Definition at line 53 of file Run.h.

typedef std::set<BranchID> edm::Run::BranchIDSet
private

Definition at line 166 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 72 of file Run.h.

typedef std::vector<std::pair<WrapperOwningHolder, BranchDescription const*> > edm::Run::ProductPtrVec
private

Definition at line 147 of file Run.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file Run.cc.

11  :
12  provRecorder_(rp, md),
13  aux_(rp.aux()),
15  }
RunAuxiliary const & aux_
Definition: Run.h:165
ModuleCallingContext const * moduleCallingContext() const
Definition: Run.h:135
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
PrincipalGetAdapter provRecorder_
Definition: Run.h:163
Run::~Run ( )

Definition at line 17 of file Run.cc.

References edm::for_all(), and putProducts_.

17  {
18  // anything left here must be the result of a failure
19  // let's record them as failed attempts in the event principal
21  }
ProductPtrVec putProducts_
Definition: Run.h:164
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
tuple deleter
Definition: fff_deleter.py:279

Member Function Documentation

void Run::addToGotBranchIDs ( Provenance const &  prov) const
private

Definition at line 113 of file Run.cc.

References edm::Provenance::branchID(), and gotBranchIDs_.

Referenced by getByLabelImpl().

113  {
114  gotBranchIDs_.insert(prov.branchID());
115  }
BranchIDSet gotBranchIDs_
Definition: Run.h:167
Run::CacheIdentifier_t Run::cacheIdentifier ( ) const

Definition at line 24 of file Run.cc.

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

24 {return runPrincipal().cacheIdentifier();}
CacheIdentifier_t cacheIdentifier() const
Definition: Principal.h:171
RunPrincipal const & runPrincipal() const
Definition: Run.cc:34
void Run::commit_ ( )
private

Definition at line 86 of file Run.cc.

References begin, end, edm::RunPrincipal::put(), putProducts(), and runPrincipal().

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

86  {
87  RunPrincipal& rp = runPrincipal();
88  ProductPtrVec::iterator pit(putProducts().begin());
89  ProductPtrVec::iterator pie(putProducts().end());
90 
91  while(pit != pie) {
92  rp.put(*pit->second, pit->first);
93  // Ownership has passed, so clear the pointer.
94  pit->first.reset();
95  ++pit;
96  }
97 
98  // the cleanup is all or none
99  putProducts().clear();
100  }
#define end
Definition: vmac.h:37
RunPrincipal const & runPrincipal() const
Definition: Run.cc:34
ProductPtrVec & putProducts()
Definition: Run.h:148
#define begin
Definition: vmac.h:30
void Run::getAllProvenance ( std::vector< Provenance const * > &  provenances) const

Definition at line 44 of file Run.cc.

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

Referenced by GlobalHitsProdHistStripper::beginRun(), and L1GtUtils::getL1GtTriggerMenuLiteInputTag().

44  {
45  runPrincipal().getAllProvenance(provenances);
46  }
void getAllProvenance(std::vector< Provenance const * > &provenances) const
Definition: Principal.cc:759
RunPrincipal const & runPrincipal() const
Definition: Run.cc:34
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 206 of file Run.h.

References edm::PrincipalGetAdapter::checkIfComplete(), edm::HandleBase::clear(), edm::convert_handle(), emptyString_, edm::HandleBase::failedToGet(), edm::PrincipalGetAdapter::getByLabel_(), moduleCallingContext_, PROD, provRecorder_, and edm::principal_get_adapter_detail::throwOnPrematureRead().

208  {
210  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), label, productInstanceName);
211  }
212  result.clear();
213  BasicHandle bh = provRecorder_.getByLabel_(TypeID(typeid(PROD)), label, productInstanceName, emptyString_, moduleCallingContext_);
214  convert_handle(std::move(bh), result); // throws on conversion error
215  if (result.failedToGet()) {
216  return false;
217  }
218  return true;
219  }
static const std::string emptyString_
Definition: Run.h:170
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
PrincipalGetAdapter provRecorder_
Definition: Run.h:163
template<typename PROD >
bool Run::getByLabel ( InputTag const &  tag,
Handle< PROD > &  result 
) const

same as above, but using the InputTag class

Definition at line 224 of file Run.h.

References edm::PrincipalGetAdapter::checkIfComplete(), edm::HandleBase::clear(), edm::convert_handle(), edm::HandleBase::failedToGet(), edm::PrincipalGetAdapter::getByLabel_(), edm::InputTag::instance(), edm::InputTag::label(), moduleCallingContext_, PROD, provRecorder_, and edm::principal_get_adapter_detail::throwOnPrematureRead().

224  {
226  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), tag.label(), tag.instance());
227  }
228  result.clear();
229  BasicHandle bh = provRecorder_.getByLabel_(TypeID(typeid(PROD)), tag, moduleCallingContext_);
230  convert_handle(std::move(bh), result); // throws on conversion error
231  if (result.failedToGet()) {
232  return false;
233  }
234  return true;
235  }
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
PrincipalGetAdapter provRecorder_
Definition: Run.h:163
BasicHandle Run::getByLabelImpl ( std::type_info const &  iWrapperType,
std::type_info const &  iProductType,
InputTag const &  iTag 
) const
privatevirtual

Implements edm::RunBase.

Definition at line 118 of file Run.cc.

References addToGotBranchIDs(), edm::PrincipalGetAdapter::getByLabel_(), h, edm::BasicHandle::isValid(), moduleCallingContext_, edm::BasicHandle::provenance(), and provRecorder_.

118  {
119  BasicHandle h = provRecorder_.getByLabel_(TypeID(iProductType), iTag, moduleCallingContext_);
120  if(h.isValid()) {
121  addToGotBranchIDs(*(h.provenance()));
122  }
123  return h;
124  }
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag, ModuleCallingContext const *mcc) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void addToGotBranchIDs(Provenance const &prov) const
Definition: Run.cc:113
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
PrincipalGetAdapter provRecorder_
Definition: Run.h:163
template<typename PROD >
bool Run::getByToken ( EDGetToken  token,
Handle< PROD > &  result 
) const

Definition at line 239 of file Run.h.

References edm::PrincipalGetAdapter::checkIfComplete(), edm::HandleBase::clear(), edm::convert_handle(), edm::HandleBase::failedToGet(), edm::PrincipalGetAdapter::getByToken_(), moduleCallingContext_, PROD, edm::PRODUCT_TYPE, provRecorder_, and edm::principal_get_adapter_detail::throwOnPrematureRead().

Referenced by HLTPrescaleRecorder::beginRun(), pat::PATTriggerEventProducer::beginRun(), RunHistogramManager::beginRun(), edm::GetterOfProducts< trigger::HLTPrescaleTable >::fillHandles(), and PrescaleWeightProvider::initRun().

239  {
241  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), token);
242  }
243  result.clear();
244  BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)),PRODUCT_TYPE, token, moduleCallingContext_);
245  convert_handle(std::move(bh), result); // throws on conversion error
246  if (result.failedToGet()) {
247  return false;
248  }
249  return true;
250  }
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
PrincipalGetAdapter provRecorder_
Definition: Run.h:163
template<typename PROD >
bool Run::getByToken ( EDGetTokenT< PROD token,
Handle< PROD > &  result 
) const

Definition at line 254 of file Run.h.

References edm::PrincipalGetAdapter::checkIfComplete(), edm::HandleBase::clear(), edm::convert_handle(), edm::HandleBase::failedToGet(), edm::PrincipalGetAdapter::getByToken_(), moduleCallingContext_, PROD, edm::PRODUCT_TYPE, provRecorder_, and edm::principal_get_adapter_detail::throwOnPrematureRead().

254  {
256  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), token);
257  }
258  result.clear();
259  BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)),PRODUCT_TYPE, token, moduleCallingContext_);
260  convert_handle(std::move(bh), result); // throws on conversion error
261  if (result.failedToGet()) {
262  return false;
263  }
264  return true;
265  }
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
PrincipalGetAdapter provRecorder_
Definition: Run.h:163
template<typename PROD >
void Run::getManyByType ( std::vector< Handle< PROD > > &  results) const

Definition at line 269 of file Run.h.

References edm::PrincipalGetAdapter::checkIfComplete(), edm::PrincipalGetAdapter::getManyByType(), moduleCallingContext_, PROD, provRecorder_, python.entryComment::results, and edm::principal_get_adapter_detail::throwOnPrematureRead().

Referenced by GlobalHitsProdHistStripper::endRun().

269  {
272  }
274  }
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:163
Provenance Run::getProvenance ( BranchID const &  theID) const

Definition at line 39 of file Run.cc.

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

39  {
41  }
Provenance getProvenance(BranchID const &bid, ModuleCallingContext const *mcc) const
Definition: Principal.cc:739
RunPrincipal const & runPrincipal() const
Definition: Run.cc:34
ModuleCallingContext const * moduleCallingContext_
Definition: Run.h:168
RunIndex Run::index ( ) const
Returns
Reusable index which can be used to separate data for different simultaneous Runs.

Definition at line 26 of file Run.cc.

References edm::RunPrincipal::index(), and runPrincipal().

Referenced by BeautifulSoup.PageElement::_invert().

26 { return runPrincipal().index();}
RunPrincipal const & runPrincipal() const
Definition: Run.cc:34
RunIndex index() const
Definition: RunPrincipal.h:53
ModuleCallingContext const* edm::Run::moduleCallingContext ( ) const
inline

Definition at line 135 of file Run.h.

References moduleCallingContext_.

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

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

Definition at line 103 of file Run.cc.

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

103  {
104  return runPrincipal().processHistoryID();
105  }
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:143
RunPrincipal const & runPrincipal() const
Definition: Run.cc:34
template<typename PROD >
void edm::Run::put ( std::auto_ptr< PROD product)
inline
template<typename PROD >
void Run::put ( std::auto_ptr< PROD product,
std::string const &  productInstanceName 
)

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

Definition at line 175 of file Run.h.

References edm::PrincipalGetAdapter::getBranchDescription(), PROD, provRecorder_, putProducts(), edm::principal_get_adapter_detail::throwOnPutOfNullProduct(), and relativeConstraints::value.

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

Definition at line 148 of file Run.h.

References putProducts_.

Referenced by commit_(), and put().

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

Definition at line 149 of file Run.h.

References putProducts_.

149 {return putProducts_;}
ProductPtrVec putProducts_
Definition: Run.h:164
RunAuxiliary const& edm::Run::runAuxiliary ( ) const
inlinevirtual

Implements edm::RunBase.

Definition at line 55 of file Run.h.

References aux_.

Referenced by edm::PileUp::beginRun(), L1GtUtils::getL1GtRunCache(), L1GtUtils::getL1GtTriggerMenuLiteInputTag(), and L1GtUtils::retrieveL1GtTriggerMenuLite().

55 {return aux_;}
RunAuxiliary const & aux_
Definition: Run.h:165
RunPrincipal const & Run::runPrincipal ( ) const
private

Definition at line 34 of file Run.cc.

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

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

34  {
35  return dynamic_cast<RunPrincipal const&>(provRecorder_.principal());
36  }
string const
Definition: compareJSON.py:14
PrincipalGetAdapter provRecorder_
Definition: Run.h:163
RunPrincipal & Run::runPrincipal ( )
private

Definition at line 29 of file Run.cc.

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

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

Definition at line 48 of file Run.h.

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

Referenced by edm::EDAnalyzer::doBeginRun(), edm::EDProducer::doBeginRun(), edm::EDFilter::doBeginRun(), edm::one::EDProducerBase::doBeginRun(), edm::one::EDFilterBase::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::EDProducerBase::doEndRun(), edm::one::EDFilterBase::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::EDFilterBase::doStreamBeginRun(), edm::global::EDProducerBase::doStreamBeginRun(), edm::global::EDAnalyzerBase::doStreamEndRun(), edm::global::EDFilterBase::doStreamEndRun(), edm::global::EDProducerBase::doStreamEndRun(), edm::stream::EDAnalyzerAdaptorBase::doStreamEndRun(), and edm::stream::ProducingModuleAdaptorBase< T >::doStreamEndRun().

48  {
49  provRecorder_.setConsumer(iConsumer);
50  }
void setConsumer(EDConsumerBase const *iConsumer)
PrincipalGetAdapter provRecorder_
Definition: Run.h:163

Friends And Related Function Documentation

friend class InputSource
friend

Definition at line 155 of file Run.h.

friend class ProducerBase
friend

Definition at line 157 of file Run.h.

friend class RawInputSource
friend

Definition at line 156 of file Run.h.

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

Definition at line 158 of file Run.h.

Member Data Documentation

RunAuxiliary const& edm::Run::aux_
private

Definition at line 165 of file Run.h.

Referenced by runAuxiliary().

std::string const Run::emptyString_
staticprivate

Definition at line 170 of file Run.h.

Referenced by getByLabel().

BranchIDSet edm::Run::gotBranchIDs_
mutableprivate

Definition at line 167 of file Run.h.

Referenced by addToGotBranchIDs().

ModuleCallingContext const* edm::Run::moduleCallingContext_
private
PrincipalGetAdapter edm::Run::provRecorder_
private
ProductPtrVec edm::Run::putProducts_
private

Definition at line 164 of file Run.h.

Referenced by putProducts(), and ~Run().