CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
edm::LuminosityBlock Class Reference

#include <LuminosityBlock.h>

Inheritance diagram for edm::LuminosityBlock:
edm::LuminosityBlockBase

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
 
Run const & getRun () const
 
 LuminosityBlock (LuminosityBlockPrincipal &lbp, ModuleDescription const &md)
 
LuminosityBlockAuxiliary const & luminosityBlockAuxiliary () 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...
 
 ~LuminosityBlock ()
 
- Public Member Functions inherited from edm::LuminosityBlockBase
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<class T >
bool getByLabel (const InputTag &tag, Handle< T > &result) const
 
LuminosityBlockID id () const
 
LuminosityBlockNumber_t luminosityBlock () const
 
 LuminosityBlockBase ()
 
RunNumber_t run () const
 
virtual ~LuminosityBlockBase ()
 

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
 
LuminosityBlockPrincipal const & luminosityBlockPrincipal () const
 
LuminosityBlockPrincipalluminosityBlockPrincipal ()
 
ProductPtrVecputProducts ()
 
ProductPtrVec const & putProducts () const
 

Private Attributes

LuminosityBlockAuxiliary const & aux_
 
BranchIDSet gotBranchIDs_
 
PrincipalGetAdapter provRecorder_
 
ProductPtrVec putProducts_
 
boost::shared_ptr< Run const >
const 
run_
 

Friends

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

Detailed Description

Definition at line 37 of file LuminosityBlock.h.

Member Typedef Documentation

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

Definition at line 134 of file LuminosityBlock.h.

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

Definition at line 112 of file LuminosityBlock.h.

Constructor & Destructor Documentation

LuminosityBlock::LuminosityBlock ( LuminosityBlockPrincipal lbp,
ModuleDescription const &  md 
)

Definition at line 9 of file LuminosityBlock.cc.

9  :
10  provRecorder_(lbp, md),
11  aux_(lbp.aux()),
12  run_(new Run(lbp.runPrincipal(), md)) {
13  }
LuminosityBlockAuxiliary const & aux_
PrincipalGetAdapter provRecorder_
boost::shared_ptr< Run const > const run_
LuminosityBlock::~LuminosityBlock ( )

Definition at line 15 of file LuminosityBlock.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_
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16

Member Function Documentation

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

Definition at line 69 of file LuminosityBlock.cc.

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

Referenced by getByLabelImpl().

69  {
70  gotBranchIDs_.insert(prov.branchID());
71  }
void LuminosityBlock::commit_ ( )
private

Definition at line 42 of file LuminosityBlock.cc.

References begin, end, luminosityBlockPrincipal(), edm::LuminosityBlockPrincipal::put(), and putProducts().

Referenced by edm::InputSource::doBeginLumi(), edm::EDProducer::doBeginLuminosityBlock(), edm::EDFilter::doBeginLuminosityBlock(), edm::InputSource::doEndLumi(), edm::EDProducer::doEndLuminosityBlock(), and edm::EDFilter::doEndLuminosityBlock().

42  {
43  LuminosityBlockPrincipal& lbp = luminosityBlockPrincipal();
44  ProductPtrVec::iterator pit(putProducts().begin());
45  ProductPtrVec::iterator pie(putProducts().end());
46 
47  while(pit != pie) {
48  lbp.put(*pit->second, pit->first);
49  // Ownership has passed, so clear the pointer.
50  pit->first.reset();
51  ++pit;
52  }
53 
54  // the cleanup is all or none
55  putProducts().clear();
56  }
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
#define end
Definition: vmac.h:38
ProductPtrVec & putProducts()
#define begin
Definition: vmac.h:31
template<typename PROD >
bool LuminosityBlock::get ( SelectorBase const &  sel,
Handle< PROD > &  result 
) const
void LuminosityBlock::getAllProvenance ( std::vector< Provenance const * > &  provenances) const

Definition at line 37 of file LuminosityBlock.cc.

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

37  {
39  }
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
void getAllProvenance(std::vector< Provenance const * > &provenances) const
Definition: Principal.cc:699
template<typename PROD >
bool LuminosityBlock::getByLabel ( std::string const &  label,
Handle< PROD > &  result 
) const
template<typename PROD >
bool LuminosityBlock::getByLabel ( std::string const &  label,
std::string const &  productInstanceName,
Handle< PROD > &  result 
) const

Definition at line 177 of file LuminosityBlock.h.

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

179  {
180  return provRecorder_.getByLabel(label,productInstanceName,result);
181  }
bool getByLabel(std::string const &label, Handle< PROD > &result) const
PrincipalGetAdapter provRecorder_
template<typename PROD >
bool LuminosityBlock::getByLabel ( InputTag const &  tag,
Handle< PROD > &  result 
) const

same as above, but using the InputTag class

Definition at line 186 of file LuminosityBlock.h.

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

186  {
187  return provRecorder_.getByLabel(tag,result);
188  }
bool getByLabel(std::string const &label, Handle< PROD > &result) const
PrincipalGetAdapter provRecorder_
BasicHandle LuminosityBlock::getByLabelImpl ( std::type_info const &  iWrapperType,
std::type_info const &  iProductType,
InputTag const &  iTag 
) const
privatevirtual

Implements edm::LuminosityBlockBase.

Definition at line 74 of file LuminosityBlock.cc.

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

74  {
75  BasicHandle h = provRecorder_.getByLabel_(TypeID(iProductType), iTag);
76  if (h.isValid()) {
77  addToGotBranchIDs(*(h.provenance()));
78  }
79  return h;
80  }
void addToGotBranchIDs(Provenance const &prov) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
BasicHandle getByLabel_(TypeID const &tid, std::string const &label, std::string const &productInstanceName, std::string const &processName) const
PrincipalGetAdapter provRecorder_
template<typename PROD >
bool LuminosityBlock::getByType ( Handle< PROD > &  result) const

Definition at line 198 of file LuminosityBlock.h.

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

Referenced by GenFilterEfficiencyAnalyzer::endLuminosityBlock().

198  {
199  return provRecorder_.getByType(result);
200  }
PrincipalGetAdapter provRecorder_
bool getByType(Handle< PROD > &result) const
template<typename PROD >
void LuminosityBlock::getMany ( SelectorBase const &  sel,
std::vector< Handle< PROD > > &  results 
) const

Definition at line 192 of file LuminosityBlock.h.

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

192  {
194  }
void getMany(SelectorBase const &, std::vector< Handle< PROD > > &results) const
PrincipalGetAdapter provRecorder_
template<typename PROD >
void LuminosityBlock::getManyByType ( std::vector< Handle< PROD > > &  results) const

Definition at line 204 of file LuminosityBlock.h.

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

204  {
206  }
void getManyByType(std::vector< Handle< PROD > > &results) const
PrincipalGetAdapter provRecorder_
Provenance LuminosityBlock::getProvenance ( BranchID const &  theID) const

Definition at line 32 of file LuminosityBlock.cc.

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

32  {
34  }
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
Provenance getProvenance(BranchID const &bid) const
Definition: Principal.cc:677
Run const& edm::LuminosityBlock::getRun ( ) const
inline

Definition at line 77 of file LuminosityBlock.h.

References run_.

Referenced by LumiCalculator::endLuminosityBlock(), and edm::Event::getRun().

77  {
78  return *run_;
79  }
boost::shared_ptr< Run const > const run_
LuminosityBlockAuxiliary const& edm::LuminosityBlock::luminosityBlockAuxiliary ( ) const
inlinevirtual

Implements edm::LuminosityBlockBase.

Definition at line 43 of file LuminosityBlock.h.

References aux_.

43 {return aux_;}
LuminosityBlockAuxiliary const & aux_
LuminosityBlockPrincipal const & LuminosityBlock::luminosityBlockPrincipal ( ) const
private

Definition at line 27 of file LuminosityBlock.cc.

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

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

