LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
art::Results Class Referencefinal

#include "Results.h"

Inheritance diagram for art::Results:
art::DataViewImpl

Public Types

using Base = DataViewImpl
 
template<typename T >
using HandleT = Handle< T >
 

Public Member Functions

 Results (Principal const &p, ModuleDescription const &md, cet::exempt_ptr< Consumer > consumer)
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&product)
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&product, std::string const &productInstanceName)
 
EDProductGetter const * productGetter (ProductID const pid) const
 
void commit (ResultsPrincipal &)
 

Private Types

using RetrievedProductIDs = std::vector< ProductID >
 
using RetrievedProductSet = std::set< ProductID >
 
using TypeLabelMap = std::map< TypeLabel, PMValue >
 
using GroupQueryResultVec = std::vector< GroupQueryResult >
 

Private Member Functions

size_t size () const
 
template<typename PROD >
bool get (SelectorBase const &, Handle< PROD > &result) const
 
template<typename PROD >
bool get (ProductID const pid, 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 (std::string const &label, std::string const &productInstanceName, std::string const &processName, Handle< PROD > &result) const
 
template<typename PROD >
PROD const & getByLabel (InputTag const &tag) const
 same as above, but using the InputTag class More...
 
template<typename PROD >
bool getByLabel (InputTag const &tag, Handle< PROD > &result) const
 
template<typename PROD >
PROD const * getPointerByLabel (InputTag const &tag) const
 
template<typename PROD >
bool getByToken (ProductToken< PROD > const &token, Handle< PROD > &result) const
 
template<typename PROD >
ValidHandle< PROD > getValidHandle (InputTag const &tag) const
 
template<typename PROD >
ValidHandle< PROD > getValidHandle (ProductToken< PROD > const &token) const
 
template<typename PROD >
art::ValidHandle< PROD > getValidHandle (InputTag const &tag) const
 
template<typename PROD >
art::ValidHandle< PROD > getValidHandle (ProductToken< PROD > const &token) 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
 
template<typename ELEMENT >
std::size_t getView (std::string const &moduleLabel, std::string const &productInstanceName, std::vector< ELEMENT const * > &result) const
 
template<typename ELEMENT >
std::size_t getView (InputTag const &tag, std::vector< ELEMENT const * > &result) const
 
template<typename ELEMENT >
std::size_t getView (ViewToken< ELEMENT > const &token, std::vector< ELEMENT const * > &result) const
 
template<typename ELEMENT >
bool getView (std::string const &moduleLabel, std::string const &instanceName, View< ELEMENT > &result) const
 
template<typename ELEMENT >
bool getView (InputTag const &tag, View< ELEMENT > &result) const
 
template<typename ELEMENT >
bool getView (ViewToken< ELEMENT > const &tag, View< ELEMENT > &result) const
 
template<typename PROD >
bool removeCachedProduct (Handle< PROD > &h) const
 
ProcessHistory const & processHistory () const
 
void recordAsParent (Provenance const &prov) const
 
TypeLabelMapputProducts ()
 
TypeLabelMap const & putProducts () const
 
RetrievedProductSet const & retrievedProducts () const
 
RetrievedProductIDs retrievedProductIDs () const
 
void checkPutProducts (bool checkProducts, std::set< TypeLabel > const &expectedProducts, TypeLabelMap const &putProducts)
 
BranchDescription const & getProductDescription (TypeID const &type, std::string const &productInstanceName) const
 
template<typename ELEMENT >
art::DataViewImpl::GroupQueryResultVec getView_ (std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName) const
 

Private Attributes

Principal const & principal_
 

Detailed Description

Definition at line 28 of file Results.h.

Member Typedef Documentation

Definition at line 34 of file Results.h.

using art::DataViewImpl::GroupQueryResultVec = std::vector<GroupQueryResult>
protectedinherited

Definition at line 214 of file DataViewImpl.h.

template<typename T >
using art::Results::HandleT = Handle<T>

Definition at line 70 of file Results.h.

using art::DataViewImpl::RetrievedProductIDs = std::vector<ProductID>
inherited

Definition at line 175 of file DataViewImpl.h.

Definition at line 176 of file DataViewImpl.h.

using art::DataViewImpl::TypeLabelMap = std::map<TypeLabel, PMValue>
inherited

Definition at line 177 of file DataViewImpl.h.

Constructor & Destructor Documentation

art::Results::Results ( Principal const &  p,
ModuleDescription const &  md,
cet::exempt_ptr< Consumer consumer 
)
explicit

Definition at line 5 of file Results.cc.

References art::InResults, and principal_.

8  : DataViewImpl{p, md, InResults, false, consumer}, principal_{p}
9 {}
Principal const & principal_
Definition: Results.h:73
DataViewImpl(DataViewImpl const &)=delete

Member Function Documentation

void art::DataViewImpl::checkPutProducts ( bool  checkProducts,
std::set< TypeLabel > const &  expectedProducts,
TypeLabelMap const &  putProducts 
)
protectedinherited

Definition at line 109 of file DataViewImpl.cc.

References art::DataViewImpl::getProductDescription(), and art::errors::LogicError.

Referenced by art::Run::commit(), art::SubRun::commit(), art::Event::commit(), art::Event::put(), and art::DataViewImpl::retrievedProducts().

112  {
113  if (!checkProducts)
114  return;
115 
116  std::vector<std::string> missing;
117  for (auto const& typeLabel : expectedProducts) {
118  if (putProducts.find(typeLabel) != putProducts.cend())
119  continue;
120 
121  std::ostringstream desc;
122  desc << getProductDescription(typeLabel.typeID(),
123  typeLabel.productInstanceName());
124  missing.emplace_back(desc.str());
125  }
126 
127  if (!missing.empty()) {
128  std::ostringstream errmsg;
129  HorizontalRule rule{25};
130  errmsg << "The following products have been declared with 'produces',\n"
131  << "but they have not been placed onto the event:\n"
132  << rule('=') << '\n';
133  for (auto const& desc : missing) {
134  errmsg << desc << rule('=') << '\n';
135  }
136  throw Exception{errors::LogicError, "DataViewImpl::checkPutProducts"}
137  << errmsg.str();
138  }
139  }
BranchDescription const & getProductDescription(TypeID const &type, std::string const &productInstanceName) const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
TypeLabelMap & putProducts()
Definition: DataViewImpl.h:183
void art::Results::commit ( ResultsPrincipal resp)

Definition at line 18 of file Results.cc.

References art::productstatus::present(), art::ResultsPrincipal::put(), and art::DataViewImpl::putProducts().

19 {
20  for (auto& elem : putProducts()) {
21  auto const& pd = elem.second.pd;
22  auto productProvenancePtr = std::make_unique<ProductProvenance const>(
23  pd.productID(), productstatus::present());
24  resp.put(std::move(elem.second.prod), pd, std::move(productProvenancePtr));
25  }
26 
27  // the cleanup is all or none
28  putProducts().clear();
29 }
TypeLabelMap & putProducts()
Definition: DataViewImpl.h:183
ProductStatus present()
Definition: ProductStatus.h:16
template<typename PROD >
bool art::DataViewImpl::get ( SelectorBase const &  sel,
Handle< PROD > &  result 
) const
inlineinherited

Definition at line 307 of file DataViewImpl.h.

References art::Handle< T >::clear(), art::convert_handle(), art::Handle< T >::failedToGet(), art::DataViewImpl::get_(), art::Handle< T >::provenance(), art::DataViewImpl::recordAsParent(), art::DataViewImpl::recordParents_, and art::GroupQueryResult::succeeded().

Referenced by art::Run::endTime(), art::SubRun::endTime(), art::detail::ProcessAndEventSelector::loadTriggerResults(), DUNE::NeutrinoTrackingEff::processEff(), DUNE::MuonTrackingEff::processEff(), and art::Event::put().

308 {
309  result.clear(); // Is this the correct thing to do if an exception is thrown?
310  // We do *not* track whether consumes was called for a SelectorBase.
311  GroupQueryResult bh = get_(WrappedTypeID::make<PROD>(), sel);
312  convert_handle(bh, result);
313  bool const ok{bh.succeeded() && !result.failedToGet()};
314  if (recordParents_ && ok) {
315  recordAsParent(*result.provenance());
316  }
317  return ok;
318 }
void recordAsParent(Provenance const &prov) const
Definition: DataViewImpl.cc:87
GroupQueryResult get_(WrappedTypeID const &wrapped, SelectorBase const &) const
Definition: DataViewImpl.cc:40
void convert_handle(GroupQueryResult const &, Handle< T > &)
Definition: Handle.h:249
bool const recordParents_
Definition: DataViewImpl.h:286
template<typename PROD >
bool art::DataViewImpl::get ( ProductID const  pid,
Handle< PROD > &  result 
) const
inherited

Definition at line 322 of file DataViewImpl.h.

References art::Handle< T >::clear(), art::convert_handle(), art::Handle< T >::failedToGet(), art::DataViewImpl::getByProductID_(), art::Handle< T >::provenance(), art::DataViewImpl::recordAsParent(), art::DataViewImpl::recordParents_, and art::GroupQueryResult::succeeded().

323 {
324  result.clear(); // Is this the correct thing to do if an exception is thrown?
325  // We do *not* track whether consumes was called for a ProductID.
326  GroupQueryResult bh = getByProductID_(pid);
327  convert_handle(bh, result);
328  bool const ok{bh.succeeded() && !result.failedToGet()};
329  if (recordParents_ && ok) {
330  recordAsParent(*result.provenance());
331  }
332  return ok;
333 }
void recordAsParent(Provenance const &prov) const
Definition: DataViewImpl.cc:87
void convert_handle(GroupQueryResult const &, Handle< T > &)
Definition: Handle.h:249
GroupQueryResult getByProductID_(ProductID const pid) const
Definition: DataViewImpl.cc:47
bool const recordParents_
Definition: DataViewImpl.h:286
template<typename PROD >
bool art::DataViewImpl::getByLabel ( std::string const &  label,
std::string const &  productInstanceName,
Handle< PROD > &  result 
) const
inlineinherited

Definition at line 344 of file DataViewImpl.h.

References label.

Referenced by lar::util::details::FindAllP< Source, Dest >::Add(), reco3d::PlotSpacePoints::analyze(), hit::MCHitAnaExample::analyze(), pid::PIDAAnalyzer::analyze(), opdet::OpHitAna::analyze(), cheat::CheckBackTracking::analyze(), opdet::OpFlashSimpleAna::analyze(), lar_pandora::LArPandoraEventDump::analyze(), calo::PrintCalorimetry::analyze(), opdet::OpFlashMCTruthAna::analyze(), MCBTDemo::analyze(), trk::TrackContainmentAnalyzer::analyze(), opdet::FlashHypothesisAna::analyze(), cheat::RecoCheckAna::analyze(), opreco::OpticalRecoAna::analyze(), cluster::ClusterPCA::analyze(), hit::HitAnaModule::analyze(), lar_pandora::ConsolidatedPFParticleAnalysisTemplate::analyze(), vertex::AggregateVertexAna::analyze(), rwgt::ReweightAna::analyze(), caldata::CalWireAna::analyze(), opdet::FIFOHistogramAna::analyze(), opdet::TrackTimeAssocAna::analyze(), opdet::OpDigiAna::analyze(), opdet::OpFlashAna::analyze(), microboone::CosmicRemovalAna::analyze(), detsim::SimWireAna::analyze(), opdet::FlashPurityCheckAna::analyze(), opdet::LEDCalibrationAna::analyze(), larg::LArSimChannelAna::analyze(), trkf::SpacePointAna::analyze(), pfpf::PFPAna::analyze(), cluster::ClusterAna::analyze(), hit::MagDriftAna::analyze(), detsim::WienerFilterAna::analyze(), cluster::DBclusterAna::analyze(), hit::GausHitFinderAna::analyze(), hit::HitFinderAna::analyze(), cluster::HoughLineFinderAna::analyze(), opdet::SimPhotonCounter::analyze(), vertex::FeatureVertexFinderAna::analyze(), ems::MultiEMShowers::analyze(), lar::example::AnalysisExample::analyze(), trkf::SeedAna::analyze(), trkf::TrackAna::analyze(), ClusteringValidation::ClusteringValidation::analyze(), trkf::TrackAna::anaStitch(), lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps(), evd::AnalysisBaseDrawer::CalorShower(), evd::HitSelector::ChangeHit(), lar_cluster3d::StandardHit3DBuilder::CollectArtHits(), lar_pandora::LArPandoraHelper::CollectClusters(), lar_pandora::LArPandoraHelper::CollectCosmicTags(), lar_pandora::LArPandoraHelper::CollectGeneratorMCParticles(), lar_pandora::LArPandoraHelper::CollectHits(), lar_pandora::LArPandoraHelper::CollectMCParticles(), lar_pandora::LArPandoraHelper::CollectPFParticleMetadata(), lar_pandora::LArPandoraHelper::CollectPFParticles(), lar_pandora::LArPandoraHelper::CollectSeeds(), ems::EMShower3D::CollectShower2D(), lar_pandora::LArPandoraHelper::CollectShowers(), ems::MergeEMShower3D::collectshowers(), lar_pandora::LArPandoraHelper::CollectSimChannels(), lar_pandora::LArPandoraHelper::CollectSpacePoints(), lar_pandora::LArPandoraHelper::CollectT0s(), lar_pandora::LArPandoraHelper::CollectTracks(), lar_pandora::LArPandoraHelper::CollectVertices(), lar_pandora::LArPandoraHelper::CollectWires(), ems::MultiEMShowers::convCluster(), t0::IndirectHitParticleAssns::CreateHitParticleAssociations(), t0::DirectHitParticleAssns::CreateHitParticleAssociations(), evd::AnalysisBaseDrawer::DrawDeDx(), evd::AnalysisBaseDrawer::DrawKineticEnergy(), evd::RecoBaseDrawer::DrawTrackVertexAssns2D(), art::Run::endTime(), art::SubRun::endTime(), filt::LArG4ParticleFilter::filter(), simfilter::FilterNoMCParticles::filter(), filt::FinalStateParticleFilter::filter(), filt::FinalStateSelectFilter::filter(), simfilter::FilterSimPhotonTime::filter(), cluster::SmallClusterFilter::filter(), filt::EmptyFilter::filter(), simfilter::FilterNoDirtNeutrinos::filter(), simfilter::FilterStoppingMuon::filter(), filter::MuonFilter::filter(), trkf::StitchAlg::FindHeadsAndTails(), anab::FVectorReader< T, N >::FVectorReader(), trkf::Track3DKalmanHit::getAllHits(), lar_pandora::LArPandoraHelper::GetAssociatedHits(), evd::RecoBaseDrawer::GetBezierTracks(), art::DataViewImpl::getByLabel(), art::DataViewImpl::getByToken(), trkf::Track3DKalmanHit::getClusteredHits(), evd::RecoBaseDrawer::GetClusters(), lar_pandora::LArPandoraEvent::GetCollection(), ShowerQuality::GetDataOrDie(), evd::RecoBaseDrawer::GetEdges(), evd::RecoBaseDrawer::GetEndPoint2D(), evd::RecoBaseDrawer::GetEvents(), lar_pandora::LArPandoraEvent::GetFilteredParticlesByCRTag(), ems::MergeEMShower3D::getGammaId(), trkf::BezierTrackerModule::GetHitsFromClusters(), trkf::SeedFinderModule::GetHitsFromEvent(), evd::RecoBaseDrawer::GetOpFlashes(), evd::RecoBaseDrawer::GetPFParticles(), trkf::Track3DKalmanHit::getPFParticleStuff(), art::DataViewImpl::getPointerByLabel(), evd::RecoBaseDrawer::GetSeeds(), sim::SimListUtils::GetSimPhotonsCollection(), trkf::SeedFinderModule::GetSortedHitsFromClusters(), evd::RecoBaseDrawer::GetSpacePoints(), art::DataViewImpl::getValidHandle(), evd::RecoBaseDrawer::GetVertices(), evwgh::GenieWeightCalc::GetWeight(), evd::RecoBaseDrawer::GetWires(), lar_cluster3d::SpacePointHit3DBuilder::Hit3DBuilder(), ems::MergeEMShower3D::mcinfo(), evgb::MCTruthAndFriendsItr::MCTruthAndFriendsItr(), mvapid::MVAAlg::PrepareEvent(), wc::CellTree::processCalib(), DUNE::NeutrinoShowerEff::processEff(), DUNE::NeutrinoTrackingEff::processEff(), DUNE::MuonTrackingEff::processEff(), wc::CellTree::processMC(), wc::CellTree::processOpFlash(), wc::CellTree::processOpHit(), wc::CellTree::processRaw(), wc::CellTree::processSpacePoint(), wc::CellTree::processTrigger(), event::EventMaker::produce(), MCReco::produce(), opdet::FlashClusterMatch::produce(), hit::DisambigCheater::produce(), hit::MCHitFinder::produce(), hit::TTHitFinder::produce(), trk::TrackContainmentTagger::produce(), vertex::VertexCheater::produce(), cluster::SimpleClusterMerger::produce(), opdet::OpMCDigi::produce(), vertex::CornerFinder::produce(), hit::RFFHitFinder::produce(), shwf::ShowerCheater::produce(), event::EventCheater::produce(), apa::APAHitFinder::produce(), opdet::TrackTimeAssoc::produce(), opdet::BeamFlashCompatabilityCheck::produce(), sppt::TTSpacePointFinder::produce(), trkf::SpacePointCheater::produce(), sim::MergeSimSources::produce(), trkf::SpacePointFinder::produce(), trkf::BezierTrackerModule::produce(), spacecharge::ShiftEdepSCE::produce(), noisefilteralg::WireCellNoiseFilter::produce(), trkf::TrackCheater::produce(), opdet::OpticalRawDigitReformatter::produce(), calo::BezierCalorimetry::produce(), cluster::ClusterCheater::produce(), pid::Chi2ParticleID::produce(), evwgh::EventWeight::produce(), cosmic::BeamFlashTrackMatchTagger::produce(), hit::FFTHitFinder::produce(), calo::TrackCalorimetry::produce(), vertex::AggregateVertex::produce(), opdet::OpFlashFinder::produce(), calo::GeneralCalorimetry::produce(), caldata::CalWire::produce(), trkf::FeatureTracker::produce(), CRHitRemoval::produce(), caldata::CalWireT962::produce(), cluster::FuzzyClusterMerger::produce(), ShowerReco3D::produce(), cluster::DBcluster::produce(), cosmic::TrackPFParticleMatch::produce(), cluster::LineMerger::produce(), cluster::BlurredClustering::produce(), cluster::fuzzyCluster::produce(), trkf::SpacePts::produce(), cosmic::CosmicPFParticleTagger::produce(), shower::EMShower::produce(), event::AggregateEvent::produce(), opdet::OpHitFinder::produce(), vertex::VertexMatch::produce(), trkf::Track3Dreco::produce(), cosmic::CosmicTrackTagger::produce(), trkf::TrackKalmanCheater::produce(), shwf::ShowerFinder::produce(), cosmic::CosmicPCAxisTagger::produce(), cosmic::CosmicClusterTagger::produce(), t0::MCParticleShowerMatching::produce(), t0::MCParticleTrackMatching::produce(), reco3d::SpacePointSolver::produce(), hit::RawHitFinder::produce(), trkf::CCTrackMaker::produce(), vertex::PrimaryVertexFinder::produce(), trkf::MCSFitProducer::produce(), vertex::HarrisVertexFinder::produce(), cluster::SmallClusterFinder::produce(), cluster::EndPointModule::produce(), hit::GausHitFinder::produce(), trkf::TrackStitcher::produce(), ems::EMShower3D::produce(), CRHitRemovalByPCA::produce(), cluster::HoughLineFinder::produce(), hit::DPRawHitFinder::produce(), calo::Calorimetry::produce(), vertex::VertexFinder2D::produce(), shwf::ShowerReco::produce(), trkf::Track3DKalman::produce(), lbne::PhotonCounterT0Matching::produce(), trkf::PMAlgTrajFitter::produce(), detsim::SimDriftElectrons::produce(), trkf::Track3DKalmanSPS::produce(), t0::MCTruthT0Matching::produce(), vertex::FeatureVertexFinder::produce(), trkf::KalmanFilterTrajectoryFitter::produce(), trkf::CosmicTracker::produce(), larg4::LArG4::produce(), ems::MergeEMShower3D::produce(), art::Event::put(), evd::details::RawDigitCacheDataClass::ReadProduct(), evd::InfoTransfer::Rebuild(), cheat::PhotonBackTracker::Rebuild(), evd::HitSelector::SaveHits(), evd::HitSelector::SaveSeedLines(), cluster::ClusterMergeHelper::SetClusters(), nnet::TrainingDataAlg::setDataEventData(), tss::TrackShowerHits::sortHits(), and evd::details::RawDigitCacheDataClass::Update().

347 {
348  return getByLabel<PROD>(label, productInstanceName, {}, result);
349 }
const std::string label
template<typename PROD >
bool art::DataViewImpl::getByLabel ( std::string const &  label,
std::string const &  productInstanceName,
std::string const &  processName,
Handle< PROD > &  result 
) const
inlineinherited

Definition at line 353 of file DataViewImpl.h.

References art::DataViewImpl::branchType_, art::Handle< T >::clear(), art::DataViewImpl::consumer_, art::convert_handle(), art::Handle< T >::failedToGet(), art::DataViewImpl::getByLabel_(), label, art::ProductInfo::Product, art::Handle< T >::provenance(), art::DataViewImpl::recordAsParent(), art::DataViewImpl::recordParents_, and art::GroupQueryResult::succeeded().

357 {
358  result.clear(); // Is this the correct thing to do if an exception is thrown?
359  auto const wrapped = WrappedTypeID::make<PROD>();
360  ProductInfo const pinfo{ProductInfo::ConsumableType::Product,
361  wrapped.product_type,
362  label,
363  productInstanceName,
364  processName};
365  consumer_->validateConsumedProduct(branchType_, pinfo);
366  GroupQueryResult bh =
367  getByLabel_(wrapped, label, productInstanceName, processName);
368  convert_handle(bh, result);
369  bool const ok{bh.succeeded() && !result.failedToGet()};
370  if (recordParents_ && ok) {
371  recordAsParent(*result.provenance());
372  }
373  return ok;
374 }
void recordAsParent(Provenance const &prov) const
Definition: DataViewImpl.cc:87
const std::string label
BranchType const branchType_
Definition: DataViewImpl.h:283
cet::exempt_ptr< Consumer > consumer_
Definition: DataViewImpl.h:291
void convert_handle(GroupQueryResult const &, Handle< T > &)
Definition: Handle.h:249
GroupQueryResult getByLabel_(WrappedTypeID const &wrapped, std::string const &label, std::string const &productInstanceName, std::string const &processName) const
Definition: DataViewImpl.cc:60
bool const recordParents_
Definition: DataViewImpl.h:286
template<typename PROD >
PROD const & art::DataViewImpl::getByLabel ( InputTag const &  tag) const
inlineinherited

same as above, but using the InputTag class

Definition at line 378 of file DataViewImpl.h.

References art::DataViewImpl::getByLabel().

379 {
380  Handle<PROD> h;
381  getByLabel(tag, h);
382  return *h;
383 }
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
template<typename PROD >
bool art::DataViewImpl::getByLabel ( InputTag const &  tag,
Handle< PROD > &  result 
) const
inlineinherited

Definition at line 337 of file DataViewImpl.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

338 {
339  return getByLabel<PROD>(tag.label(), tag.instance(), tag.process(), result);
340 }
template<typename PROD >
bool art::DataViewImpl::getByToken ( ProductToken< PROD > const &  token,
Handle< PROD > &  result 
) const
inlineinherited

Definition at line 387 of file DataViewImpl.h.

References art::DataViewImpl::getByLabel(), and art::ProductToken< T >::inputTag_.

Referenced by art::Run::endTime(), art::SubRun::endTime(), and art::Event::put().

389 {
390  auto const& tag = token.inputTag_;
391  return getByLabel(tag.label(), tag.instance(), tag.process(), result);
392 }
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
template<typename PROD >
void art::DataViewImpl::getMany ( SelectorBase const &  sel,
std::vector< Handle< PROD >> &  results 
) const
inlineinherited

Definition at line 421 of file DataViewImpl.h.

References art::DataViewImpl::branchType_, art::DataViewImpl::consumer_, art::convert_handle(), art::DataViewImpl::getMany_(), art::ProductInfo::Many, art::DataViewImpl::recordAsParent(), and art::DataViewImpl::recordParents_.

Referenced by art::Run::endTime(), art::SubRun::endTime(), art::DataViewImpl::getManyByType(), and art::Event::put().

423 {
424  auto const wrapped = WrappedTypeID::make<PROD>();
425  consumer_->validateConsumedProduct(
426  branchType_,
427  ProductInfo{ProductInfo::ConsumableType::Many, wrapped.product_type});
428 
429  std::vector<Handle<PROD>> products;
430  for (auto const& qr : getMany_(wrapped, sel)) {
431  Handle<PROD> result;
432  convert_handle(qr, result);
433  products.push_back(result);
434  }
435  results.swap(products);
436 
437  if (!recordParents_)
438  return;
439 
440  for (auto const& h : results)
441  recordAsParent(*h.provenance());
442 }
void recordAsParent(Provenance const &prov) const
Definition: DataViewImpl.cc:87
BranchType const branchType_
Definition: DataViewImpl.h:283
cet::exempt_ptr< Consumer > consumer_
Definition: DataViewImpl.h:291
void convert_handle(GroupQueryResult const &, Handle< T > &)
Definition: Handle.h:249
GroupQueryResultVec getMany_(WrappedTypeID const &wrapped, SelectorBase const &sel) const
Definition: DataViewImpl.cc:53
bool const recordParents_
Definition: DataViewImpl.h:286
template<typename PROD >
PROD const * art::DataViewImpl::getPointerByLabel ( InputTag const &  tag) const
inlineinherited

Definition at line 396 of file DataViewImpl.h.

References art::DataViewImpl::getByLabel().

Referenced by art::Run::endTime(), art::SubRun::endTime(), and art::Event::put().

397 {
398  Handle<PROD> h;
399  getByLabel(tag, h);
400  return &(*h);
401 }
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
BranchDescription const & art::DataViewImpl::getProductDescription ( TypeID const &  type,
std::string const &  productInstanceName 
) const
protectedinherited

Definition at line 142 of file DataViewImpl.cc.

References art::DataViewImpl::branchType_, art::get_ProductDescription(), art::ProductMetaData::instance(), art::DataViewImpl::md_, art::ModuleDescription::moduleLabel(), art::ModuleDescription::processName(), and art::ProductMetaData::productList().

Referenced by art::DataViewImpl::checkPutProducts(), put(), art::Event::put(), art::Run::put_(), art::SubRun::put_(), and art::DataViewImpl::retrievedProducts().

144  {
145  return get_ProductDescription(type,
146  md_.processName(),
148  branchType_,
149  md_.moduleLabel(),
150  productInstanceName);
151  }
BranchDescription const & get_ProductDescription(BranchType branch_type, std::string const &module_label, std::string const &instance_name)
BranchType const branchType_
Definition: DataViewImpl.h:283
static ProductMetaData const & instance()
ModuleDescription const & md_
Definition: DataViewImpl.h:280
std::string const & processName() const
std::string const & moduleLabel() const
ProductList const & productList() const
template<typename PROD >
ValidHandle<PROD> art::DataViewImpl::getValidHandle ( ProductToken< PROD > const &  token) const
inherited
template<typename PROD >
art::ValidHandle<PROD> art::DataViewImpl::getValidHandle ( InputTag const &  tag) const
inlineinherited

Definition at line 405 of file DataViewImpl.h.

References art::DataViewImpl::getByLabel(), and art::ValidHandle< T >::provenance().

406 {
407  Handle<PROD> h;
408  getByLabel(tag, h);
409  return ValidHandle<PROD>(&(*h), *h.provenance());
410 }
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
template<typename PROD >
art::ValidHandle<PROD> art::DataViewImpl::getValidHandle ( ProductToken< PROD > const &  token) const
inlineinherited

Definition at line 414 of file DataViewImpl.h.

References art::ProductToken< T >::inputTag_.

415 {
416  return getValidHandle<PROD>(token.inputTag_);
417 }
template<typename ELEMENT >
std::size_t art::DataViewImpl::getView ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
std::vector< ELEMENT const * > &  result 
) const
inherited
template<typename ELEMENT >
std::size_t art::DataViewImpl::getView ( InputTag const &  tag,
std::vector< ELEMENT const * > &  result 
) const
inherited

Definition at line 486 of file DataViewImpl.h.

References art::DataViewImpl::fillView_(), art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

488 {
489  auto bhv = getView_<ELEMENT>(tag.label(), tag.instance(), tag.process());
490  std::size_t const orig_size = result.size();
491  fillView_(bhv[0], result);
492  return result.size() - orig_size;
493 } // getView<>()
void fillView_(GroupQueryResult &bh, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:531
template<typename ELEMENT >
std::size_t art::DataViewImpl::getView ( ViewToken< ELEMENT > const &  token,
std::vector< ELEMENT const * > &  result 
) const
inherited
template<typename ELEMENT >
bool art::DataViewImpl::getView ( std::string const &  moduleLabel,
std::string const &  instanceName,
View< ELEMENT > &  result 
) const
inherited

Definition at line 497 of file DataViewImpl.h.

References art::DataViewImpl::fillView_(), art::View< T >::set_innards(), and art::View< T >::vals().

500 {
501  auto bhv = getView_<ELEMENT>(moduleLabel, productInstanceName, {});
502  fillView_(bhv[0], result.vals());
503  result.set_innards(bhv[0].result()->productID(),
504  bhv[0].result()->uniqueProduct());
505  return true;
506 }
void fillView_(GroupQueryResult &bh, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:531
template<typename ELEMENT >
bool art::DataViewImpl::getView ( InputTag const &  tag,
View< ELEMENT > &  result 
) const
inherited

Definition at line 510 of file DataViewImpl.h.

References art::DataViewImpl::fillView_(), art::InputTag::instance(), art::InputTag::label(), art::InputTag::process(), art::View< T >::set_innards(), and art::View< T >::vals().

511 {
512  auto bhv = getView_<ELEMENT>(tag.label(), tag.instance(), tag.process());
513  fillView_(bhv[0], result.vals());
514  result.set_innards(bhv[0].result()->productID(),
515  bhv[0].result()->uniqueProduct());
516  return true;
517 }
void fillView_(GroupQueryResult &bh, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:531
template<typename ELEMENT >
bool art::DataViewImpl::getView ( ViewToken< ELEMENT > const &  tag,
View< ELEMENT > &  result 
) const
inherited

Definition at line 521 of file DataViewImpl.h.

References art::DataViewImpl::getView(), and art::ViewToken< Element >::inputTag_.

523 {
524  return getView(token.inputTag_, result);
525 }
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:474
template<typename ELEMENT >
art::DataViewImpl::GroupQueryResultVec art::DataViewImpl::getView_ ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
std::string const &  processName 
) const
inherited

Definition at line 453 of file DataViewImpl.h.

References art::DataViewImpl::branchType_, art::DataViewImpl::consumer_, art::DataViewImpl::ensureUniqueProduct_(), art::DataViewImpl::getMatchingSequenceByLabel_(), art::DataViewImpl::removeNonViewableMatches_(), and art::ProductInfo::ViewElement.

456 {
457  TypeID const typeID{typeid(ELEMENT)};
458  ProductInfo const pinfo{ProductInfo::ConsumableType::ViewElement,
459  typeID,
460  moduleLabel,
461  productInstanceName,
462  processName};
463  consumer_->validateConsumedProduct(branchType_, pinfo);
464  auto bhv =
465  getMatchingSequenceByLabel_(moduleLabel, productInstanceName, processName);
466  removeNonViewableMatches_(typeID, bhv);
468  bhv.size(), typeID, moduleLabel, productInstanceName, processName);
469  return bhv;
470 } // getView_<>()
void ensureUniqueProduct_(std::size_t nFound, TypeID const &typeID, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName) const
BranchType const branchType_
Definition: DataViewImpl.h:283
cet::exempt_ptr< Consumer > consumer_
Definition: DataViewImpl.h:291
void removeNonViewableMatches_(TypeID const &requestedElementType, GroupQueryResultVec &results) const
GroupQueryResultVec getMatchingSequenceByLabel_(std::string const &label, std::string const &productInstanceName, std::string const &processName) const
Definition: DataViewImpl.cc:70
ProcessHistory const & art::DataViewImpl::processHistory ( ) const
inherited

Definition at line 81 of file DataViewImpl.cc.

References art::DataViewImpl::principal_, and art::Principal::processHistory().

Referenced by art::Run::endTime(), art::SubRun::endTime(), and art::Event::put().

82  {
83  return principal_.processHistory();
84  }
Principal const & principal_
Definition: DataViewImpl.h:276
ProcessHistory const & processHistory() const
Definition: Principal.h:132
art::EDProductGetter const * art::Results::productGetter ( ProductID const  pid) const

Definition at line 12 of file Results.cc.

References principal_, and art::Principal::productGetter().

13 {
15 }
EDProductGetter const * productGetter(ProductID const pid) const
Definition: Principal.cc:532
Principal const & principal_
Definition: Results.h:73
template<typename PROD >
art::ProductID art::Results::put ( std::unique_ptr< PROD > &&  product)

Definition at line 78 of file Results.h.

79 {
80  return put<PROD>(std::move(product), {});
81 }
template<typename PROD >
art::ProductID art::Results::put ( std::unique_ptr< PROD > &&  product,
std::string const &  productInstanceName 
)

Definition at line 85 of file Results.h.

References art::DataViewImpl::getProductDescription(), art::RangeSet::invalid(), art::errors::NullPointerError, art::errors::ProductPutFailure, and art::DataViewImpl::putProducts().

87 {
88  TypeID const tid{typeid(PROD)};
89  if (!product) { // Null pointer is illegal.
91  << "Results::put: A null unique_ptr was passed to 'put'.\n"
92  << "The pointer is of type " << tid << ".\n"
93  << "The specified productInstanceName was '" << productInstanceName
94  << "'.\n";
95  }
96 
97  auto const& pd = getProductDescription(tid, productInstanceName);
98  auto wp = std::make_unique<Wrapper<PROD>>(std::move(product));
99 
100  auto result = putProducts().emplace(
101  TypeLabel{
102  tid, productInstanceName, SupportsView<PROD>::value, false /*not used*/},
103  PMValue{std::move(wp), pd, RangeSet::invalid()});
104  if (!result.second) {
106  << "Results::put: Attempt to put multiple products with the\n"
107  << " following description onto the Results.\n"
108  << " Products must be unique per Results.\n"
109  << "=================================\n"
110  << pd << "=================================\n";
111  }
112 
113  return pd.productID();
114 }
BranchDescription const & getProductDescription(TypeID const &type, std::string const &productInstanceName) const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string value(boost::any const &)
static RangeSet invalid()
Definition: RangeSet.cc:46
TypeLabelMap & putProducts()
Definition: DataViewImpl.h:183
TypeLabelMap& art::DataViewImpl::putProducts ( )
inlineprotectedinherited
TypeLabelMap const& art::DataViewImpl::putProducts ( ) const
inlineprotectedinherited

Definition at line 188 of file DataViewImpl.h.

References art::DataViewImpl::putProducts_.

189  {
190  return putProducts_;
191  }
TypeLabelMap putProducts_
Definition: DataViewImpl.h:266
void art::DataViewImpl::recordAsParent ( Provenance const &  prov) const
protectedinherited

Definition at line 87 of file DataViewImpl.cc.

References art::Provenance::parents(), art::Provenance::productDescription(), art::Provenance::productID(), art::DataViewImpl::retrievedProducts_, and art::BranchDescription::transient().

Referenced by art::DataViewImpl::fillView_(), art::DataViewImpl::get(), art::DataViewImpl::getByLabel(), and art::DataViewImpl::getMany().

88  {
89  if (prov.productDescription().transient()) {
90  // If the product retrieved is transient, don't use its
91  // ProductID; use the ProductID's of its parents.
92  auto const& parents = prov.parents();
93  retrievedProducts_.insert(cbegin(parents), cend(parents));
94  } else {
95  retrievedProducts_.insert(prov.productID());
96  }
97  }
RetrievedProductSet retrievedProducts_
Definition: DataViewImpl.h:272
template<typename PROD >
bool art::DataViewImpl::removeCachedProduct ( Handle< PROD > &  h) const
inherited

Definition at line 551 of file DataViewImpl.h.

References art::Handle< T >::clear(), art::Handle< T >::id(), art::Handle< T >::isValid(), art::Handle< T >::provenance(), and art::DataViewImpl::removeCachedProduct_().

Referenced by art::Run::endTime(), art::SubRun::endTime(), hit::MCHitFinder::produce(), and art::Event::put().

552 {
553  bool result{false};
554  if (h.isValid() && !h.provenance()->produced()) {
555  removeCachedProduct_(h.id());
556  h.clear();
557  result = true;
558  }
559  return result;
560 }
void removeCachedProduct_(ProductID const pid) const
DataViewImpl::RetrievedProductIDs art::DataViewImpl::retrievedProductIDs ( ) const
protectedinherited

Definition at line 100 of file DataViewImpl.cc.

References art::DataViewImpl::retrievedProducts_.

Referenced by art::Event::commit(), and art::DataViewImpl::retrievedProducts().

101  {
102  std::vector<ProductID> result;
103  result.reserve(retrievedProducts_.size());
104  result.assign(cbegin(retrievedProducts_), cend(retrievedProducts_));
105  return result;
106  }
RetrievedProductSet retrievedProducts_
Definition: DataViewImpl.h:272
RetrievedProductSet const& art::DataViewImpl::retrievedProducts ( ) const
inlineprotectedinherited
size_t art::DataViewImpl::size ( void  ) const
inherited

Definition at line 34 of file DataViewImpl.cc.

References art::DataViewImpl::principal_, art::DataViewImpl::putProducts_, and art::Principal::size().

Referenced by art::Event::put().

35  {
36  return putProducts_.size() + principal_.size();
37  }
Principal const & principal_
Definition: DataViewImpl.h:276
size_t size() const
Definition: Principal.h:150
TypeLabelMap putProducts_
Definition: DataViewImpl.h:266

Member Data Documentation

Principal const& art::Results::principal_
private

Definition at line 73 of file Results.h.

Referenced by productGetter(), and Results().


The documentation for this class was generated from the following files: