LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::Run Class Referencefinal

#include "Run.h"

Inheritance diagram for art::Run:
art::DataViewImpl

Public Types

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

Public Member Functions

 Run (RunPrincipal const &rp, ModuleDescription const &md, cet::exempt_ptr< Consumer > consumer, RangeSet const &rsForPuttingProducts=RangeSet::invalid())
 
RunID const & id () const
 
RunNumber_t run () const
 
Timestamp const & beginTime () const
 
Timestamp const & endTime () const
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&)
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&, FullSemantic< Level::Run >)
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&, FragmentSemantic< Level::Run >)
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&, RangedFragmentSemantic< Level::Run >)
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&, std::string const &instanceName)
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&, std::string const &instanceName, FullSemantic< Level::Run >)
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&, std::string const &instanceName, FragmentSemantic< Level::Run >)
 
template<typename PROD >
art::ProductID put (std::unique_ptr< PROD > &&, std::string const &instanceName, RangedFragmentSemantic< Level::Run >)
 
bool getProcessParameterSet (std::string const &processName, std::vector< fhicl::ParameterSet > &ps) const
 
EDProductGetter const * productGetter (ProductID const pid) const
 
void commit (RunPrincipal &rp, bool const checkProducts, std::set< TypeLabel > const &expectedProducts)
 
void commit (RunPrincipal &)
 

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

template<typename PROD >
art::ProductID put_ (std::unique_ptr< PROD > &&product, std::string const &productInstanceName, RangeSet const &rs)
 Put a new product with a 'product instance name' and a 'range set'. More...
 
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_
 
RunAuxiliary const & aux_
 
RangeSet productRangeSet_
 

Detailed Description

Definition at line 30 of file Run.h.

Member Typedef Documentation

Definition at line 32 of file Run.h.

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

Definition at line 214 of file DataViewImpl.h.

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

Definition at line 126 of file Run.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::Run::Run ( RunPrincipal const &  rp,
ModuleDescription const &  md,
cet::exempt_ptr< Consumer consumer,
RangeSet const &  rsForPuttingProducts = RangeSet::invalid() 
)
explicit

Definition at line 11 of file Run.cc.

References aux_, art::InRun, principal_, and productRangeSet_.

15  : DataViewImpl{rp, md, InRun, false, consumer}
16  , principal_{rp}
17  , aux_{rp.aux()}
18  , productRangeSet_{rs}
19 {}
Principal const & principal_
Definition: Run.h:135
RunAuxiliary const & aux_
Definition: Run.h:136
DataViewImpl(DataViewImpl const &)=delete
RangeSet productRangeSet_
Definition: Run.h:137

Member Function Documentation

Timestamp const& art::Run::beginTime ( ) const
inline

Definition at line 51 of file Run.h.

References aux_, and art::RunAuxiliary::beginTime().

Referenced by art::Tracer::preBeginRun().

52  {
53  return aux_.beginTime();
54  }
RunAuxiliary const & aux_
Definition: Run.h:136
Timestamp const & beginTime() const
Definition: RunAuxiliary.h:57
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 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::Run::commit ( RunPrincipal rp,
bool const  checkProducts,
std::set< TypeLabel > const &  expectedProducts 
)

Definition at line 36 of file Run.cc.

References art::DataViewImpl::checkPutProducts(), principal_, and art::DataViewImpl::putProducts().

Referenced by endTime().

39 {
40  // Check addresses only since type of 'rp' will hopefully change to
41  // Principal&.
42  assert(&rp == &principal_);
43  checkPutProducts(checkProducts, expectedProducts, putProducts());
44  commit(rp);
45 }
void commit(RunPrincipal &rp, bool const checkProducts, std::set< TypeLabel > const &expectedProducts)
Definition: Run.cc:36
Principal const & principal_
Definition: Run.h:135
TypeLabelMap & putProducts()
Definition: DataViewImpl.h:183
void checkPutProducts(bool checkProducts, std::set< TypeLabel > const &expectedProducts, TypeLabelMap const &putProducts)
void art::Run::commit ( RunPrincipal rp)

Definition at line 48 of file Run.cc.

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

49 {
50  for (auto& elem : putProducts()) {
51  auto const& pd = elem.second.pd;
52  auto productProvenancePtr = std::make_unique<ProductProvenance const>(
53  pd.productID(), productstatus::present());
54  rp.put(std::move(elem.second.prod),
55  pd,
56  std::move(productProvenancePtr),
57  std::move(elem.second.rs));
58  }
59 
60  // the cleanup is all or none
61  putProducts().clear();
62 }
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 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.

Referenced by lar::util::details::FindAllP< Source, Dest >::Add(), reco3d::PlotSpacePoints::analyze(), hit::MCHitAnaExample::analyze(), pid::PIDAAnalyzer::analyze(), opdet::OpFlashSimpleAna::analyze(), opdet::OpHitAna::analyze(), cheat::CheckBackTracking::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(), shower::TCShowerTemplateMaker::analyze(), opdet::FIFOHistogramAna::analyze(), opdet::TrackTimeAssocAna::analyze(), shower::TCShowerElectronLikelihood::analyze(), shower::TCShowerAnalysis::analyze(), opdet::OpDigiAna::analyze(), opdet::OpFlashAna::analyze(), microboone::CosmicRemovalAna::analyze(), detsim::SimWireAna::analyze(), opdet::FlashPurityCheckAna::analyze(), opdet::LEDCalibrationAna::analyze(), larg::LArSimChannelAna::analyze(), pfpf::PFPAna::analyze(), trkf::SpacePointAna::analyze(), cluster::ClusterAna::analyze(), hit::MagDriftAna::analyze(), detsim::WienerFilterAna::analyze(), cluster::DBclusterAna::analyze(), hit::GausHitFinderAna::analyze(), hit::HitFinderAna::analyze(), cluster::HoughLineFinderAna::analyze(), NuShowerEff::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::LArPandoraExternalEventBuilding::CollectPFParticles(), 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(), 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(), shower::TCShower::getShowersWithoutSlices(), shower::TCShower::getShowersWithSlices(), sim::SimListUtils::GetSimPhotonsCollection(), evd::RecoBaseDrawer::GetSlices(), trkf::SeedFinderModule::GetSortedHitsFromClusters(), evd::RecoBaseDrawer::GetSpacePoints(), art::DataViewImpl::getValidHandle(), evd::RecoBaseDrawer::GetVertices(), evwgh::GenieWeightCalc::GetWeight(), evd::RecoBaseDrawer::GetWires(), lar_cluster3d::SpacePointHit3DBuilder::Hit3DBuilder(), lar_pandora::LArPandoraEventDump::PandoraData::LoadCollection(), 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::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(), event::EventCheater::produce(), shwf::ShowerCheater::produce(), apa::APAHitFinder::produce(), opdet::TrackTimeAssoc::produce(), opdet::BeamFlashCompatabilityCheck::produce(), sim::MergeSimSources::produce(), sppt::TTSpacePointFinder::produce(), trkf::SpacePointCheater::produce(), trkf::SpacePointFinder::produce(), trkf::BezierTrackerModule::produce(), spacecharge::ShiftEdepSCE::produce(), noisefilteralg::WireCellNoiseFilter::produce(), trkf::TrackCheater::produce(), opdet::OpticalRawDigitReformatter::produce(), pid::Chi2ParticleID::produce(), cluster::ClusterCheater::produce(), calo::BezierCalorimetry::produce(), hit::FFTHitFinder::produce(), evwgh::EventWeight::produce(), calo::TrackCalorimetry::produce(), cosmic::BeamFlashTrackMatchTagger::produce(), caldata::CalWire::produce(), trkf::FeatureTracker::produce(), opdet::OpFlashFinder::produce(), vertex::AggregateVertex::produce(), CRHitRemoval::produce(), cluster::TrajCluster::produce(), cluster::DBcluster::produce(), cosmic::TrackPFParticleMatch::produce(), cluster::FuzzyClusterMerger::produce(), ShowerReco3D::produce(), caldata::CalWireT962::produce(), cluster::BlurredClustering::produce(), cluster::LineMerger::produce(), cluster::fuzzyCluster::produce(), trkf::SpacePts::produce(), cosmic::CosmicPFParticleTagger::produce(), shower::EMShower::produce(), event::AggregateEvent::produce(), shower::TCShower::produce(), cosmic::CosmicTrackTagger::produce(), trkf::Track3Dreco::produce(), vertex::VertexMatch::produce(), trkf::TrackKalmanCheater::produce(), shwf::ShowerFinder::produce(), cosmic::CosmicPCAxisTagger::produce(), cosmic::CosmicClusterTagger::produce(), t0::MCParticleTrackMatching::produce(), t0::MCParticleShowerMatching::produce(), hit::RawHitFinder::produce(), opdet::OpHitFinder::produce(), reco3d::SpacePointSolver::produce(), trkf::CCTrackMaker::produce(), trkf::MCSFitProducer::produce(), vertex::PrimaryVertexFinder::produce(), cluster::SmallClusterFinder::produce(), vertex::HarrisVertexFinder::produce(), cluster::EndPointModule::produce(), hit::GausHitFinder::produce(), trkf::TrackStitcher::produce(), ems::EMShower3D::produce(), CRHitRemovalByPCA::produce(), cluster::HoughLineFinder::produce(), calo::Calorimetry::produce(), hit::DPRawHitFinder::produce(), vertex::VertexFinder2D::produce(), shwf::ShowerReco::produce(), trkf::Track3DKalman::produce(), lbne::PhotonCounterT0Matching::produce(), trkf::PMAlgTrajFitter::produce(), trkf::Track3DKalmanSPS::produce(), detsim::SimDriftElectrons::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 }
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_(), 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
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 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 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 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
bool art::Run::getProcessParameterSet ( std::string const &  processName,
std::vector< fhicl::ParameterSet > &  ps 
) const

Definition at line 28 of file Run.cc.

Referenced by endTime().

30 {
31  // Unimplemented
32  return false;
33 }
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(), art::Results::put(), art::Event::put(), 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 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::Run::productGetter ( ProductID const  pid) const

Definition at line 22 of file Run.cc.

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

Referenced by endTime().

23 {
25 }
Principal const & principal_
Definition: Run.h:135
EDProductGetter const * productGetter(ProductID const pid) const
Definition: Principal.cc:532
template<typename PROD >
art::ProductID art::Run::put ( std::unique_ptr< PROD > &&  product,
FullSemantic< Level::Run semantic 
)

Definition at line 155 of file Run.h.

157 {
158  return put<PROD>(std::move(product), std::string{}, semantic);
159 }
template<typename PROD >
art::ProductID art::Run::put ( std::unique_ptr< PROD > &&  product,
FragmentSemantic< Level::Run semantic 
)

Definition at line 163 of file Run.h.

165 {
166  return put<PROD>(std::move(product), std::string{}, semantic);
167 }
template<typename PROD >
art::ProductID art::Run::put ( std::unique_ptr< PROD > &&  product,
RangedFragmentSemantic< Level::Run semantic 
)

Definition at line 171 of file Run.h.

173 {
174  return put<PROD>(std::move(product), std::string{}, std::move(semantic));
175 }
template<typename PROD >
art::ProductID art::Run::put ( std::unique_ptr< PROD > &&  product,
std::string const &  instanceName 
)

Definition at line 182 of file Run.h.

References art::RangeSet::collapse(), and productRangeSet_.

184 {
186  return put_<PROD>(std::move(product), productInstanceName, productRangeSet_);
187 }
RangeSet & collapse()
Definition: RangeSet.cc:74
RangeSet productRangeSet_
Definition: Run.h:137
template<typename PROD >
art::ProductID art::Run::put ( std::unique_ptr< PROD > &&  product,
std::string const &  instanceName,
FullSemantic< Level::Run  
)

Definition at line 191 of file Run.h.

References art::RangeSet::forRun().

194 {
195  return put_<PROD>(
196  std::move(product), productInstanceName, RangeSet::forRun(id()));
197 }
static RangeSet forRun(RunID)
Definition: RangeSet.cc:52
template<typename PROD >
art::ProductID art::Run::put ( std::unique_ptr< PROD > &&  product,
std::string const &  instanceName,
FragmentSemantic< Level::Run  
)

Definition at line 201 of file Run.h.

References art::RangeSet::collapse(), art::RangeSet::is_full_run(), art::errors::ProductPutFailure, and productRangeSet_.

