LArSoft  v08_29_00
Liquid Argon Software toolkit - http://larsoft.org/
art::DataViewImpl Class Reference

#include "DataViewImpl.h"

Inheritance diagram for art::DataViewImpl:
art::Event art::Results art::Run art::SubRun

Classes

struct  PMValue
 

Public Member Functions

 ~DataViewImpl ()
 
 DataViewImpl (BranchType bt, Principal const &p, ModuleContext const &mc, bool recordParents, RangeSet const &rs=RangeSet::invalid())
 
 DataViewImpl (DataViewImpl const &)=delete
 
 DataViewImpl (DataViewImpl &&)=delete
 
DataViewImploperator= (DataViewImpl const &)=delete
 
DataViewImploperator= (DataViewImpl &)=delete
 
RunID runID () const
 
SubRunID subRunID () const
 
EventID eventID () const
 
RunNumber_t run () const
 
SubRunNumber_t subRun () const
 
EventNumber_t event () const
 
Timestamp const & beginTime () const
 
Timestamp const & endTime () const
 
Timestamp time () const
 
bool isRealData () const
 
EventAuxiliary::ExperimentType experimentType () const
 
History const & history () const
 
ProcessHistoryID const & processHistoryID () const
 
ProcessHistory const & processHistory () const
 
template<typename PROD >
bool removeCachedProduct (Handle< PROD > &) const
 
EDProductGetter const * productGetter (ProductID const pid) const
 
bool getProcessParameterSet (std::string const &process, fhicl::ParameterSet &) 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 &instance, Handle< PROD > &result) const
 
template<typename PROD >
bool getByLabel (std::string const &label, std::string const &instance, std::string const &process, Handle< PROD > &result) const
 
template<typename PROD >
PROD const & getByLabel (InputTag const &tag) const
 
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 >
ValidHandle< PROD > getValidHandle (InputTag const &tag) const
 
template<typename PROD >
bool getByToken (ProductToken< PROD > const &, Handle< PROD > &result) const
 
template<typename PROD >
ValidHandle< PROD > getValidHandle (ProductToken< PROD > const &) 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::string const &processName, std::vector< ELEMENT const * > &result) 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 &, std::vector< ELEMENT const * > &result) const
 
template<typename ELEMENT >
std::size_t getView (ViewToken< ELEMENT > const &, std::vector< ELEMENT const * > &result) const
 
template<typename ELEMENT >
bool getView (std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, View< ELEMENT > &result) const
 
template<typename ELEMENT >
bool getView (std::string const &moduleLabel, std::string const &productInstanceName, View< ELEMENT > &result) const
 
template<typename ELEMENT >
bool getView (InputTag const &, View< ELEMENT > &result) const
 
template<typename ELEMENT >
bool getView (ViewToken< ELEMENT > const &, View< ELEMENT > &result) const
 
template<typename ELEMENT >
void getPtrVector (std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, PtrVector< ELEMENT > &result) const
 
template<typename ELEMENT >
void getPtrVector (std::string const &moduleLabel, std::string const &productInstanceName, PtrVector< ELEMENT > &result) const
 
template<typename ELEMENT >
void getPtrVector (InputTag const &, PtrVector< ELEMENT > &result) const
 
template<typename ELEMENT >
void getPtrVector (ViewToken< ELEMENT > const &, PtrVector< ELEMENT > &result) const
 
template<typename T >
ProductID getProductID (std::string const &instance_name="") const
 
cet::exempt_ptr< BranchDescription const > getProductDescription (ProductID) const
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, FragmentSemantic< Level::Run > const semantic)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, RangedFragmentSemantic< Level::Run > semantic)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, std::string const &instance, FullSemantic< Level::Run >)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, std::string const &instance, FragmentSemantic< Level::Run >)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, std::string const &instance, RangedFragmentSemantic< Level::Run > semantic)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, FullSemantic< Level::SubRun > const semantic)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, FragmentSemantic< Level::SubRun > const semantic)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, RangedFragmentSemantic< Level::SubRun > semantic)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, std::string const &instance, FullSemantic< Level::SubRun >)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, std::string const &instance, FragmentSemantic< Level::SubRun >)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, std::string const &instance, RangedFragmentSemantic< Level::SubRun > semantic)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, std::string const &instance)
 
template<typename PROD >
ProductID put (std::unique_ptr< PROD > &&edp, std::string const &instance, RangeSet const &rs)
 
void movePutProductsToPrincipal (Principal &principal)
 
void movePutProductsToPrincipal (Principal &principal, bool const checkProducts, std::map< TypeLabel, BranchDescription > const *expectedProducts)
 

Private Member Functions

std::string const & getProcessName_ (std::string const &) const
 
BranchDescription const & getProductDescription_ (TypeID const &type, std::string const &instance, bool const alwaysEnableLookupOfProducedProducts=false) const
 
void recordAsParent_ (cet::exempt_ptr< Group const > grp) const
 
cet::exempt_ptr< Group const > getContainerForView_ (TypeID const &, std::string const &moduleLabel, std::string const &productInstanceName, ProcessTag const &processTag) const
 

Private Attributes

std::recursive_mutex mutex_ {}
 
BranchType const branchType_
 
Principal const & principal_
 
ModuleContext const & mc_
 
ModuleDescription const & md_
 
bool const recordParents_
 
RangeSet rangeSet_ {RangeSet::invalid()}
 
std::set< ProductIDretrievedProducts_ {}
 
std::map< TypeLabel, PMValueputProducts_ {}
 

Friends

class detail::Analyzer
 
class detail::Filter
 
class detail::Producer
 
class ResultsProducer
 
class ProducingService
 

Detailed Description

Definition at line 74 of file DataViewImpl.h.

Constructor & Destructor Documentation

art::DataViewImpl::~DataViewImpl ( )
default
art::DataViewImpl::DataViewImpl ( BranchType  bt,
Principal const &  p,
ModuleContext const &  mc,
bool  recordParents,
RangeSet const &  rs = RangeSet::invalid() 
)
explicit

Definition at line 47 of file DataViewImpl.cc.

References mc_, md_, principal_, rangeSet_, and recordParents_.

52  : branchType_{bt}
53  , principal_{principal}
54  , mc_{mc}
55  , md_{mc.moduleDescription()}
56  , recordParents_{recordParents}
57  , rangeSet_{rs}
58  {}
Principal const & principal_
Definition: DataViewImpl.h:318
BranchType const branchType_
Definition: DataViewImpl.h:315
ModuleDescription const & md_
Definition: DataViewImpl.h:324
ModuleContext const & mc_
Definition: DataViewImpl.h:321
bool const recordParents_
Definition: DataViewImpl.h:331
art::DataViewImpl::DataViewImpl ( DataViewImpl const &  )
delete
art::DataViewImpl::DataViewImpl ( DataViewImpl &&  )
delete

Member Function Documentation

Timestamp const & art::DataViewImpl::beginTime ( ) const

Definition at line 103 of file DataViewImpl.cc.

References art::Principal::beginTime(), mutex_, and principal_.

Referenced by art::Tracer::preBeginRun(), and art::Tracer::preBeginSubRun().

104  {
105  std::lock_guard lock{mutex_};
106  return principal_.beginTime();
107  }
Principal const & principal_
Definition: DataViewImpl.h:318
Timestamp const & beginTime() const
Definition: Principal.cc:1220
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
Timestamp const & art::DataViewImpl::endTime ( ) const

Definition at line 110 of file DataViewImpl.cc.

References art::Principal::endTime(), mutex_, and principal_.

111  {
112  std::lock_guard lock{mutex_};
113  return principal_.endTime();
114  }
Principal const & principal_
Definition: DataViewImpl.h:318
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
Timestamp const & endTime() const
Definition: Principal.cc:1229
EventID art::DataViewImpl::eventID ( ) const

Definition at line 75 of file DataViewImpl.cc.

References art::Principal::eventID(), mutex_, and principal_.

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

76  {
77  std::lock_guard lock{mutex_};
78  return principal_.eventID();
79  }
EventID const & eventID() const
Definition: Principal.cc:1187
Principal const & principal_
Definition: DataViewImpl.h:318
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
EventAuxiliary::ExperimentType art::DataViewImpl::experimentType ( ) const

Definition at line 131 of file DataViewImpl.cc.

References art::Principal::ExperimentType(), mutex_, and principal_.

Referenced by rndm::NuRandomServiceHelper::ArtState::set_event().

132  {
133  std::lock_guard lock{mutex_};
134  return principal_.ExperimentType();
135  }
Principal const & principal_
Definition: DataViewImpl.h:318
EventAuxiliary::ExperimentType ExperimentType() const
Definition: Principal.cc:1019
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
template<typename PROD >
bool art::DataViewImpl::get ( SelectorBase const &  sel,
Handle< PROD > &  result 
) const

Definition at line 377 of file DataViewImpl.h.

References art::Handle< T >::clear().

Referenced by art::detail::ProcessAndEventSelector::loadTriggerResults(), DUNE::NeutrinoTrackingEff::processEff(), and DUNE::MuonTrackingEff::processEff().

378  {
379  std::lock_guard lock{mutex_};
380  result.clear();
381  // We do *not* track whether consumes was called for a SelectorBase.
382  ProcessTag const processTag{"", md_.processName()};
383  auto qr = principal_.getBySelector(
384  mc_, WrappedTypeID::make<PROD>(), sel, processTag);
385  result = Handle<PROD>{qr};
386  bool const ok = qr.succeeded() && !qr.failed();
387  if (recordParents_ && ok) {
388  recordAsParent_(qr.result());
389  }
390  return ok;
391  }
Principal const & principal_
Definition: DataViewImpl.h:318
std::string const & processName() const
GroupQueryResult getBySelector(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:675
ModuleDescription const & md_
Definition: DataViewImpl.h:324
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
ModuleContext const & mc_
Definition: DataViewImpl.h:321
bool const recordParents_
Definition: DataViewImpl.h:331
template<typename PROD >
bool art::DataViewImpl::get ( ProductID const  pid,
Handle< PROD > &  result 
) const

Definition at line 395 of file DataViewImpl.h.

References art::Handle< T >::clear().

396  {
397  std::lock_guard lock{mutex_};
398  result.clear();
399  auto qr = principal_.getByProductID(pid);
400  result = Handle<PROD>{qr};
401  bool const ok = qr.succeeded() && !qr.failed();
402  if (recordParents_ && ok) {
403  recordAsParent_(qr.result());
404  }
405  return ok;
406  }
Principal const & principal_
Definition: DataViewImpl.h:318
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
GroupQueryResult getByProductID(ProductID const pid) const
Definition: Principal.cc:1286
bool const recordParents_
Definition: DataViewImpl.h:331
template<typename PROD >
bool art::DataViewImpl::getByLabel ( std::string const &  label,
std::string const &  instance,
Handle< PROD > &  result 
) const

Definition at line 437 of file DataViewImpl.h.

References instance.

Referenced by lar::util::details::FindAllP< Source, Dest >::Add(), reco3d::PlotSpacePoints::analyze(), hit::MCHitAnaExample::analyze(), cheat::CheckBackTracking::analyze(), opdet::OpDigiAna::analyze(), calo::PrintCalorimetry::analyze(), MCBTDemo::analyze(), opdet::OpFlashSimpleAna::analyze(), opdet::OpFlashMCTruthAna::analyze(), opdet::FIFOHistogramAna::analyze(), pid::PIDAAnalyzer::analyze(), shower::TCShowerAnalysis::analyze(), opdet::OpHitAna::analyze(), detsim::SimWireAna::analyze(), trk::TrackContainmentAnalyzer::analyze(), opdet::OpFlashAna::analyze(), vertex::AggregateVertexAna::analyze(), detsim::WienerFilterAna::analyze(), larg::LArSimChannelAna::analyze(), shower::TCShowerElectronLikelihood::analyze(), shower::TCShowerTemplateMaker::analyze(), opdet::FlashHypothesisAna::analyze(), hit::MagDriftAna::analyze(), cluster::HoughLineFinderAna::analyze(), cluster::ClusterPCA::analyze(), microboone::CosmicRemovalAna::analyze(), caldata::CalWireAna::analyze(), opreco::OpticalRecoAna::analyze(), hit::HitAnaModule::analyze(), cheat::RecoCheckAna::analyze(), opdet::LEDCalibrationAna::analyze(), lar_pandora::ConsolidatedPFParticleAnalysisTemplate::analyze(), cluster::ClusterAna::analyze(), pfpf::PFPAna::analyze(), cluster::DBclusterAna::analyze(), hit::HitFinderAna::analyze(), hit::GausHitFinderAna::analyze(), rwgt::ReweightAna::analyze(), trkf::SpacePointAna::analyze(), vertex::FeatureVertexFinderAna::analyze(), NuShowerEff::analyze(), opdet::SimPhotonCounter::analyze(), ems::MultiEMShowers::analyze(), lar::example::AnalysisExample::analyze(), trkf::SeedAna::analyze(), trkf::TrackAna::analyze(), ClusteringValidation::ClusteringValidation::analyze(), trkf::TrackAna::anaStitch(), lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps(), ShowerRecoTools::ShowerExampleTool::CalculateElement(), ShowerRecoTools::Shower3DTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerStartPositionCheater::CalculateElement(), ShowerRecoTools::Shower2DLinearRegressionTrackHitFinder::CalculateElement(), ShowerRecoTools::ShowerLinearEnergy::CalculateElement(), ShowerRecoTools::ShowerDirectionCheater::CalculateElement(), ShowerRecoTools::ShowerTrackFinderCheater::CalculateElement(), ShowerRecoTools::ShowerStartPosition::CalculateElement(), ShowerRecoTools::ShowerPCADirection::CalculateElement(), ShowerRecoTools::ShowerSlidingStandardCalodEdx::CalculateElement(), evd::AnalysisBaseDrawer::CalorShower(), evd::HitSelector::ChangeHit(), shower::TRACSCheatingAlg::CheatDebugEVD(), 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(), 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(), shower::TRACSAlg::DebugEVD(), evdb_tool::DrawSimPhoton3D::Draw(), evdb_tool::DrawSimEnergyDeposit3D::Draw(), evdb_tool::DrawLArVoxel3D::Draw(), evd::AnalysisBaseDrawer::DrawDeDx(), evd::AnalysisBaseDrawer::DrawKineticEnergy(), evd::RecoBaseDrawer::DrawTrackVertexAssns2D(), cluster::TrajCluster::FillMCPList(), filt::LArG4ParticleFilter::filter(), filt::FinalStateParticleFilter::filter(), simfilter::FilterNoDirtNeutrinos::filter(), filter::MuonFilter::filter(), cluster::SmallClusterFilter::filter(), trkf::StitchAlg::FindHeadsAndTails(), anab::FVectorReader< T, N >::FVectorReader(), trkf::Track3DKalmanHit::getAllHits(), lar_pandora::LArPandoraHelper::GetAssociatedHits(), 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(), trkf::SeedFinderModule::GetHitsFromEvent(), evd::RecoBaseDrawer::GetOpFlashes(), evd::RecoBaseDrawer::GetPFParticles(), trkf::Track3DKalmanHit::getPFParticleStuff(), evd::RecoBaseDrawer::GetSeeds(), shower::TCShower::getShowersWithoutSlices(), shower::TCShower::getShowersWithSlices(), sim::SimListUtils::GetSimPhotonsCollection(), evd::RecoBaseDrawer::GetSlices(), trkf::SeedFinderModule::GetSortedHitsFromClusters(), evd::RecoBaseDrawer::GetSpacePoints(), evd::RecoBaseDrawer::GetVertices(), evwgh::GenieWeightCalc::GetWeight(), evd::RecoBaseDrawer::GetWires(), lar_cluster3d::SpacePointHit3DBuilder::Hit3DBuilder(), lar_pandora::LArPandoraEventDump::PandoraData::LoadCollection(), evgb::MCTruthAndFriendsItr::MCTruthAndFriendsItr(), mvapid::MVAAlg::PrepareEvent(), wc::CellTree::processCalib(), DUNE::NeutrinoShowerEff::processEff(), DUNE::MuonTrackingEff::processEff(), DUNE::NeutrinoTrackingEff::processEff(), wc::CellTree::processMC(), wc::CellTree::processOpFlash(), wc::CellTree::processOpHit(), wc::CellTree::processRaw(), wc::CellTree::processSpacePointTruthDepo(), wc::CellTree::processTrigger(), trkf::FeatureTracker::produce(), MCReco::produce(), pid::Chi2ParticleID::produce(), opdet::OpticalRawDigitReformatter::produce(), hit::MCHitFinder::produce(), cosmic::TrackPFParticleMatch::produce(), vertex::VertexCheater::produce(), hit::DisambigCheater::produce(), shwf::ShowerCheater::produce(), cosmic::CosmicClusterTagger::produce(), event::EventCheater::produce(), trk::TrackContainmentTagger::produce(), hit::TTHitFinder::produce(), cosmic::CosmicTrackTagger::produce(), sppt::TTSpacePointFinder::produce(), trkf::SpacePointCheater::produce(), trkf::SpacePointFinder::produce(), cluster::ClusterCheater::produce(), apa::APAHitFinder::produce(), hit::RawHitFinder::produce(), noisefilteralg::WireCellNoiseFilter::produce(), opdet::OpFlashFinder::produce(), hit::RFFHitFinder::produce(), trkf::TrackCheater::produce(), cluster::DBcluster::produce(), hit::FFTHitFinder::produce(), cosmic::CosmicPFParticleTagger::produce(), trkf::TrackStitcher::produce(), spacecharge::ShiftEdepSCE::produce(), cosmic::BeamFlashTrackMatchTagger::produce(), cluster::LineMerger::produce(), cluster::EndPointModule::produce(), shwf::ShowerFinder::produce(), caldata::CalWire::produce(), vertex::PrimaryVertexFinder::produce(), calo::TrackCalorimetry::produce(), caldata::CalWireT962::produce(), ShowerReco3D::produce(), shower::TCShower::produce(), cluster::BlurredClustering::produce(), CRHitRemoval::produce(), cosmic::CosmicPCAxisTagger::produce(), t0::MCParticleTrackMatching::produce(), t0::MCParticleShowerMatching::produce(), reco::shower::TRACS::produce(), trkf::TrackKalmanCheater::produce(), trkf::Track3Dreco::produce(), opdet::OpHitFinder::produce(), cluster::TrajCluster::produce(), reco3d::SpacePointSolver::produce(), trkf::SpacePts::produce(), trkf::CCTrackMaker::produce(), ems::EMShower3D::produce(), trkf::MCSFitProducer::produce(), hit::GausHitFinder::produce(), calo::Calorimetry::produce(), shwf::ShowerReco::produce(), shower::EMShower::produce(), trkf::Track3DKalman::produce(), cluster::SmallClusterFinder::produce(), vertex::VertexFinder2D::produce(), hit::DPRawHitFinder::produce(), lbne::PhotonCounterT0Matching::produce(), CRHitRemovalByPCA::produce(), detsim::DriftElectronstoPlane::produce(), t0::MCTruthT0Matching::produce(), trkf::PMAlgTrajFitter::produce(), vertex::FeatureVertexFinder::produce(), trkf::Track3DKalmanSPS::produce(), detsim::SimDriftElectrons::produce(), trkf::KalmanFilterTrajectoryFitter::produce(), trkf::CosmicTracker::produce(), larg4::LArG4::produce(), 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().

440  {
441  return getByLabel<PROD>(moduleLabel, instance, {}, result);
442  }
const std::string instance
template<typename PROD >
bool art::DataViewImpl::getByLabel ( std::string const &  label,
std::string const &  instance,
std::string const &  process,
Handle< PROD > &  result 
) const

Definition at line 410 of file DataViewImpl.h.

References art::Handle< T >::clear(), art::GroupQueryResult::failed(), art::ConsumesInfo::instance(), art::ProductInfo::Product, art::GroupQueryResult::result(), art::GroupQueryResult::succeeded(), and art::ConsumesInfo::validateConsumedProduct().

414  {
415  std::lock_guard lock{mutex_};
416  result.clear();
417  auto const wrapped = WrappedTypeID::make<PROD>();
418  ProcessTag const processTag{processName, md_.processName()};
419  ProductInfo const pinfo{ProductInfo::ConsumableType::Product,
420  wrapped.product_type,
421  moduleLabel,
422  productInstanceName,
423  processTag};
425  GroupQueryResult qr = principal_.getByLabel(
426  mc_, wrapped, moduleLabel, productInstanceName, processTag);
427  result = Handle<PROD>{qr};
428  bool const ok = qr.succeeded() && !qr.failed();
429  if (recordParents_ && ok) {
430  recordAsParent_(qr.result());
431  }
432  return ok;
433  }
Principal const & principal_
Definition: DataViewImpl.h:318
static ConsumesInfo * instance()
Definition: Consumer.cc:24
BranchType const branchType_
Definition: DataViewImpl.h:315
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:324
void validateConsumedProduct(BranchType const, ModuleDescription const &, ProductInfo const &productInfo)
Definition: Consumer.cc:108
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
GroupQueryResult getByLabel(ModuleContext const &mc, WrappedTypeID const &wrapped, std::string const &label, std::string const &productInstanceName, ProcessTag const &processTag) const
Definition: Principal.cc:699
ModuleContext const & mc_
Definition: DataViewImpl.h:321
bool const recordParents_
Definition: DataViewImpl.h:331
template<typename PROD >
PROD const & art::DataViewImpl::getByLabel ( InputTag const &  tag) const

Definition at line 464 of file DataViewImpl.h.

465  {
466  Handle<PROD> h;
467  getByLabel(tag, h);
468  return *h;
469  }
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:437
template<typename PROD >
bool art::DataViewImpl::getByLabel ( InputTag const &  tag,
Handle< PROD > &  result 
) const

Definition at line 446 of file DataViewImpl.h.

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

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

Definition at line 453 of file DataViewImpl.h.

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

455  {
456  return getByLabel<PROD>(token.inputTag_.label(),
457  token.inputTag_.instance(),
458  token.inputTag_.process(),
459  result);
460  }
exempt_ptr< Group const > art::DataViewImpl::getContainerForView_ ( TypeID const &  typeID,
std::string const &  moduleLabel,
std::string const &  productInstanceName,
ProcessTag const &  processTag 
) const
private

Definition at line 327 of file DataViewImpl.cc.

References branchType_, e, art::Principal::getMatchingSequence(), art::ConsumesInfo::instance(), mc_, md_, art::ProcessTag::name(), principal_, art::errors::ProductNotFound, art::TypeID::typeInfo(), art::detail::upcastAllowed(), art::ConsumesInfo::validateConsumedProduct(), and art::ProductInfo::ViewElement.

331  {
332  // Check that the consumesView<ELEMENT, BT>(InputTag),
333  // or the mayConsumeView<ELEMENT, BT>(InputTag)
334  // is actually present.
336  branchType_,
337  md_,
339  typeID,
340  moduleLabel,
341  productInstanceName,
342  processTag});
343  // Fetch the specified data products, which must be containers.
344  auto qrs = principal_.getMatchingSequence(
345  mc_,
346  Selector{ModuleLabelSelector{moduleLabel} &&
347  ProductInstanceNameSelector{productInstanceName} &&
348  ProcessNameSelector{processTag.name()}},
349  processTag);
350  // Remove any containers that do not allow upcasting of their
351  // elements to the desired element type.
352  qrs.erase(remove_if(qrs.begin(),
353  qrs.end(),
354  [&typeID](auto const& qr) {
355  assert(
356  qr.result()->productDescription().supportsView());
357  return !detail::upcastAllowed(
358  *qr.result()->uniqueProduct()->typeInfo(),
359  typeID.typeInfo());
360  }),
361  qrs.end());
362  // Throw if there is not one and only one container to return.
363  if (qrs.size() != 1) {
365  e << "getView: Found "
366  << (qrs.size() == 0 ? "no products" : "more than one product")
367  << " matching all criteria\n"
368  << "Looking for sequence of type: " << typeID << "\n"
369  << "Looking for module label: " << moduleLabel << "\n"
370  << "Looking for productInstanceName: " << productInstanceName << "\n";
371  if (!processTag.name().empty()) {
372  e << "Looking for processName: " << processTag.name() << "\n";
373  }
374  throw e;
375  }
376  // And return the single result.
377  return qrs[0].result();
378  }
Principal const & principal_
Definition: DataViewImpl.h:318
static ConsumesInfo * instance()
Definition: Consumer.cc:24
BranchType const branchType_
Definition: DataViewImpl.h:315
ModuleDescription const & md_
Definition: DataViewImpl.h:324
void validateConsumedProduct(BranchType const, ModuleDescription const &, ProductInfo const &productInfo)
Definition: Consumer.cc:108
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
GroupQueryResultVec getMatchingSequence(ModuleContext const &, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:749
bool upcastAllowed(std::type_info const &tiFrom, std::type_info const &tiTo)
ModuleContext const & mc_
Definition: DataViewImpl.h:321
Float_t e
Definition: plot.C:34
template<typename PROD >
void art::DataViewImpl::getMany ( SelectorBase const &  sel,
std::vector< Handle< PROD >> &  results 
) const

Definition at line 498 of file DataViewImpl.h.

References art::ConsumesInfo::instance(), art::ProductInfo::Many, and art::ConsumesInfo::validateConsumedProduct().

500  {
501  std::lock_guard lock{mutex_};
502  auto const wrapped = WrappedTypeID::make<PROD>();
504  branchType_,
505  md_,
506  ProductInfo{ProductInfo::ConsumableType::Many, wrapped.product_type});
507  ProcessTag const processTag{"", md_.processName()};
508  std::vector<Handle<PROD>> products;
509  for (auto const& qr : principal_.getMany(mc_, wrapped, sel, processTag)) {
510  products.emplace_back(qr);
511  if (recordParents_) {
512  recordAsParent_(qr.result());
513  }
514  }
515  results.swap(products);
516  }
Principal const & principal_
Definition: DataViewImpl.h:318
static ConsumesInfo * instance()
Definition: Consumer.cc:24
BranchType const branchType_
Definition: DataViewImpl.h:315
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:324
GroupQueryResultVec getMany(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:740
void validateConsumedProduct(BranchType const, ModuleDescription const &, ProductInfo const &productInfo)
Definition: Consumer.cc:108
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
ModuleContext const & mc_
Definition: DataViewImpl.h:321
bool const recordParents_
Definition: DataViewImpl.h:331
template<typename PROD >
PROD const * art::DataViewImpl::getPointerByLabel ( InputTag const &  tag) const

Definition at line 473 of file DataViewImpl.h.

References art::Handle< T >::product().

474  {
475  Handle<PROD> h;
476  getByLabel(tag, h);
477  return h.product();
478  }
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:437
string const & art::DataViewImpl::getProcessName_ ( std::string const &  specifiedProcessName) const
private

Definition at line 272 of file DataViewImpl.cc.

References md_, art::ModuleDescription::processName(), and s.

273  {
274  return specifiedProcessName == "current_process"s ? md_.processName() :
275  specifiedProcessName;
276  }
Float_t s
Definition: plot.C:23
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:324
bool art::DataViewImpl::getProcessParameterSet ( std::string const &  process,
fhicl::ParameterSet ps 
) const

Definition at line 166 of file DataViewImpl.cc.

References branchType_, art::thread_safe_registry_via_id< K, M >::get(), fhicl::ParameterSetRegistry::get(), art::ProcessHistory::getConfigurationForProcess(), art::Principal::history(), art::InEvent, mutex_, art::errors::NotFound, art::ProcessConfiguration::parameterSetID(), principal_, and art::History::processHistoryID().

168  {
169  std::lock_guard lock{mutex_};
170  if (branchType_ != InEvent) {
171  return false;
172  }
173  ProcessHistory ph;
175  ph)) {
177  << "ProcessHistoryID " << principal_.history().processHistoryID()
178  << " is not found in the ProcessHistoryRegistry.\n"
179  << "This file is malformed.\n";
180  }
181  ProcessConfiguration config;
182  bool const process_found =
183  ph.getConfigurationForProcess(processName, config);
184  if (process_found) {
185  fhicl::ParameterSetRegistry::get(config.parameterSetID(), ps);
186  }
187  return process_found;
188  }
Principal const & principal_
Definition: DataViewImpl.h:318
static collection_type const & get() noexcept
History const & history() const
Definition: Principal.cc:1025
BranchType const branchType_
Definition: DataViewImpl.h:315
static collection_type const & get()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
ProcessHistoryID const & processHistoryID() const noexcept
Definition: History.cc:31
cet::exempt_ptr< BranchDescription const > art::DataViewImpl::getProductDescription ( ProductID  pid) const

Definition at line 191 of file DataViewImpl.cc.

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

192  {
194  }
Principal const & principal_
Definition: DataViewImpl.h:318
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
Definition: Principal.cc:1117
BranchDescription const & art::DataViewImpl::getProductDescription_ ( TypeID const &  type,
std::string const &  instance,
bool const  alwaysEnableLookupOfProducedProducts = false 
) const
private

Definition at line 279 of file DataViewImpl.cc.

References branchType_, art::canonicalProductName(), art::TypeID::className(), art::TypeID::friendlyClassName(), art::Principal::getProductDescription(), instance, md_, art::ModuleDescription::moduleLabel(), mutex_, principal_, art::ModuleDescription::processName(), and art::errors::ProductRegistrationFailure.

283  {
284  std::lock_guard lock{mutex_};
285  auto const& product_name = canonicalProductName(
286  type.friendlyClassName(), md_.moduleLabel(), instance, md_.processName());
287  ProductID const pid{product_name};
289  pid, alwaysEnableLookupOfProducedProducts);
290  if (!bd || (bd->producedClassName() != type.className())) {
291  // Either we did not find the product, or the product we
292  // did find does not match (which can happen with Assns
293  // since Assns(A,B) and Assns(B,A) have the same ProductID
294  // but not the same class name.
296  "DataViewImpl::getProductDescription_: error while "
297  "trying to retrieve product description:\n")
298  << "No product is registered for\n"
299  << " process name: '" << md_.processName() << "'\n"
300  << " module label: '" << md_.moduleLabel() << "'\n"
301  << " product class name: '" << type.className() << "'\n"
302  << " product friendly class name: '" << type.friendlyClassName()
303  << "'\n"
304  << " product instance name: '" << instance << "'\n"
305  << " branch type: '" << branchType_ << "'\n";
306  }
307  // The description object is owned by either the source or the
308  // event processor, whose lifetimes exceed that of the
309  // DataViewImpl object. It is therefore safe to dereference.
310  return *bd;
311  }
Principal const & principal_
Definition: DataViewImpl.h:318
std::string const & moduleLabel() const
const std::string instance
BranchType const branchType_
Definition: DataViewImpl.h:315
std::string const & processName() const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
Definition: Principal.cc:1117
ModuleDescription const & md_
Definition: DataViewImpl.h:324
std::string canonicalProductName(std::string const &friendlyClassName, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
template<typename PROD >
ProductID art::DataViewImpl::getProductID ( std::string const &  instance_name = "") const

Definition at line 349 of file DataViewImpl.h.

References art::canonicalProductName(), instance, and art::errors::ProductRegistrationFailure.

Referenced by util::CreateAssn(), evgb::util::CreateAssn(), util::CreateAssnD(), trkf::Track3DKalmanHit::createOutputs(), trkf::SpacePointCheater::produce(), trkf::SpacePointFinder::produce(), trkf::TrackKalmanCheater::produce(), shwf::ShowerReco::produce(), evd::GraphCluster::produce(), trkf::PMAlgTrajFitter::produce(), trkf::KalmanFilterTrajectoryFitter::produce(), and trkf::KalmanFilterFinalTrackFitter::produce().

350  {
351  std::lock_guard lock{mutex_};
352  TypeID const type{typeid(PROD)};
353  auto const& product_name = canonicalProductName(
354  type.friendlyClassName(), md_.moduleLabel(), instance, md_.processName());
355  ProductID const pid{product_name};
356  auto desc = principal_.getProductDescription(pid);
357  if (!desc) {
359  "DataViewImpl::getProductID: error while trying to "
360  "retrieve product description:\n")
361  << "No product is registered for\n"
362  << " process name: '" << md_.processName() << "'\n"
363  << " module label: '" << md_.moduleLabel() << "'\n"
364  << " product friendly class name: '" << type.friendlyClassName()
365  << "'\n"
366  << " product instance name: '" << instance << "'\n"
367  << " branch type: '" << branchType_ << "'\n";
368  }
369  // The description object is owned by either the source or the
370  // event processor, whose lifetimes exceed that of the
371  // DataViewImpl object. It is therefore safe to dereference.
372  return desc->productID();
373  }
Principal const & principal_
Definition: DataViewImpl.h:318
std::string const & moduleLabel() const
const std::string instance
BranchType const branchType_
Definition: DataViewImpl.h:315
std::string const & processName() const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
Definition: Principal.cc:1117
ModuleDescription const & md_
Definition: DataViewImpl.h:324
std::string canonicalProductName(std::string const &friendlyClassName, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
template<typename ELEMENT >
void art::DataViewImpl::getPtrVector ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
std::string const &  processName,
PtrVector< ELEMENT > &  result 
) const

