Public Member Functions | Public Attributes | List of all members
EventPrincipalTestFixture Struct Reference

Public Member Functions

 EventPrincipalTestFixture ()
 
ProductTablesFixtureptf ()
 

Public Attributes

std::unique_ptr< art::EventPrincipalpEvent_ {nullptr}
 

Detailed Description

Definition at line 126 of file EventPrincipal_t.cc.

Constructor & Destructor Documentation

EventPrincipalTestFixture::EventPrincipalTestFixture ( )

Definition at line 132 of file EventPrincipal_t.cc.

133 {
134  (void)ptf(); // Bootstrap ProductTables creation first time out.
135  EventID const eventID{101, 87, 20};
136 
137  // Making a functional EventPrincipal is not trivial, so we do it
138  // all here. Put products we'll look for into the EventPrincipal.
139  std::unique_ptr<art::EDProduct> product =
140  std::make_unique<art::Wrapper<arttest::DummyProduct>>();
141 
142  std::string const tag{"rick"};
143  auto i = ptf().productIDs_.find(tag);
144  BOOST_TEST_REQUIRE(static_cast<bool>(i != ptf().productIDs_.end()));
145 
146  auto pd = ptf().producedProducts_.get(InEvent).description(i->second);
147  BOOST_TEST_REQUIRE(pd != nullptr);
148 
149  auto entryDescriptionPtr = std::make_shared<art::Parentage>();
150  auto productProvenancePtr = std::make_unique<art::ProductProvenance const>(
151  pd->productID(),
153  entryDescriptionPtr->parents());
154 
156  BOOST_TEST_REQUIRE(process);
157 
158  constexpr art::Timestamp now{1234567UL};
159 
160  art::RunAuxiliary const runAux{eventID.run(), now, now};
161  auto rp = std::make_unique<art::RunPrincipal>(runAux, *process, nullptr);
162 
163  art::SubRunAuxiliary const subRunAux{rp->run(), eventID.subRun(), now, now};
164  auto srp =
165  std::make_unique<art::SubRunPrincipal>(subRunAux, *process, nullptr);
166  srp->setRunPrincipal(rp.get());
167 
168  art::EventAuxiliary const eventAux{eventID, now, true};
169  pEvent_ = std::make_unique<art::EventPrincipal>(eventAux, *process, nullptr);
170  pEvent_->setSubRunPrincipal(srp.get());
171  pEvent_->createGroupsForProducedProducts(ptf().producedProducts_);
172  pEvent_->enableLookupOfProducedProducts(ptf().producedProducts_);
173  pEvent_->put(
174  *pd, move(productProvenancePtr), move(product), make_unique<RangeSet>());
175  BOOST_TEST_REQUIRE(pEvent_->size() == 5u);
176 
177  auto pdPtr = pEvent_->getProductDescription(i->second);
178  BOOST_TEST_REQUIRE(*pd == *pdPtr);
179 }
std::string string
Definition: nybbler.cc:12
std::unique_ptr< art::EventPrincipal > pEvent_
auto & get(BranchType const bt)
Definition: ProductTables.h:49
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
def process(f, kind)
Definition: search.py:254
def move(depos, offset)
Definition: depos.py:107
std::map< std::string, art::ProductID > productIDs_
RunNumber_t run() const noexcept
RunNumber_t run() const noexcept
ProductTables producedProducts_
Definition: Event_t.cc:127
constexpr ProductStatus present() noexcept
Definition: ProductStatus.h:10
ProductTablesFixture & ptf()
std::map< std::string, art::ProcessConfiguration * > processConfigurations_

Member Function Documentation

ProductTablesFixture & EventPrincipalTestFixture::ptf ( )

Definition at line 182 of file EventPrincipal_t.cc.

183 {
184  static ProductTablesFixture ptf_s;
185  return ptf_s;
186 }

Member Data Documentation

std::unique_ptr<art::EventPrincipal> EventPrincipalTestFixture::pEvent_ {nullptr}

Definition at line 129 of file EventPrincipal_t.cc.


The documentation for this struct was generated from the following file: