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
 

Public Member Functions

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
 
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
 
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,
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_
 

Static Private Attributes

static const std::string emptyString_
 

Friends

class DaqSource
 
class InputSource
 
class ProducerBase
 
class RawInputSource
 

Detailed Description

Definition at line 36 of file Run.h.

Member Typedef Documentation

Definition at line 47 of file Run.h.

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

Definition at line 143 of file Run.h.

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

Definition at line 124 of file Run.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file Run.cc.

10  :
11  provRecorder_(rp, md),
12  aux_(rp.aux()) {
13  }
RunAuxiliary const & aux_
Definition: Run.h:142
PrincipalGetAdapter provRecorder_
Definition: Run.h:140
Run::~Run ( )

Definition at line 15 of file Run.cc.

References edm::for_all(), and putProducts_.

15  {
16  // anything left here must be the result of a failure
17  // let's record them as failed attempts in the event principal
18  for_all(putProducts_, principal_get_adapter_detail::deleter());
19  }
ProductPtrVec putProducts_
Definition: Run.h:141
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 106 of file Run.cc.

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

Referenced by getByLabelImpl().

106  {
107  gotBranchIDs_.insert(prov.branchID());
108  }
BranchIDSet gotBranchIDs_
Definition: Run.h:144
void Run::commit_ ( )
private

Definition at line 79 of file Run.cc.

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

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

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

Definition at line 37 of file Run.cc.

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

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

37  {
38  runPrincipal().getAllProvenance(provenances);
39  }
void getAllProvenance(std::vector< Provenance const * > &provenances) const
Definition: Principal.cc:713
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 182 of file Run.h.

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

184  {
186  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), label, productInstanceName);
187  }
188  result.clear();
189  BasicHandle bh = provRecorder_.getByLabel_(TypeID(typeid(PROD)), label, productInstanceName, emptyString_);
190  convert_handle(bh, result); // throws on conversion error
191  if (bh.failedToGet()) {
192  return false;
193  }
194  return true;
195  }
static const std::string emptyString_
Definition: Run.h:146
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag) const
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
PrincipalGetAdapter provRecorder_
Definition: Run.h:140
template<typename PROD >
bool Run::getByLabel ( InputTag const &  tag,
Handle< PROD > &  result 
) const

same as above, but using the InputTag class

Definition at line 200 of file Run.h.

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

200  {
202  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), tag.label(), tag.instance());
203  }
204  result.clear();
205  BasicHandle bh = provRecorder_.getByLabel_(TypeID(typeid(PROD)), tag);
206  convert_handle(bh, result); // throws on conversion error
207  if (bh.failedToGet()) {
208  return false;
209  }
210  return true;
211  }
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag) const
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
PrincipalGetAdapter provRecorder_
Definition: Run.h:140
BasicHandle Run::getByLabelImpl ( std::type_info const &  iWrapperType,
std::type_info const &  iProductType,
InputTag const &  iTag 
) const
privatevirtual

Implements edm::RunBase.

Definition at line 111 of file Run.cc.

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

111  {
112  BasicHandle h = provRecorder_.getByLabel_(TypeID(iProductType), iTag);
113  if(h.isValid()) {
114  addToGotBranchIDs(*(h.provenance()));
115  }
116  return h;
117  }
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag) 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:106
PrincipalGetAdapter provRecorder_
Definition: Run.h:140
template<typename PROD >
bool Run::getByToken ( EDGetToken  token,
Handle< PROD > &  result 
) const

Definition at line 215 of file Run.h.

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

215  {
217  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), token);
218  }
219  result.clear();
220  BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)),PRODUCT_TYPE, token);
221  convert_handle(bh, result); // throws on conversion error
222  if (bh.failedToGet()) {
223  return false;
224  }
225  return true;
226  }
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
BasicHandle getByToken_(TypeID const &id, KindOfType kindOfType, EDGetToken token) const
PrincipalGetAdapter provRecorder_
Definition: Run.h:140
template<typename PROD >
bool Run::getByToken ( EDGetTokenT< PROD token,
Handle< PROD > &  result 
) const

Definition at line 230 of file Run.h.

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

