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 | Friends
edm::Run Class Reference

#include <Run.h>

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

Public Types

typedef PrincipalGetAdapter Base
 

Public Member Functions

template<typename PROD >
bool get (SelectorBase const &, Handle< PROD > &result) 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 getByType (Handle< PROD > &result) const
 
template<typename PROD >
void getMany (SelectorBase const &, std::vector< Handle< PROD > > &results) const
 
template<typename PROD >
void getManyByType (std::vector< Handle< PROD > > &results) const
 
Provenance getProvenance (BranchID const &theID) 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)
 
RunAuxiliary const & runAuxiliary () const
 
 ~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,
ConstBranchDescription 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_
 
PrincipalGetAdapter provRecorder_
 
ProductPtrVec putProducts_
 

Friends

class ConfigurableInputSource
 
class DaqSource
 
class EDFilter
 
class EDProducer
 
class InputSource
 
class RawInputSource
 

Detailed Description

Definition at line 33 of file Run.h.

Member Typedef Documentation

Definition at line 38 of file Run.h.

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

Definition at line 140 of file Run.h.

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

Definition at line 119 of file Run.h.

Constructor & Destructor Documentation

Run::Run ( RunPrincipal rp,
ModuleDescription const &  md 
)

Definition at line 8 of file Run.cc.

8  :
9  provRecorder_(rp, md),
10  aux_(rp.aux()) {
11  }
RunAuxiliary const & aux_
Definition: Run.h:139
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
Run::~Run ( )

Definition at line 13 of file Run.cc.

References edm::for_all(), and putProducts_.

13  {
14  // anything left here must be the result of a failure
15  // let's record them as failed attempts in the event principal
16  for_all(putProducts_, principal_get_adapter_detail::deleter());
17  }
ProductPtrVec putProducts_
Definition: Run.h:138
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16

Member Function Documentation

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

Definition at line 104 of file Run.cc.

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

Referenced by getByLabelImpl().

104  {
105  gotBranchIDs_.insert(prov.branchID());
106  }
BranchIDSet gotBranchIDs_
Definition: Run.h:141
void Run::commit_ ( )
private

Definition at line 77 of file Run.cc.

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

Referenced by edm::EDProducer::doBeginRun(), edm::EDFilter::doBeginRun(), edm::InputSource::doBeginRun(), edm::EDProducer::doEndRun(), edm::EDFilter::doEndRun(), and edm::InputSource::doEndRun().

77  {
78  RunPrincipal& rp = runPrincipal();
79  ProductPtrVec::iterator pit(putProducts().begin());
80  ProductPtrVec::iterator pie(putProducts().end());
81 
82  while(pit != pie) {
83  rp.put(*pit->second, pit->first);
84  // Ownership has passed, so clear the pointer.
85  pit->first.reset();
86  ++pit;
87  }
88 
89  // the cleanup is all or none
90  putProducts().clear();
91  }
#define end
Definition: vmac.h:38
RunPrincipal const & runPrincipal() const
Definition: Run.cc:25
ProductPtrVec & putProducts()
Definition: Run.h:120
#define begin
Definition: vmac.h:31
template<typename PROD >
bool Run::get ( SelectorBase const &  sel,
Handle< PROD > &  result 
) const
void Run::getAllProvenance ( std::vector< Provenance const * > &  provenances) const

Definition at line 35 of file Run.cc.

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

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

35  {
36  runPrincipal().getAllProvenance(provenances);
37  }
void getAllProvenance(std::vector< Provenance const * > &provenances) const
Definition: Principal.cc:699
RunPrincipal const & runPrincipal() const
Definition: Run.cc:25
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 183 of file Run.h.

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

185  {
186  return provRecorder_.getByLabel(label, productInstanceName, result);
187  }
bool getByLabel(std::string const &label, Handle< PROD > &result) const
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
template<typename PROD >
bool Run::getByLabel ( InputTag const &  tag,
Handle< PROD > &  result 
) const

same as above, but using the InputTag class

Definition at line 192 of file Run.h.

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

192  {
193  return provRecorder_.getByLabel(tag, result);
194  }
bool getByLabel(std::string const &label, Handle< PROD > &result) const
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
BasicHandle Run::getByLabelImpl ( std::type_info const &  iWrapperType,
std::type_info const &  iProductType,
InputTag const &  iTag 
) const
privatevirtual

Implements edm::RunBase.

Definition at line 109 of file Run.cc.

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

109  {
110  BasicHandle h = provRecorder_.getByLabel_(TypeID(iProductType), iTag);
111  if(h.isValid()) {
112  addToGotBranchIDs(*(h.provenance()));
113  }
114  return h;
115  }
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:104
BasicHandle getByLabel_(TypeID const &tid, std::string const &label, std::string const &productInstanceName, std::string const &processName) const
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
template<typename PROD >
bool Run::getByType ( Handle< PROD > &  result) const

Definition at line 204 of file Run.h.

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

204  {
205  return provRecorder_.getByType(result);
206  }
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
bool getByType(Handle< PROD > &result) const
template<typename PROD >
void Run::getMany ( SelectorBase const &  sel,
std::vector< Handle< PROD > > &  results 
) const

Definition at line 198 of file Run.h.

References edm::PrincipalGetAdapter::getMany(), provRecorder_, and python.entryComment::results.

198  {
199  return provRecorder_.getMany(sel, results);
200  }
void getMany(SelectorBase const &, std::vector< Handle< PROD > > &results) const
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
template<typename PROD >
void Run::getManyByType ( std::vector< Handle< PROD > > &  results) const

Definition at line 210 of file Run.h.

References edm::PrincipalGetAdapter::getManyByType(), provRecorder_, and python.entryComment::results.

Referenced by edm::HadronizerFilter< HAD, DEC >::beginRun(), and GlobalHitsProdHistStripper::endRun().

210  {
212  }
void getManyByType(std::vector< Handle< PROD > > &results) const
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
Provenance Run::getProvenance ( BranchID const &  theID) const

Definition at line 30 of file Run.cc.

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

30  {
31  return runPrincipal().getProvenance(bid);
32  }
RunPrincipal const & runPrincipal() const
Definition: Run.cc:25
Provenance getProvenance(BranchID const &bid) const
Definition: Principal.cc:677
ProcessHistory const & Run::processHistory ( ) const

Definition at line 99 of file Run.cc.

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

Referenced by pat::PATTriggerEventProducer::beginRun(), MEtoMEComparitor::beginRun(), pat::PATTriggerProducer::beginRun(), and HLTConfigProvider::init().

99  {
100  return provRecorder_.processHistory();
101  }
ProcessHistory const & processHistory() const
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
ProcessHistoryID const & Run::processHistoryID ( ) const

Definition at line 94 of file Run.cc.

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

94  {
95  return runPrincipal().processHistoryID();
96  }
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:126
RunPrincipal const & runPrincipal() const
Definition: Run.cc:25
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 146 of file Run.h.

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

146  {
147  if (product.get() == 0) { // null pointer is illegal
148  TypeID typeID(typeid(PROD));
149  principal_get_adapter_detail::throwOnPutOfNullProduct("Run", typeID, productInstanceName);
150  }
151 
152  // The following will call post_insert if T has such a function,
153  // and do nothing if T has no such function.
155  DoPostInsert<PROD>,
156  DoNotPostInsert<PROD> >::type maybe_inserter;
157  maybe_inserter(product.get());
158 
159  ConstBranchDescription const& desc =
160  provRecorder_.getBranchDescription(TypeID(*product), productInstanceName);
161 
162  WrapperOwningHolder edp(new Wrapper<PROD>(product), Wrapper<PROD>::getInterface());
163  putProducts().push_back(std::make_pair(edp, &desc));
164 
165  // product.release(); // The object has been copied into the Wrapper.
166  // The old copy must be deleted, so we cannot release ownership.
167  }
type
Definition: HCALResponse.h:22
ProductPtrVec & putProducts()
Definition: Run.h:120
#define PROD(A, B)
void throwOnPutOfNullProduct(char const *principalType, TypeID const &productType, std::string const &productInstanceName)
ConstBranchDescription const & getBranchDescription(TypeID const &type, std::string const &productInstanceName) const
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
ProductPtrVec& edm::Run::putProducts ( )
inlineprivate

Definition at line 120 of file Run.h.

References putProducts_.

Referenced by commit_(), and put().

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

Definition at line 121 of file Run.h.

References putProducts_.

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

Implements edm::RunBase.

Definition at line 40 of file Run.h.

References aux_.

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

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

Definition at line 25 of file Run.cc.

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

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

25  {
26  return dynamic_cast<RunPrincipal const&>(provRecorder_.principal());
27  }
string const
Definition: compareJSON.py:14
PrincipalGetAdapter provRecorder_
Definition: Run.h:137
RunPrincipal & Run::runPrincipal ( )
private

Definition at line 20 of file Run.cc.

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

20  {
21  return dynamic_cast<RunPrincipal&>(provRecorder_.principal());
22  }
PrincipalGetAdapter provRecorder_
Definition: Run.h:137

Friends And Related Function Documentation

friend class ConfigurableInputSource
friend

Definition at line 127 of file Run.h.

friend class DaqSource
friend

Definition at line 128 of file Run.h.

friend class EDFilter
friend

Definition at line 131 of file Run.h.

friend class EDProducer
friend

Definition at line 132 of file Run.h.

friend class InputSource
friend

Definition at line 129 of file Run.h.

friend class RawInputSource
friend

Definition at line 130 of file Run.h.

Member Data Documentation

RunAuxiliary const& edm::Run::aux_
private

Definition at line 139 of file Run.h.

Referenced by runAuxiliary().

BranchIDSet edm::Run::gotBranchIDs_
mutableprivate

Definition at line 141 of file Run.h.

Referenced by addToGotBranchIDs().

PrincipalGetAdapter edm::Run::provRecorder_
private
ProductPtrVec edm::Run::putProducts_
private

Definition at line 138 of file Run.h.

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