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 | Static Private Attributes | Friends
edm::LuminosityBlock Class Reference

#include <LuminosityBlock.h>

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

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
 
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...
 
void setConsumer (EDConsumerBase const *iConsumer)
 
 ~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_
 

Static Private Attributes

static const std::string emptyString_
 

Friends

class DaqSource
 
class InputSource
 
class ProducerBase
 
class RawInputSource
 

Detailed Description

Definition at line 41 of file LuminosityBlock.h.

Member Typedef Documentation

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

Definition at line 135 of file LuminosityBlock.h.

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

Definition at line 115 of file LuminosityBlock.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file LuminosityBlock.cc.

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

Definition at line 17 of file LuminosityBlock.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
20  for_all(putProducts_, principal_get_adapter_detail::deleter());
21  }
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 79 of file LuminosityBlock.cc.

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

Referenced by getByLabelImpl().

79  {
80  gotBranchIDs_.insert(prov.branchID());
81  }
void LuminosityBlock::commit_ ( )
private

Definition at line 52 of file LuminosityBlock.cc.

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

Referenced by edm::InputSource::doBeginLumi(), and edm::InputSource::doEndLumi().

52  {
53  LuminosityBlockPrincipal& lbp = luminosityBlockPrincipal();
54  ProductPtrVec::iterator pit(putProducts().begin());
55  ProductPtrVec::iterator pie(putProducts().end());
56 
57  while(pit != pie) {
58  lbp.put(*pit->second, pit->first);
59  // Ownership has passed, so clear the pointer.
60  pit->first.reset();
61  ++pit;
62  }
63 
64  // the cleanup is all or none
65  putProducts().clear();
66  }
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
#define end
Definition: vmac.h:38
ProductPtrVec & putProducts()
#define begin
Definition: vmac.h:31
void LuminosityBlock::getAllProvenance ( std::vector< Provenance const * > &  provenances) const

Definition at line 47 of file LuminosityBlock.cc.

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

47  {
49  }
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
void getAllProvenance(std::vector< Provenance const * > &provenances) const
Definition: Principal.cc:713
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 174 of file LuminosityBlock.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().

176  {
178  principal_get_adapter_detail::throwOnPrematureRead("Lumi", TypeID(typeid(PROD)), label, productInstanceName);
179  }
180  result.clear();
181  BasicHandle bh = provRecorder_.getByLabel_(TypeID(typeid(PROD)), label, productInstanceName, emptyString_);
182  convert_handle(bh, result); // throws on conversion error
183  if (bh.failedToGet()) {
184  return false;
185  }
186  return true;
187  }
static const std::string emptyString_
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag) const
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
PrincipalGetAdapter provRecorder_
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
template<typename PROD >
bool LuminosityBlock::getByLabel ( InputTag const &  tag,
Handle< PROD > &  result 
) const

same as above, but using the InputTag class

Definition at line 192 of file LuminosityBlock.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().

192  {
194  principal_get_adapter_detail::throwOnPrematureRead("Lumi", TypeID(typeid(PROD)), tag.label(), tag.instance());
195  }
196  result.clear();
197  BasicHandle bh = provRecorder_.getByLabel_(TypeID(typeid(PROD)), tag);
198  convert_handle(bh, result); // throws on conversion error
199  if (bh.failedToGet()) {
200  return false;
201  }
202  return true;
203  }
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag) const
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
PrincipalGetAdapter provRecorder_
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
BasicHandle LuminosityBlock::getByLabelImpl ( std::type_info const &  iWrapperType,
std::type_info const &  iProductType,
InputTag const &  iTag 
) const
privatevirtual

Implements edm::LuminosityBlockBase.

Definition at line 84 of file LuminosityBlock.cc.

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

84  {
85  BasicHandle h = provRecorder_.getByLabel_(TypeID(iProductType), iTag);
86  if (h.isValid()) {
87  addToGotBranchIDs(*(h.provenance()));
88  }
89  return h;
90  }
BasicHandle getByLabel_(TypeID const &tid, InputTag const &tag) const
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
PrincipalGetAdapter provRecorder_
template<typename PROD >
bool LuminosityBlock::getByToken ( EDGetToken  token,
Handle< PROD > &  result 
) const

Definition at line 207 of file LuminosityBlock.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().

207  {
209  principal_get_adapter_detail::throwOnPrematureRead("Lumi", TypeID(typeid(PROD)), token);
210  }
211  result.clear();
212  BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)),PRODUCT_TYPE, token);
213  convert_handle(bh, result); // throws on conversion error
214  if (bh.failedToGet()) {
215  return false;
216  }
217  return true;
218  }
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
PrincipalGetAdapter provRecorder_
#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
template<typename PROD >
bool LuminosityBlock::getByToken ( EDGetTokenT< PROD token,
Handle< PROD > &  result 
) const

Definition at line 222 of file LuminosityBlock.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().

222  {
224  principal_get_adapter_detail::throwOnPrematureRead("Lumi", TypeID(typeid(PROD)), token);
225  }
226  result.clear();
227  BasicHandle bh = provRecorder_.getByToken_(TypeID(typeid(PROD)),PRODUCT_TYPE, token);
228  convert_handle(bh, result); // throws on conversion error
229  if (bh.failedToGet()) {
230  return false;
231  }
232  return true;
233  }
void convert_handle(BasicHandle const &bh, Handle< T > &result)
Definition: ConvertHandle.h:19
PrincipalGetAdapter provRecorder_
#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
template<typename PROD >
void LuminosityBlock::getManyByType ( std::vector< Handle< PROD > > &  results) const

Definition at line 238 of file LuminosityBlock.h.

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

238  {
241  }
243  }
void getManyByType(std::vector< Handle< PROD > > &results) const
PrincipalGetAdapter provRecorder_
#define PROD(A, B)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
Provenance LuminosityBlock::getProvenance ( BranchID const &  theID) const

Definition at line 42 of file LuminosityBlock.cc.

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

42  {
44  }
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
Provenance getProvenance(BranchID const &bid) const
Definition: Principal.cc:691
Run const& edm::LuminosityBlock::getRun ( ) const
inline

Definition at line 80 of file LuminosityBlock.h.

References run_.

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

80  {
81  return *run_;
82  }
boost::shared_ptr< Run const > const run_
LuminosityBlockAuxiliary const& edm::LuminosityBlock::luminosityBlockAuxiliary ( ) const
inlinevirtual

Implements edm::LuminosityBlockBase.

Definition at line 47 of file LuminosityBlock.h.

References aux_.

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

Definition at line 37 of file LuminosityBlock.cc.

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

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

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

Definition at line 24 of file LuminosityBlock.cc.

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

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

Definition at line 74 of file LuminosityBlock.cc.

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

74  {
76  }
ProcessHistory const & processHistory() const
PrincipalGetAdapter provRecorder_
ProcessHistoryID const & LuminosityBlock::processHistoryID ( ) const

Definition at line 69 of file LuminosityBlock.cc.

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

69  {
71  }
LuminosityBlockPrincipal const & luminosityBlockPrincipal() const
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:129
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 143 of file LuminosityBlock.h.

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

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

References putProducts_.

Referenced by commit_(), and put().

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

Definition at line 117 of file LuminosityBlock.h.

References putProducts_.

117 {return putProducts_;}
ProductPtrVec putProducts_
void LuminosityBlock::setConsumer ( EDConsumerBase const *  iConsumer)

Friends And Related Function Documentation

friend class DaqSource
friend

Definition at line 124 of file LuminosityBlock.h.

friend class InputSource
friend

Definition at line 123 of file LuminosityBlock.h.

friend class ProducerBase
friend

Definition at line 126 of file LuminosityBlock.h.

friend class RawInputSource
friend

Definition at line 125 of file LuminosityBlock.h.

Member Data Documentation

LuminosityBlockAuxiliary const& edm::LuminosityBlock::aux_
private

Definition at line 133 of file LuminosityBlock.h.

Referenced by luminosityBlockAuxiliary().

std::string const LuminosityBlock::emptyString_
staticprivate

Definition at line 138 of file LuminosityBlock.h.

Referenced by getByLabel().

BranchIDSet edm::LuminosityBlock::gotBranchIDs_
mutableprivate

Definition at line 136 of file LuminosityBlock.h.

Referenced by addToGotBranchIDs().

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

Definition at line 132 of file LuminosityBlock.h.

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

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

Definition at line 134 of file LuminosityBlock.h.

Referenced by getRun(), and setConsumer().