CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GenericHandle.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Framework
4 // Class : GenericHandle
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Thu Mar 30 15:48:37 EST 2006
11 //
12 
13 // system include files
14 
15 // user include files
17 
18 namespace edm {
21 {
22  if(orig.failedToGet()) {
23  result.setWhyFailedFactory(orig.whyFailedFactory());
24  return;
25  }
26  WrapperHolder originalWrap = orig.wrapperHolder();
27  if(!originalWrap.isValid()) {
28  throw Exception(errors::InvalidReference,"NullPointer")
29  << "edm::BasicHandle has null pointer to Wrapper";
30  }
31 
32  ObjectWithDict wrap(originalWrap.wrappedTypeInfo(), const_cast<void*>(originalWrap.wrapper()));
33  assert(bool(wrap));
34 
35  ObjectWithDict product(wrap.get("obj"));
36  if(!product){
37  throw Exception(errors::LogicError)<<"GenericObject could not find 'obj' member";
38  }
39  if(product.typeOf() != result.type()) {
40  throw Exception(errors::LogicError) << "GenericObject asked for " << result.type().name()
41  << " but was given a " << product.typeOf().name();
42  }
43 
44  Handle<GenericObject> h(product, orig.provenance(), orig.id());
45  h.swap(result);
46 }
47 
49 template<>
50 bool
51 edm::Event::getByLabel<GenericObject>(std::string const& label,
52  std::string const& productInstanceName,
54 {
55  BasicHandle bh = provRecorder_.getByLabel_(TypeID(result.type().typeInfo()), label, productInstanceName, std::string(), moduleCallingContext_);
56  convert_handle(std::move(bh), result); // throws on conversion error
57  if(!result.failedToGet()) {
58  addToGotBranchIDs(*bh.provenance());
59  return true;
60  }
61  return false;
62 }
63 
64 template<>
65 bool
66 edm::Event::getByLabel<GenericObject>(edm::InputTag const& tag,
68 {
69  if (tag.process().empty()) {
70  return this->getByLabel(tag.label(), tag.instance(), result);
71  } else {
72  BasicHandle bh = provRecorder_.getByLabel_(TypeID(result.type().typeInfo()), tag.label(), tag.instance(),tag.process(), moduleCallingContext_);
73  convert_handle(std::move(bh), result); // throws on conversion error
74  if(!result.failedToGet()) {
75  addToGotBranchIDs(*bh.provenance());
76  return true;
77  }
78  }
79  return false;
80 }
81 
82 }
void wrap(unsigned me1aValidp, unsigned me1aQp, unsigned me1aEtap, unsigned me1aPhip, unsigned me1aCSCidp, unsigned me1bValidp, unsigned me1bQp, unsigned me1bEtap, unsigned me1bPhip, unsigned me1bCSCidp, unsigned me1cValidp, unsigned me1cQp, unsigned me1cEtap, unsigned me1cPhip, unsigned me1cCSCidp, unsigned me1dValidp, unsigned me1dQp, unsigned me1dEtap, unsigned me1dPhip, unsigned me1dCSCidp, unsigned me1eValidp, unsigned me1eQp, unsigned me1eEtap, unsigned me1ePhip, unsigned me1eCSCidp, unsigned me1fValidp, unsigned me1fQp, unsigned me1fEtap, unsigned me1fPhip, unsigned me1fCSCidp, unsigned me2aValidp, unsigned me2aQp, unsigned me2aEtap, unsigned me2aPhip, unsigned me2bValidp, unsigned me2bQp, unsigned me2bEtap, unsigned me2bPhip, unsigned me2cValidp, unsigned me2cQp, unsigned me2cEtap, unsigned me2cPhip, unsigned me3aValidp, unsigned me3aQp, unsigned me3aEtap, unsigned me3aPhip, unsigned me3bValidp, unsigned me3bQp, unsigned me3bEtap, unsigned me3bPhip, unsigned me3cValidp, unsigned me3cQp, unsigned me3cEtap, unsigned me3cPhip, unsigned me4aValidp, unsigned me4aQp, unsigned me4aEtap, unsigned me4aPhip, unsigned me4bValidp, unsigned me4bQp, unsigned me4bEtap, unsigned me4bPhip, unsigned me4cValidp, unsigned me4cQp, unsigned me4cEtap, unsigned me4cPhip, unsigned mb1aValidp, unsigned mb1aQp, unsigned mb1aPhip, unsigned mb1bValidp, unsigned mb1bQp, unsigned mb1bPhip, unsigned mb1cValidp, unsigned mb1cQp, unsigned mb1cPhip, unsigned mb1dValidp, unsigned mb1dQp, unsigned mb1dPhip, unsigned &ptHp, unsigned &signHp, unsigned &modeMemHp, unsigned &etaPTHp, unsigned &FRHp, unsigned &phiHp, unsigned &ptMp, unsigned &signMp, unsigned &modeMemMp, unsigned &etaPTMp, unsigned &FRMp, unsigned &phiMp, unsigned &ptLp, unsigned &signLp, unsigned &modeMemLp, unsigned &etaPTLp, unsigned &FRLp, unsigned &phiLp, unsigned &me1idH, unsigned &me2idH, unsigned &me3idH, unsigned &me4idH, unsigned &mb1idH, unsigned &mb2idH, unsigned &me1idM, unsigned &me2idM, unsigned &me3idM, unsigned &me4idM, unsigned &mb1idM, unsigned &mb2idM, unsigned &me1idL, unsigned &me2idL, unsigned &me3idL, unsigned &me4idL, unsigned &mb1idL, unsigned &mb2idL, unsigned mneta12p, unsigned mneta13p, unsigned mneta23p, unsigned mneta24p, unsigned mneta34p, unsigned mneta12ovp, unsigned mneta12dtp, unsigned mneta14p, unsigned mxeta12p, unsigned mxeta13p, unsigned mxeta23p, unsigned mxeta24p, unsigned mxeta34p, unsigned mxeta12ovp, unsigned mxeta12dtp, unsigned mxeta14p, unsigned etawn12p, unsigned etawn13p, unsigned etawn23p, unsigned etawn24p, unsigned etawn34p, unsigned etawn12ovp, unsigned etawn14p, unsigned mindphip, unsigned mindetap, unsigned mindeta_halo12p, unsigned maxdeta_halo12p, unsigned maxdphi_halo12p, unsigned mindeta_halo13p, unsigned maxdeta_halo13p, unsigned maxdphi_halo13p, unsigned mindeta_halo112p, unsigned maxdeta_halo112p, unsigned maxdphi_halo112p, unsigned mindeta_halo113p, unsigned maxdeta_halo113p, unsigned maxdphi_halo113p, unsigned mindphi_halop, unsigned mindeta_halop, unsigned straightp, unsigned curvedp, unsigned mb1a_phi_offp, unsigned mb1b_phi_offp, unsigned controlp)
TypeWithDict const & type() const
Provenance const * provenance() const
Definition: BasicHandle.h:118
std::string name() const
tuple result
Definition: query.py:137
void convert_handle(BasicHandle &&bh, Handle< T > &result)
Definition: ConvertHandle.h:20
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void setWhyFailedFactory(std::shared_ptr< HandleExceptionFactory > const &iWhyFailed)
std::type_info const & wrappedTypeInfo() const
Definition: WrapperHolder.h:72
bool isValid() const
Definition: WrapperHolder.h:27
void const * wrapper() const
Definition: WrapperHolder.h:76
ObjectWithDict get(std::string const &memberName) const