Definition at line 633 of file DataViewImpl.h.

References art::PtrVector< T >::emplace_back().

637  {
638  std::lock_guard lock{mutex_};
639  auto grp = getContainerForView_(TypeID{typeid(ELEMENT)},
640  moduleLabel,
641  productInstanceName,
642  ProcessTag{processName, md_.processName()});
643  if (recordParents_) {
644  recordAsParent_(grp);
645  }
646  std::vector<void const*> view;
647  grp->uniqueProduct()->fillView(view);
648  std::size_t i{0};
649  for (auto p : view) {
650  result.emplace_back(
651  grp->productID(), static_cast<ELEMENT const*>(p), i++);
652  }
653  }
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:324
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
cet::exempt_ptr< Group const > getContainerForView_(TypeID const &, std::string const &moduleLabel, std::string const &productInstanceName, ProcessTag const &processTag) const
bool const recordParents_
Definition: DataViewImpl.h:331
template<typename ELEMENT >
void art::DataViewImpl::getPtrVector ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
PtrVector< ELEMENT > &  result 
) const

Definition at line 657 of file DataViewImpl.h.

660  {
661  getPtrVector(moduleLabel, productInstanceName, {}, result);
662  }
void getPtrVector(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, PtrVector< ELEMENT > &result) const
Definition: DataViewImpl.h:633
template<typename ELEMENT >
void art::DataViewImpl::getPtrVector ( InputTag const &  tag,
PtrVector< ELEMENT > &  result 
) const

Definition at line 666 of file DataViewImpl.h.

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

668  {
669  getPtrVector(tag.label(), tag.instance(), tag.process(), result);
670  }
void getPtrVector(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, PtrVector< ELEMENT > &result) const
Definition: DataViewImpl.h:633
template<typename ELEMENT >
void art::DataViewImpl::getPtrVector ( ViewToken< ELEMENT > const &  token,
PtrVector< ELEMENT > &  result 
) const

Definition at line 674 of file DataViewImpl.h.

References art::ViewToken< Element >::inputTag_.

676  {
677  getPtrVector(token.inputTag_.label(),
678  token.inputTag_.instance(),
679  token.inputTag_.process(),
680  result);
681  }
void getPtrVector(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, PtrVector< ELEMENT > &result) const
Definition: DataViewImpl.h:633
template<typename PROD >
ValidHandle< PROD > art::DataViewImpl::getValidHandle ( InputTag const &  tag) const

Definition at line 482 of file DataViewImpl.h.

References art::Handle< T >::product(), and art::Handle< T >::provenance().

Referenced by detsim::SimDriftedElectronClusterAna::analyze(), larg4::ISCalculationAna::analyze(), recob::DumpVertices::analyze(), recob::DumpSpacePoints::analyze(), sim::DumpMCTruth::analyze(), recob::DumpPCAxes::analyze(), sim::DumpGTruth::analyze(), recob::DumpSeeds::analyze(), recob::DumpClusters::analyze(), hit::DumpHits::analyze(), detsim::DumpRawDigits::analyze(), caldata::DumpWires::analyze(), recob::DumpPFParticles::analyze(), recob::DumpTracks::analyze(), t0::IndirectHitParticleAssns::CreateHitParticleAssociations(), t0::DirectHitParticleAssns::CreateHitParticleAssociations(), simfilter::FilterNoMCParticles::filter(), simfilter::FilterSimPhotonTime::filter(), anab::FVectorReader< T, N >::FVectorReader(), trkmkr::KalmanFilterFitTrackMaker::initEvent(), lar_cluster3d::StandardHit3DBuilder::makeRawDigitAssns(), lar_cluster3d::StandardHit3DBuilder::makeWireAssns(), hit::HitFinder::produce(), trkf::TCTrack::produce(), cluster::LineCluster::produce(), cluster::ClusterCrawler::produce(), hit::HitCheater::produce(), evwgh::EventWeight::produce(), opdet::OpMCDigi::produce(), cluster::DBCluster3D::produce(), cluster::HoughLineFinder::produce(), TrackProducerFromTrack::produce(), TrackProducerFromTrackTrajectory::produce(), cluster::TrajCluster::produce(), calo::ShowerCalorimetry::produce(), TrackProducerFromPFParticle::produce(), trkf::VertexFitter::produce(), t0::MCTruthT0Matching::produce(), trkf::KalmanFilterTrajectoryFitter::produce(), trkf::PMAlgTrackMaker::produce(), phot::PhotonLibraryPropagation::produce(), and trkf::KalmanFilterFinalTrackFitter::produce().

483  {
484  Handle<PROD> h;
485  getByLabel(tag, h);
486  return ValidHandle{h.product(), *h.provenance()};
487  }
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:437
template<typename PROD >
ValidHandle< PROD > art::DataViewImpl::getValidHandle ( ProductToken< PROD > const &  token) const

Definition at line 491 of file DataViewImpl.h.

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

492  {
493  return getValidHandle<PROD>(token.inputTag_);
494  }
template<typename ELEMENT >
std::size_t art::DataViewImpl::getView ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
std::string const &  processName,
std::vector< ELEMENT const * > &  result 
) const

Definition at line 527 of file DataViewImpl.h.

Referenced by larg4::LArG4Ana::analyze(), pmtana::PMTAna::analyze(), opdet::SimPhotonCounter::analyze(), evd::RecoBaseDrawer::CountHits(), cluster::ClusterMatchAlg::FillMCInfo(), filter::ADCFilter::filter(), evd::RecoBaseDrawer::GetHits(), sim::SimListUtils::GetLArVoxelList(), evd::SimulationDrawer::GetParticle(), evd::RecoBaseDrawer::GetShowers(), evd::RecoBaseDrawer::GetTracks(), opdet::OpticalRawDigitReformatter::produce(), event::EventCheater::produce(), hit::HitCheater::produce(), opdet::OpHitFinder::produce(), and detsim::SimWire::produce().

531  {
532  std::lock_guard lock{mutex_};
533  std::size_t const orig_size = result.size();
534  auto grp = getContainerForView_(TypeID{typeid(ELEMENT)},
535  moduleLabel,
536  productInstanceName,
537  ProcessTag{processName, md_.processName()});
538  if (recordParents_) {
539  recordAsParent_(grp);
540  }
541  std::vector<void const*> view;
542  grp->uniqueProduct()->fillView(view);
543  std::vector<ELEMENT const*> castedView;
544  for (auto p : view) {
545  castedView.push_back(static_cast<ELEMENT const*>(p));
546  }
547  result = std::move(castedView);
548  return result.size() - orig_size;
549  }
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:324
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
cet::exempt_ptr< Group const > getContainerForView_(TypeID const &, std::string const &moduleLabel, std::string const &productInstanceName, ProcessTag const &processTag) const
bool const recordParents_
Definition: DataViewImpl.h:331
template<typename ELEMENT >
std::size_t art::DataViewImpl::getView ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
std::vector< ELEMENT const * > &  result 
) const

Definition at line 553 of file DataViewImpl.h.

556  {
557  return getView(moduleLabel, productInstanceName, {}, result);
558  }
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:527
template<typename ELEMENT >
std::size_t art::DataViewImpl::getView ( InputTag const &  tag,
std::vector< ELEMENT const * > &  result 
) const

Definition at line 562 of file DataViewImpl.h.

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

564  {
565  return getView(tag.label(), tag.instance(), tag.process(), result);
566  }
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:527
template<typename ELEMENT >
std::size_t art::DataViewImpl::getView ( ViewToken< ELEMENT > const &  token,
std::vector< ELEMENT const * > &  result 
) const

Definition at line 570 of file DataViewImpl.h.

References art::ViewToken< Element >::inputTag_.

572  {
573  return getView(token.inputTag_.label(),
574  token.inputTag_.instance(),
575  token.inputTag_.process(),
576  result);
577  }
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:527
template<typename ELEMENT >
bool art::DataViewImpl::getView ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
std::string const &  processName,
View< ELEMENT > &  result 
) const

Definition at line 581 of file DataViewImpl.h.

585  {
586  std::lock_guard lock{mutex_};
587  auto grp = getContainerForView_(TypeID{typeid(ELEMENT)},
588  moduleLabel,
589  productInstanceName,
590  ProcessTag{processName, md_.processName()});
591  if (recordParents_) {
592  recordAsParent_(grp);
593  }
594  std::vector<void const*> view;
595  grp->uniqueProduct()->fillView(view);
596  std::vector<ELEMENT const*> castedView;
597  for (auto p : view) {
598  castedView.push_back(static_cast<ELEMENT const*>(p));
599  }
600  result = View{castedView, grp->productID(), grp->uniqueProduct()};
601  return true;
602  }
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:324
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
cet::exempt_ptr< Group const > getContainerForView_(TypeID const &, std::string const &moduleLabel, std::string const &productInstanceName, ProcessTag const &processTag) const
bool const recordParents_
Definition: DataViewImpl.h:331
template<typename ELEMENT >
bool art::DataViewImpl::getView ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
View< ELEMENT > &  result 
) const

Definition at line 606 of file DataViewImpl.h.

609  {
610  return getView(moduleLabel, productInstanceName, {}, result);
611  }
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:527
template<typename ELEMENT >
bool art::DataViewImpl::getView ( InputTag const &  tag,
View< ELEMENT > &  result 
) const

Definition at line 615 of file DataViewImpl.h.

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

616  {
617  return getView(tag.label(), tag.instance(), tag.process(), result);
618  }
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:527
template<typename ELEMENT >
bool art::DataViewImpl::getView ( ViewToken< ELEMENT > const &  token,
View< ELEMENT > &  result 
) const

Definition at line 622 of file DataViewImpl.h.

References art::ViewToken< Element >::inputTag_.

624  {
625  return getView(token.inputTag_.label(),
626  token.inputTag_.instance(),
627  token.inputTag_.process(),
628  result);
629  }
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:527
History const & art::DataViewImpl::history ( ) const

Definition at line 138 of file DataViewImpl.cc.

References art::Principal::history(), mutex_, and principal_.

139  {
140  std::lock_guard lock{mutex_};
141  return principal_.history();
142  }
Principal const & principal_
Definition: DataViewImpl.h:318
History const & history() const
Definition: Principal.cc:1025
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
bool art::DataViewImpl::isRealData ( ) const

Definition at line 124 of file DataViewImpl.cc.

References art::Principal::isReal(), mutex_, and principal_.

Referenced by lar_pandora::PFParticleMonitoring::analyze(), larg::LArSimChannelAna::analyze(), hit::MagDriftAna::analyze(), opreco::OpticalRecoAna::analyze(), cheat::RecoCheckAna::analyze(), cluster::DBclusterAna::analyze(), hit::HitFinderAna::analyze(), DUNE::MuonTrackingEff::analyze(), DUNE::NeutrinoTrackingEff::analyze(), trkf::SpacePointAna::analyze(), trkf::SeedAna::analyze(), trkf::TrackAna::analyze(), trkf::TrackAna::anaStitch(), lar_pandora::LArPandoraHelper::CollectGeneratorMCParticles(), lar_pandora::LArPandoraHelper::CollectMCParticles(), lar_pandora::LArPandoraHelper::CollectSimChannels(), lar_pandora::LArPandora::CreatePandoraInput(), evdb_tool::DrawLArVoxel3D::GetMCTruth(), evd::SimulationDrawer::GetMCTruth(), evd::SimulationDrawer::GetParticle(), evd::SimulationDrawer::MCTruth3D(), evd::SimulationDrawer::MCTruthLongText(), evd::SimulationDrawer::MCTruthOrtho(), evd::SimulationDrawer::MCTruthShortText(), evd::SimulationDrawer::MCTruthVectors2D(), t0::MCParticleHitMatching::produce(), caldata::CalWire::produce(), caldata::CalWireT962::produce(), t0::MCParticleTrackMatching::produce(), t0::MCParticleShowerMatching::produce(), cluster::TrajCluster::produce(), trkf::Track3DKalman::produce(), t0::MCTruthT0Matching::produce(), trkf::Track3DKalmanSPS::produce(), cheat::PhotonBackTracker::Rebuild(), rndm::NuRandomServiceHelper::ArtState::set_event(), and nnet::TrainingDataAlg::setEventData().