27  {
28  return dynamic_cast<LuminosityBlockPrincipal const&>(provRecorder_.principal());
29  }
string const
Definition: compareJSON.py:14
PrincipalGetAdapter provRecorder_
LuminosityBlockPrincipal & LuminosityBlock::luminosityBlockPrincipal ( )
private

Definition at line 22 of file LuminosityBlock.cc.

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

22  {
23  return dynamic_cast<LuminosityBlockPrincipal&>(provRecorder_.principal());
24  }
PrincipalGetAdapter provRecorder_
ProcessHistory const & LuminosityBlock::processHistory ( ) const

Definition at line 64 of file LuminosityBlock.cc.

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

64  {
66  }
ProcessHistory const & processHistory() const
PrincipalGetAdapter provRecorder_
ProcessHistoryID const & LuminosityBlock::processHistoryID ( ) const

Definition at line 59 of file LuminosityBlock.cc.

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

59  {
61  }
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:126
template<typename PROD >
void edm::LuminosityBlock::put ( std::auto_ptr< PROD product)
inline
template<typename PROD >
void LuminosityBlock::put ( std::auto_ptr< PROD product,
std::string const &  productInstanceName 
)

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

Definition at line 140 of file LuminosityBlock.h.

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

140  {
141  if(product.get() == 0) { // null pointer is illegal
142  TypeID typeID(typeid(PROD));
143  principal_get_adapter_detail::throwOnPutOfNullProduct("LuminosityBlock", typeID, productInstanceName);
144  }
145 
146  // The following will call post_insert if T has such a function,
147  // and do nothing if T has no such function.
149  DoPostInsert<PROD>,
150  DoNotPostInsert<PROD> >::type maybe_inserter;
151  maybe_inserter(product.get());
152 
153  ConstBranchDescription const& desc =
154  provRecorder_.getBranchDescription(TypeID(*product), productInstanceName);
155 
156  WrapperOwningHolder edp(new Wrapper<PROD>(product), Wrapper<PROD>::getInterface());
157  putProducts().push_back(std::make_pair(edp, &desc));
158 
159  // product.release(); // The object has been copied into the Wrapper.
160  // The old copy must be deleted, so we cannot release ownership.
161  }
type
Definition: HCALResponse.h:22
ProductPtrVec & putProducts()
PrincipalGetAdapter provRecorder_
#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
ProductPtrVec& edm::LuminosityBlock::putProducts ( )
inlineprivate

Definition at line 113 of file LuminosityBlock.h.

References putProducts_.

Referenced by commit_(), and put().

113 {return putProducts_;}
ProductPtrVec putProducts_
ProductPtrVec const& edm::LuminosityBlock::putProducts ( ) const
inlineprivate

Definition at line 114 of file LuminosityBlock.h.

References putProducts_.

114 {return putProducts_;}
ProductPtrVec putProducts_

Friends And Related Function Documentation

friend class ConfigurableInputSource
friend

Definition at line 120 of file LuminosityBlock.h.

friend class DaqSource
friend

Definition at line 122 of file LuminosityBlock.h.

friend class EDFilter
friend

Definition at line 124 of file LuminosityBlock.h.

friend class EDProducer
friend

Definition at line 125 of file LuminosityBlock.h.

friend class InputSource
friend

Definition at line 121 of file LuminosityBlock.h.

friend class RawInputSource
friend

Definition at line 123 of file LuminosityBlock.h.

Member Data Documentation

LuminosityBlockAuxiliary const& edm::LuminosityBlock::aux_
private

Definition at line 132 of file LuminosityBlock.h.

Referenced by luminosityBlockAuxiliary().

BranchIDSet edm::LuminosityBlock::gotBranchIDs_
mutableprivate

Definition at line 135 of file LuminosityBlock.h.

Referenced by addToGotBranchIDs().

PrincipalGetAdapter edm::LuminosityBlock::provRecorder_
private
ProductPtrVec edm::LuminosityBlock::putProducts_
private

Definition at line 131 of file LuminosityBlock.h.

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

boost::shared_ptr<Run const> const edm::LuminosityBlock::run_
private

Definition at line 133 of file LuminosityBlock.h.

Referenced by getRun().