204 {
205  static_assert(
207  "\n\n"
208  "art error: A Run product put with the semantic 'RunFragment'\n"
209  " must be able to be aggregated. Please add the appropriate\n"
210  " void aggregate(T const&)\n"
211  " function to your class, or contact artists@fnal.gov.\n");
212 
214  throw Exception{errors::ProductPutFailure, "Run::put"}
215  << "\nCannot put a product corresponding to a full Run using\n"
216  << "art::runFragment(). This can happen if you attempted to\n"
217  << "put a product at beginRun using art::runFragment().\n"
218  << "Please use either:\n"
219  << " art::fullRun(), or\n"
220  << " art::runFragment(art::RangeSet const&)\n"
221  << "or contact artists@fnal.gov for assistance.\n";
222  }
223  return put_<PROD>(std::move(product), productInstanceName, productRangeSet_);
224 }
RangeSet & collapse()
Definition: RangeSet.cc:74
bool is_full_run() const
Definition: RangeSet.cc:246
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string value(boost::any const &)
RangeSet productRangeSet_
Definition: Run.h:137
template<typename PROD >
art::ProductID art::Run::put ( std::unique_ptr< PROD > &&  product,
std::string const &  instanceName,
RangedFragmentSemantic< Level::Run semantic 
)

Definition at line 228 of file Run.h.

References art::errors::ProductPutFailure, and art::RangedFragmentSemantic< Level >::rs.

231 {
232  static_assert(
234  "\n\n"
235  "art error: A Run product put with the semantic 'RunFragment'\n"
236  " must be able to be aggregated. Please add the appropriate\n"
237  " void aggregate(T const&)\n"
238  " function to your class, or contact artists@fnal.gov.\n");
239  if (semantic.rs.collapse().is_full_run()) {
240  throw Exception{errors::ProductPutFailure, "Run::put"}
241  << "\nCannot put a product corresponding to a full Run using\n"
242  << "art::runFragment(art::RangeSet&). Please use:\n"
243  << " art::fullRun()\n"
244  << "or contact artists@fnal.gov for assistance.\n";
245  }
246  return put_<PROD>(std::move(product), productInstanceName, semantic.rs);
247 }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string value(boost::any const &)
template<typename PROD >
art::ProductID art::Run::put_ ( std::unique_ptr< PROD > &&  product,
std::string const &  productInstanceName,
RangeSet const &  rs 
)
private

Put a new product with a 'product instance name' and a 'range set'.

Definition at line 251 of file Run.h.

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

254 {
255  TypeID const tid{typeid(PROD)};
256  if (product.get() == nullptr) {
257  throw Exception{errors::NullPointerError, "Run::put"}
258  << "\nA null unique_ptr was passed to 'put'.\n"
259  << "The pointer is of type " << tid << ".\n"
260  << "The specified productInstanceName was '" << productInstanceName
261  << "'.\n";
262  }
263 
264  if (!rs.is_valid()) {
265  throw Exception{errors::ProductPutFailure, "Run::put"}
266  << "\nCannot put a product with an invalid RangeSet.\n"
267  << "Please contact artists@fnal.gov.\n";
268  }
269 
270  auto const& pd = getProductDescription(tid, productInstanceName);
271  auto wp = std::make_unique<Wrapper<PROD>>(std::move(product));
272 
273  auto result = putProducts().emplace(
274  TypeLabel{
275  tid, productInstanceName, SupportsView<PROD>::value, false /*not used*/},
276  PMValue{std::move(wp), pd, rs});
277  if (!result.second) {
278  throw Exception{errors::ProductPutFailure, "Run::put"}
279  << "\nAttempt to put multiple products with the\n"
280  << "following description onto the Run.\n"
281  << "Products must be unique per Run.\n"
282  << "=================================\n"
283  << pd << "=================================\n";
284  }
285 
286  return pd.productID();
287 }
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 &)
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 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
RunNumber_t art::Run::run ( ) const
inline

Definition at line 46 of file Run.h.

References aux_, and art::RunAuxiliary::run().

47  {
48  return aux_.run();
49  }
RunNumber_t run() const
Definition: RunAuxiliary.h:74
RunAuxiliary const & aux_
Definition: Run.h:136
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

RunAuxiliary const& art::Run::aux_
private

Definition at line 136 of file Run.h.

Referenced by beginTime(), endTime(), id(), Run(), and run().

Principal const& art::Run::principal_
private

Definition at line 135 of file Run.h.

Referenced by commit(), productGetter(), and Run().

RangeSet art::Run::productRangeSet_
private

Definition at line 137 of file Run.h.

Referenced by put(), and Run().


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