125  {
126  std::lock_guard lock{mutex_};
127  return principal_.isReal();
128  }
Principal const & principal_
Definition: DataViewImpl.h:318
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
bool isReal() const
Definition: Principal.cc:1013
void art::DataViewImpl::movePutProductsToPrincipal ( Principal principal)

Definition at line 250 of file DataViewImpl.cc.

References branchType_, art::InRun, art::InSubRun, mutex_, art::productstatus::present(), art::Principal::put(), and putProducts_.

251  {
252  std::lock_guard lock{mutex_};
253  for (auto& type_label_and_pmvalue : putProducts_) {
254  auto& pmvalue = type_label_and_pmvalue.second;
255  unique_ptr<ProductProvenance const> pp =
256  make_unique<ProductProvenance const>(pmvalue.bd_.productID(),
258  if ((branchType_ == InRun) || (branchType_ == InSubRun)) {
259  principal.put(pmvalue.bd_,
260  move(pp),
261  move(pmvalue.prod_),
262  make_unique<RangeSet>(pmvalue.rs_));
263  } else {
264  principal.put(
265  pmvalue.bd_, move(pp), move(pmvalue.prod_), make_unique<RangeSet>());
266  }
267  };
268  putProducts_.clear();
269  }
BranchType const branchType_
Definition: DataViewImpl.h:315
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
std::map< TypeLabel, PMValue > putProducts_
Definition: DataViewImpl.h:344
constexpr ProductStatus present() noexcept
Definition: ProductStatus.h:10
void art::DataViewImpl::movePutProductsToPrincipal ( Principal principal,
bool const  checkProducts,
std::map< TypeLabel, BranchDescription > const *  expectedProducts 
)

Definition at line 197 of file DataViewImpl.cc.

References branchType_, art::InEvent, art::errors::LogicError, mutex_, art::productstatus::present(), art::Principal::put(), putProducts_, art::detail::range_sets_supported(), and retrievedProducts_.

201  {
202  std::lock_guard lock{mutex_};
203  if (checkProducts) {
204  vector<string> missing;
205  for (auto const& typeLabel_and_bd : *expectedProducts) {
206  if (putProducts_.find(typeLabel_and_bd.first) != putProducts_.cend()) {
207  continue;
208  }
209  ostringstream desc;
210  desc << typeLabel_and_bd.second;
211  missing.emplace_back(desc.str());
212  }
213  if (!missing.empty()) {
214  ostringstream errmsg;
215  HorizontalRule rule{25};
216  errmsg << "The following products have been declared with 'produces',\n"
217  << "but they have not been placed onto the event:\n"
218  << rule('=') << '\n';
219  for (auto const& desc : missing) {
220  errmsg << desc << rule('=') << '\n';
221  }
222  throw Exception{errors::LogicError, "DataViewImpl::checkPutProducts"}
223  << errmsg.str();
224  }
225  }
226  for (auto& type_label_and_pmvalue : putProducts_) {
227  auto& pmvalue = type_label_and_pmvalue.second;
228  unique_ptr<ProductProvenance const> pp;
229  if (branchType_ == InEvent) {
230  vector<ProductID> gotPIDs;
231  if (!retrievedProducts_.empty()) {
232  gotPIDs.reserve(retrievedProducts_.size());
233  gotPIDs.assign(retrievedProducts_.begin(), retrievedProducts_.end());
234  }
235  pp = make_unique<ProductProvenance const>(
236  pmvalue.bd_.productID(), productstatus::present(), gotPIDs);
237  } else {
238  pp = make_unique<ProductProvenance const>(pmvalue.bd_.productID(),
240  }
242  make_unique<RangeSet>(pmvalue.rs_) :
243  make_unique<RangeSet>();
244  principal.put(pmvalue.bd_, move(pp), move(pmvalue.prod_), move(rs));
245  };
246  putProducts_.clear();
247  }
BranchType const branchType_
Definition: DataViewImpl.h:315
std::set< ProductID > retrievedProducts_
Definition: DataViewImpl.h:340
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
std::map< TypeLabel, PMValue > putProducts_
Definition: DataViewImpl.h:344
constexpr bool range_sets_supported(BranchType const bt)
constexpr ProductStatus present() noexcept
Definition: ProductStatus.h:10
DataViewImpl& art::DataViewImpl::operator= ( DataViewImpl const &  )
delete
DataViewImpl& art::DataViewImpl::operator= ( DataViewImpl )
delete
ProcessHistory const & art::DataViewImpl::processHistory ( ) const

Definition at line 152 of file DataViewImpl.cc.

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

153  {
154  std::lock_guard lock{mutex_};
155  return principal_.processHistory();
156  }
Principal const & principal_
Definition: DataViewImpl.h:318
ProcessHistory const & processHistory() const
Definition: Principal.cc:421
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
ProcessHistoryID const & art::DataViewImpl::processHistoryID ( ) const

Definition at line 145 of file DataViewImpl.cc.

References art::Principal::history(), mutex_, principal_, and art::History::processHistoryID().

146  {
147  std::lock_guard lock{mutex_};
149  }
Principal const & principal_
Definition: DataViewImpl.h:318
History const & history() const
Definition: Principal.cc:1025
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
ProcessHistoryID const & processHistoryID() const noexcept
Definition: History.cc:31
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
FullSemantic< Level::Run > const  semantic 
)

Definition at line 692 of file DataViewImpl.h.

Referenced by evgen::SNNueAr40CCGen::beginRun(), evgen::CosmicsGen::beginRun(), evgen::FileMuons::beginRun(), evgen::NDKGen::beginRun(), evgen::NucleonDecay::beginRun(), evgen::GaisserParam::beginRun(), evgen::MarleyGen::beginRun(), evgen::NeutronOsc::beginRun(), evgen::TextFileGen::beginRun(), evgen::GENIEGen::beginRun(), evgen::RadioGen::beginRun(), evgen::LightSource::beginRun(), evgen::MUSUN::beginRun(), evgen::CORSIKAGen::beginRun(), evgen::MarleyTimeGen::beginRun(), evgen::GENIEGen::endSubRun(), simfilter::FilterGenInTime::filter(), lar_cluster3d::StandardHit3DBuilder::Hit3DBuilder(), art::MixOp< Prod, OProd >::mixAndPut(), reco::shower::ShowerUniqueProductPtr< std::vector< T > >::MoveToEvent(), reco::shower::ShowerUniqueAssnPtr< T >::MoveToEvent(), lar_cluster3d::Cluster3D::ArtOutputHandler::outputObjects(), trkf::SeedFinderModule::produce(), trkf::FeatureTracker::produce(), art::RandomNumberSaver::produce(), art::TriggerResultInserter::produce(), mvapid::MVAPID::produce(), MCReco::produce(), pid::Chi2ParticleID::produce(), opdet::OpticalRawDigitReformatter::produce(), hit::MCHitFinder::produce(), lar_pandora::LArPandoraTrackCreation::produce(), cosmic::TrackPFParticleMatch::produce(), vertex::VertexCheater::produce(), cosmic::CosmicClusterTagger::produce(), event::EventCheater::produce(), shwf::ShowerCheater::produce(), lar_pandora::LArPandoraShowerCreation::produce(), trk::TrackContainmentTagger::produce(), cosmic::CosmicTrackTagger::produce(), trkf::TCTrack::produce(), trkf::SpacePointCheater::produce(), trkf::SpacePointFinder::produce(), cluster::ClusterCheater::produce(), cluster::LineCluster::produce(), tss::TrackShowerHits::produce(), sppt::TTSpacePointFinder::produce(), noisefilteralg::WireCellNoiseFilter::produce(), cluster::ClusterCrawler::produce(), evgen::CosmicsGen::produce(), opdet::OptDetDigitizer::produce(), opdet::OpFlashFinder::produce(), trkf::TrackCheater::produce(), cluster::DBcluster::produce(), cosmic::CosmicPFParticleTagger::produce(), evwgh::EventWeight::produce(), trkf::TrackStitcher::produce(), spacecharge::ShiftEdepSCE::produce(), cosmic::BeamFlashTrackMatchTagger::produce(), cluster::LineMerger::produce(), opdet::OpMCDigi::produce(), cluster::DBCluster3D::produce(), cluster::EndPointModule::produce(), vertex::PrimaryVertexFinder::produce(), t0::MCParticleHitMatching::produce(), cluster::HoughLineFinder::produce(), evgen::FileMuons::produce(), caldata::CalWire::produce(), shwf::ShowerFinder::produce(), calo::TrackCalorimetry::produce(), caldata::CalWireT962::produce(), ShowerReco3D::produce(), TrackProducerFromTrack::produce(), shower::TCShower::produce(), TrackProducerFromTrackTrajectory::produce(), cluster::BlurredClustering::produce(), t0::MCParticleShowerMatching::produce(), cosmic::CosmicPCAxisTagger::produce(), evgen::NDKGen::produce(), t0::MCParticleTrackMatching::produce(), trkf::Track3Dreco::produce(), trkf::TrackKalmanCheater::produce(), detsim::SimWire::produce(), cluster::TrajCluster::produce(), opdet::OpHitFinder::produce(), trkf::SpacePts::produce(), reco3d::SpacePointSolver::produce(), calo::ShowerCalorimetry::produce(), evgen::NucleonDecay::produce(), trkf::CCTrackMaker::produce(), ems::EMShower3D::produce(), shwf::ShowerReco::produce(), calo::Calorimetry::produce(), trkf::MCSFitProducer::produce(), shower::EMShower::produce(), trkf::Track3DKalman::produce(), evgen::GaisserParam::produce(), cluster::SmallClusterFinder::produce(), vertex::VertexFinder2D::produce(), evgen::MarleyGen::produce(), CRHitRemovalByPCA::produce(), trkf::Track3DKalmanHit::produce(), lbne::PhotonCounterT0Matching::produce(), evgen::NeutronOsc::produce(), evgen::TextFileGen::produce(), evgen::GENIEGen::produce(), evd::GraphCluster::produce(), t0::MCTruthT0Matching::produce(), evgen::RadioGen::produce(), trkf::PMAlgTrajFitter::produce(), vertex::FeatureVertexFinder::produce(), trkf::Track3DKalmanSPS::produce(), evgen::LightSource::produce(), trkf::KalmanFilterTrajectoryFitter::produce(), trkf::PMAlgTrackMaker::produce(), phot::PhotonLibraryPropagation::produce(), trkf::KalmanFilterFinalTrackFitter::produce(), trkf::CosmicTracker::produce(), evgen::MUSUN::produce(), evgen::SingleGen::produce(), evgen::CORSIKAGen::produce(), evgen::MarleyTimeGen::produce(), larg4::LArG4::produce(), lar_pandora::LArPandoraOutput::ProduceArtOutput(), recob::ChargedSpacePointCollectionCreator::put(), anab::FVectorWriter< N >::saveOutputs(), lar_pandora::LArPandoraEvent::WriteAssociation(), and lar_pandora::LArPandoraEvent::WriteCollection().

694  {
695  return put(move(edp), "", semantic);
696  }
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
FragmentSemantic< Level::Run > const  semantic 
)

