CMS 3D CMS Logo

RunFromSource.h
Go to the documentation of this file.
1 #ifndef FWCore_TestProcessor_RunFromSource_h
2 #define FWCore_TestProcessor_RunFromSource_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/TestProcessor
6 // Class : RunFromSource
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Mon, 30 Apr 2018 18:51:27 GMT
19 //
20 
21 // system include files
22 #include <string>
23 
24 // user include files
30 
31 // forward declarations
32 
33 namespace edm {
34 
35  namespace test {
36 
37  class RunFromSource {
38  public:
39  RunFromSource(std::shared_ptr<RunPrincipal const> iPrincipal, edm::ServiceToken iToken)
40  : principal_(iPrincipal), token_(iToken) {}
41 
42  // ---------- const member functions ---------------------
43  template <typename T>
44  TestHandle<T> get(std::string const& iModule,
45  std::string const& iInstanceLabel,
46  std::string const& iProcess) const {
48 
49  auto h = principal_->getByLabel(
50  edm::PRODUCT_TYPE, edm::TypeID(typeid(T)), iModule, iInstanceLabel, iProcess, nullptr, nullptr, nullptr);
51  if (h.failedToGet()) {
52  return TestHandle<T>(std::move(h.whyFailedFactory()));
53  }
54  void const* basicWrapper = h.wrapper();
55  assert(basicWrapper);
56  Wrapper<T> const* wrapper = static_cast<Wrapper<T> const*>(basicWrapper);
57  return TestHandle<T>(wrapper->product());
58  }
59 
60  RunNumber_t run() const { return principal_->run(); }
61  RunAuxiliary const& aux() const { return principal_->aux(); }
62 
63  private:
64  // ---------- member data --------------------------------
65  std::shared_ptr<RunPrincipal const> principal_;
67  };
68  } // namespace test
69 } // namespace edm
70 
71 #endif
std::shared_ptr< RunPrincipal const > principal_
Definition: RunFromSource.h:65
assert(be >=bs)
edm::ServiceToken token_
Definition: RunFromSource.h:66
RunAuxiliary const & aux() const
Definition: RunFromSource.h:61
RunFromSource(std::shared_ptr< RunPrincipal const > iPrincipal, edm::ServiceToken iToken)
Definition: RunFromSource.h:39
HLT enums.
unsigned int RunNumber_t
RunNumber_t run() const
Definition: RunFromSource.h:60
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
long double T
def move(src, dest)
Definition: eostools.py:511
static HepMC::HEPEVT_Wrapper wrapper