230  {
232  principal_get_adapter_detail::throwOnPrematureRead("Run", TypeID(typeid(PROD)), token);
233  }
234  result.clear();
235  BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)),PRODUCT_TYPE, token);
236  convert_handle(bh, result); // throws on conversion error
237  if (bh.failedToGet()) {
238  return false;
239  }
240  return true;
241  }
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
BasicHandle getByToken_(TypeID const &id, KindOfType kindOfType, EDGetToken token) const
PrincipalGetAdapter provRecorder_
Definition: Run.h:140
template<typename PROD >
void Run::getManyByType ( std::vector< Handle< PROD > > &  results) const

Definition at line 245 of file Run.h.

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

Referenced by GlobalHitsProdHistStripper::endRun().

245  {
248  }
250  }
void getManyByType(std::vector< Handle< PROD > > &results) const
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
PrincipalGetAdapter provRecorder_
Definition: Run.h:140
Provenance Run::getProvenance ( BranchID const &  theID) const

Definition at line 32 of file Run.cc.

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

32  {
33  return runPrincipal().getProvenance(bid);
34  }
RunPrincipal const & runPrincipal() const
Definition: Run.cc:27
Provenance getProvenance(BranchID const &bid) const
Definition: Principal.cc:691
ProcessHistory const & Run::processHistory ( ) const

Definition at line 101 of file Run.cc.

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

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

101  {
102  return provRecorder_.processHistory();
103  }
ProcessHistory const & processHistory() const
PrincipalGetAdapter provRecorder_
Definition: Run.h:140
ProcessHistoryID const & Run::processHistoryID ( ) const

Definition at line 96 of file Run.cc.

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

96  {
97  return runPrincipal().processHistoryID();
98  }
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:129
RunPrincipal const & runPrincipal() const
Definition: Run.cc:27
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 151 of file Run.h.

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

151  {
152  if (product.get() == 0) { // null pointer is illegal
153  TypeID typeID(typeid(PROD));
154  principal_get_adapter_detail::throwOnPutOfNullProduct("Run", typeID, productInstanceName);
155  }
156 
157  // The following will call post_insert if T has such a function,
158  // and do nothing if T has no such function.
160  DoPostInsert<PROD>,
161  DoNotPostInsert<PROD> >::type maybe_inserter;
162  maybe_inserter(product.get());
163 
164  ConstBranchDescription const& desc =
165  provRecorder_.getBranchDescription(TypeID(*product), productInstanceName);
166 
167  WrapperOwningHolder edp(new Wrapper<PROD>(product), Wrapper<PROD>::getInterface());
168  putProducts().emplace_back(edp, &desc);
169 
170  // product.release(); // The object has been copied into the Wrapper.
171  // The old copy must be deleted, so we cannot release ownership.
172  }
type
Definition: HCALResponse.h:21
ProductPtrVec & putProducts()
Definition: Run.h:125
#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:140
ProductPtrVec& edm::Run::putProducts ( )
inlineprivate

Definition at line 125 of file Run.h.

References putProducts_.

Referenced by commit_(), and put().

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

Definition at line 126 of file Run.h.

References putProducts_.

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

Implements edm::RunBase.

Definition at line 49 of file Run.h.

References aux_.

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

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

Definition at line 27 of file Run.cc.

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

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

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

Definition at line 22 of file Run.cc.

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

22  {
23  return dynamic_cast<RunPrincipal&>(provRecorder_.principal());
24  }
PrincipalGetAdapter provRecorder_
Definition: Run.h:140
void edm::Run::setConsumer ( EDConsumerBase const *  iConsumer)
inline

Friends And Related Function Documentation

friend class DaqSource
friend

Definition at line 132 of file Run.h.

friend class InputSource
friend

Definition at line 133 of file Run.h.

friend class ProducerBase
friend

Definition at line 135 of file Run.h.

friend class RawInputSource
friend

Definition at line 134 of file Run.h.

Member Data Documentation

RunAuxiliary const& edm::Run::aux_
private

Definition at line 142 of file Run.h.

Referenced by runAuxiliary().

std::string const Run::emptyString_
staticprivate

Definition at line 146 of file Run.h.

Referenced by getByLabel().

BranchIDSet edm::Run::gotBranchIDs_
mutableprivate

Definition at line 144 of file Run.h.

Referenced by addToGotBranchIDs().

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

Definition at line 141 of file Run.h.

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