Definition at line 700 of file DataViewImpl.h.

702  {
703  return put(move(edp), "", semantic);
704  }
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
RangedFragmentSemantic< Level::Run semantic 
)

Definition at line 708 of file DataViewImpl.h.

710  {
711  return put(move(edp), "", std::move(semantic));
712  }
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
FullSemantic< Level::Run  
)

Definition at line 716 of file DataViewImpl.h.

References art::RangeSet::forRun().

719  {
720  return put(move(edp), instance, RangeSet::forRun(runID()));
721  }
const std::string instance
RunID runID() const
Definition: DataViewImpl.cc:61
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
static RangeSet forRun(RunID)
Definition: RangeSet.cc:52
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
FragmentSemantic< Level::Run  
)

Definition at line 725 of file DataViewImpl.h.

References art::errors::ProductPutFailure.

728  {
729  std::lock_guard lock{mutex_};
730  static_assert(
732  "\n\n"
733  "art error: A Run product put with the semantic 'RunFragment'\n"
734  " must be able to be aggregated. Please add the appropriate\n"
735  " void aggregate(T const&)\n"
736  " function to your class, or contact artists@fnal.gov.\n");
737  if (rangeSet_.collapse().is_full_run()) {
738  throw art::Exception{errors::ProductPutFailure, "Run::put"}
739  << "\nCannot put a product corresponding to a full Run using\n"
740  << "art::runFragment(). This can happen if you attempted to\n"
741  << "put a product at beginRun using art::runFragment().\n"
742  << "Please use either:\n"
743  << " art::fullRun(), or\n"
744  << " art::runFragment(art::RangeSet const&)\n"
745  << "or contact artists@fnal.gov for assistance.\n";
746  }
747  return put(move(edp), instance, rangeSet_);
748  }
const std::string instance
RangeSet & collapse()
Definition: RangeSet.cc:263
bool is_full_run() const
Definition: RangeSet.cc:124
std::string value(std::any const &)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
RangedFragmentSemantic< Level::Run semantic 
)

Definition at line 752 of file DataViewImpl.h.

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

755  {
756  std::lock_guard lock{mutex_};
757  static_assert(
759  "\n\n"
760  "art error: A Run product put with the semantic 'RunFragment'\n"
761  " must be able to be aggregated. Please add the appropriate\n"
762  " void aggregate(T const&)\n"
763  " function to your class, or contact artists@fnal.gov.\n");
764  if (semantic.rs.collapse().is_full_run()) {
765  throw art::Exception{errors::ProductPutFailure, "Run::put"}
766  << "\nCannot put a product corresponding to a full Run using\n"
767  << "art::runFragment(art::RangeSet&). Please use:\n"
768  << " art::fullRun()\n"
769  << "or contact artists@fnal.gov for assistance.\n";
770  }
771  return put(move(edp), instance, semantic.rs);
772  }
const std::string instance
std::string value(std::any const &)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
FullSemantic< Level::SubRun > const  semantic 
)

Definition at line 776 of file DataViewImpl.h.

778  {
779  return put(move(edp), "", semantic);
780  }
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
FragmentSemantic< Level::SubRun > const  semantic 
)

Definition at line 784 of file DataViewImpl.h.

786  {
787  return put(move(edp), "", semantic);
788  }
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
RangedFragmentSemantic< Level::SubRun semantic 
)

Definition at line 792 of file DataViewImpl.h.

794  {
795  return put(move(edp), "", std::move(semantic));
796  }
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
FullSemantic< Level::SubRun  
)

Definition at line 800 of file DataViewImpl.h.

References art::RangeSet::forSubRun().

803  {
804  return put(move(edp), instance, RangeSet::forSubRun(subRunID()));
805  }
SubRunID subRunID() const
Definition: DataViewImpl.cc:68
const std::string instance
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:58
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
FragmentSemantic< Level::SubRun  
)

Definition at line 809 of file DataViewImpl.h.

References art::errors::ProductPutFailure.

812  {
813  std::lock_guard lock{mutex_};
814  static_assert(
816  "\n\n"
817  "art error: A SubRun product put with the semantic 'SubRunFragment'\n"
818  " must be able to be aggregated. Please add the appropriate\n"
819  " void aggregate(T const&)\n"
820  " function to your class, or contact artists@fnal.gov.\n");
822  throw art::Exception(errors::ProductPutFailure, "SubRun::put")
823  << "\nCannot put a product corresponding to a full SubRun using\n"
824  << "art::subRunFragment(). This can happen if you attempted to\n"
825  << "put a product at beginSubRun using art::subRunFragment().\n"
826  << "Please use either:\n"
827  << " art::fullSubRun(), or\n"
828  << " art::subRunFragment(art::RangeSet const&)\n"
829  << "or contact artists@fnal.gov for assistance.\n";
830  }
831  return put(move(edp), instance, rangeSet_);
832  }
const std::string instance
RangeSet & collapse()
Definition: RangeSet.cc:263
std::string value(std::any const &)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
bool is_full_subRun() const
Definition: RangeSet.cc:131
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
RangedFragmentSemantic< Level::SubRun semantic 
)

Definition at line 836 of file DataViewImpl.h.

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

839  {
840  std::lock_guard lock{mutex_};
841  static_assert(
843  "\n\n"
844  "art error: A SubRun product put with the semantic 'SubRunFragment'\n"
845  " must be able to be aggregated. Please add the appropriate\n"
846  " void aggregate(T const&)\n"
847  " function to your class, or contact artists@fnal.gov.\n");
848  if (semantic.rs.collapse().is_full_subRun()) {
849  throw art::Exception{errors::ProductPutFailure, "Run::put"}
850  << "\nCannot put a product corresponding to a full SubRun using\n"
851  << "art::subRunFragment(art::RangeSet&). Please use:\n"
852  << " art::fullSubRun()\n"
853  << "or contact artists@fnal.gov for assistance.\n";
854  }
855  return put(move(edp), instance, semantic.rs);
856  }
const std::string instance
std::string value(std::any const &)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp)

Definition at line 685 of file DataViewImpl.h.

686  {
687  return put(move(edp), "");
688  }
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance 
)

Definition at line 860 of file DataViewImpl.h.

References art::ProductID::invalid(), art::RangeSet::invalid(), art::errors::NullPointerError, art::errors::ProductPutFailure, art::detail::range_sets_supported(), and art::detail::type_label_for().

861  {
862  std::lock_guard lock{mutex_};
863  TypeID const tid{typeid(PROD)};
864  if (edp.get() == nullptr) {
866  << "Event::put: A null unique_ptr was passed to 'put'.\n"
867  << "The pointer is of type " << tid << ".\n"
868  << "The specified productInstanceName was '" << instance << "'.\n";
869  }
870  auto const& bd = getProductDescription_(tid, instance, true);
871  assert(bd.productID() != ProductID::invalid());
872  auto const typeLabel =
874  auto wp = std::make_unique<Wrapper<PROD>>(move(edp));
875  auto const& rs = detail::range_sets_supported(branchType_) ?
876  rangeSet_.collapse() :
878  bool const result =
879  putProducts_.try_emplace(typeLabel, PMValue{std::move(wp), bd, rs})
880  .second;
881  if (!result) {
882  cet::HorizontalRule rule{30};
884  << "Event::put: Attempt to put multiple products with the\n"
885  << " following description onto the Event.\n"
886  << " Products must be unique per Event.\n"
887  << rule('=') << '\n'
888  << bd << rule('=') << '\n';
889  }
890  return bd.productID();
891  }
TypeLabel type_label_for(TypeID const typeID, std::string const &instance, bool const supportsView, ModuleDescription const &md)
const std::string instance
RangeSet & collapse()
Definition: RangeSet.cc:263
BranchType const branchType_
Definition: DataViewImpl.h:315
ModuleDescription const & md_
Definition: DataViewImpl.h:324
std::string value(std::any const &)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
std::map< TypeLabel, PMValue > putProducts_
Definition: DataViewImpl.h:344
BranchDescription const & getProductDescription_(TypeID const &type, std::string const &instance, bool const alwaysEnableLookupOfProducedProducts=false) const
static constexpr ProductID invalid() noexcept
Definition: ProductID.h:27
static RangeSet invalid()
Definition: RangeSet.cc:46
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:80
constexpr bool range_sets_supported(BranchType const bt)
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
RangeSet const &  rs 
)

Definition at line 895 of file DataViewImpl.h.

References art::ProductID::invalid(), art::RangeSet::is_valid(), art::errors::NullPointerError, art::errors::ProductPutFailure, and art::detail::type_label_for().

898  {
899  std::lock_guard lock{mutex_};
900  TypeID const tid{typeid(PROD)};
901  if (edp.get() == nullptr) {
903  << "Event::put: A null unique_ptr was passed to 'put'.\n"
904  << "The pointer is of type " << tid << ".\n"
905  << "The specified productInstanceName was '" << instance << "'.\n";
906  }
907  if (!rs.is_valid()) {
908  throw art::Exception{errors::ProductPutFailure, "SubRun::put"}
909  << "\nCannot put a product with an invalid RangeSet.\n"
910  << "Please contact artists@fnal.gov.\n";
911  }
912  auto const& bd = getProductDescription_(tid, instance, true);
913  assert(bd.productID() != ProductID::invalid());
914  auto const typeLabel =
916  auto wp = std::make_unique<Wrapper<PROD>>(move(edp));
917  auto result =
918  putProducts_.try_emplace(typeLabel, PMValue{move(wp), bd, rs}).second;
919  if (!result) {
920  constexpr cet::HorizontalRule rule{30};
922  << "Event::put: Attempt to put multiple products with the\n"
923  << " following description onto the Event.\n"
924  << " Products must be unique per Event.\n"
925  << rule('=') << '\n'
926  << bd << rule('=') << '\n';
927  }
928  return bd.productID();
929  }
TypeLabel type_label_for(TypeID const typeID, std::string const &instance, bool const supportsView, ModuleDescription const &md)
const std::string instance
ModuleDescription const & md_
Definition: DataViewImpl.h:324
std::string value(std::any const &)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
std::map< TypeLabel, PMValue > putProducts_
Definition: DataViewImpl.h:344
BranchDescription const & getProductDescription_(TypeID const &type, std::string const &instance, bool const alwaysEnableLookupOfProducedProducts=false) const
static constexpr ProductID invalid() noexcept
Definition: ProductID.h:27
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:80
void art::DataViewImpl::recordAsParent_ ( cet::exempt_ptr< Group const >  grp) const
private

Definition at line 314 of file DataViewImpl.cc.

References util::cbegin(), util::cend(), and retrievedProducts_.

315  {
316  if (grp->productDescription().transient()) {
317  // If the product retrieved is transient, don't use its
318  // ProductID; use the ProductID's of its parents.
319  auto const& parents = grp->productProvenance()->parentage().parents();
320  retrievedProducts_.insert(cbegin(parents), cend(parents));
321  } else {
322  retrievedProducts_.insert(grp->productDescription().productID());
323  }
324  }
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:82
std::set< ProductID > retrievedProducts_
Definition: DataViewImpl.h:340
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:77
template<typename PROD >
bool art::DataViewImpl::removeCachedProduct ( Handle< PROD > &  h) const

Definition at line 933 of file DataViewImpl.h.

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

Referenced by hit::MCHitFinder::produce().

934  {
935  std::lock_guard lock{mutex_};
936  bool result{false};
937  if (h.isValid() && !h.provenance()->produced()) {
939  h.clear();
940  result = true;
941  }
942  return result;
943  }
Principal const & principal_
Definition: DataViewImpl.h:318
void removeCachedProduct(ProductID) const
Definition: Principal.cc:475
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
RunNumber_t art::DataViewImpl::run ( ) const

Definition at line 82 of file DataViewImpl.cc.

References mutex_, principal_, and art::Principal::run().

Referenced by calo::PrintCalorimetry::analyze(), opdet::FIFOHistogramAna::analyze(), detsim::SimDriftedElectronClusterAna::analyze(), pid::PIDAAnalyzer::analyze(), lar_pandora::PFParticleTrackAna::analyze(), trk::TrackContainmentAnalyzer::analyze(), shower::TCShowerAnalysis::analyze(), lar_pandora::PFParticleCosmicAna::analyze(), lar_pandora::PFParticleAnalysis::analyze(), lar_pandora::PFParticleMonitoring::analyze(), lar_pandora::PFParticleHitDumper::analyze(), larg4::LArG4Ana::analyze(), opdet::FlashHypothesisAna::analyze(), larg4::ISCalculationAna::analyze(), microboone::CosmicRemovalAna::analyze(), hit::HitAnaModule::analyze(), cheat::RecoCheckAna::analyze(), opdet::LEDCalibrationAna::analyze(), cluster::DBclusterAna::analyze(), hit::HitFinderAna::analyze(), hit::GausHitFinderAna::analyze(), vertex::FeatureVertexFinderAna::analyze(), NuShowerEff::analyze(), opdet::SimPhotonCounter::analyze(), trkf::TrackAna::analyze(), shower::TRACSCheatingAlg::CheatDebugEVD(), t0::IndirectHitParticleAssns::CreateHitParticleAssociations(), shower::TRACSAlg::DebugEVD(), filter::EventFilter::filter(), evd::HeaderDrawer::Header(), lar_cluster3d::Cluster3D::PrepareEvent(), lar_pandora::LArPandoraEventDump::PrintEventMetadata(), trk::TrackContainmentTagger::produce(), noisefilteralg::WireCellNoiseFilter::produce(), cluster::BlurredClustering::produce(), cluster::TrajCluster::produce(), evgen::MarleyGen::produce(), trkf::Track3DKalmanSPS::produce(), lar_cluster3d::Cluster3D::produce(), evgen::MarleyTimeGen::produce(), and evdb::ScanFrame::Record().

83  {
84  std::lock_guard lock{mutex_};
85  return principal_.run();
86  }
RunNumber_t run() const
Definition: Principal.cc:1193
Principal const & principal_
Definition: DataViewImpl.h:318
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
RunID art::DataViewImpl::runID ( ) const

Definition at line 61 of file DataViewImpl.cc.

References mutex_, principal_, and art::Principal::runID().

Referenced by art::Run::id().

62  {
63  std::lock_guard lock{mutex_};
64  return principal_.runID();
65  }
Principal const & principal_
Definition: DataViewImpl.h:318
RunID const & runID() const
Definition: Principal.cc:1175
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312
SubRunID art::DataViewImpl::subRunID ( ) const

Definition at line 68 of file DataViewImpl.cc.

References mutex_, principal_, and art::Principal::subRunID().

Referenced by art::SubRun::id().

69  {
70  std::lock_guard lock{mutex_};
71  return principal_.subRunID();
72  }
Principal const & principal_
Definition: DataViewImpl.h:318
SubRunID subRunID() const
Definition: Principal.cc:1181
std::recursive_mutex mutex_
Definition: DataViewImpl.h:312

Friends And Related Function Documentation

friend class detail::Analyzer
friend

Definition at line 77 of file DataViewImpl.h.

friend class detail::Filter
friend

Definition at line 78 of file DataViewImpl.h.

friend class detail::Producer
friend

Definition at line 79 of file DataViewImpl.h.

friend class ProducingService
friend

Definition at line 81 of file DataViewImpl.h.

friend class ResultsProducer
friend

Definition at line 80 of file DataViewImpl.h.

Member Data Documentation

BranchType const art::DataViewImpl::branchType_
private
ModuleContext const& art::DataViewImpl::mc_
private

Definition at line 321 of file DataViewImpl.h.

Referenced by DataViewImpl(), and getContainerForView_().

ModuleDescription const& art::DataViewImpl::md_
private
std::map<TypeLabel, PMValue> art::DataViewImpl::putProducts_ {}
private

Definition at line 344 of file DataViewImpl.h.

Referenced by movePutProductsToPrincipal().

RangeSet art::DataViewImpl::rangeSet_ {RangeSet::invalid()}
private

Definition at line 335 of file DataViewImpl.h.

Referenced by DataViewImpl().

bool const art::DataViewImpl::recordParents_
private

Definition at line 331 of file DataViewImpl.h.

Referenced by DataViewImpl().

std::set<ProductID> art::DataViewImpl::retrievedProducts_ {}
mutableprivate

Definition at line 340 of file DataViewImpl.h.

Referenced by movePutProductsToPrincipal(), and recordAsParent_().


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