LArSoft  v08_41_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 >
std::vector< InputTaggetInputTags (SelectorBase const &selector=MatchAllSelector{}) const
 
template<typename PROD >
std::vector< ProductToken< PROD > > getProductTokens (SelectorBase const &selector=MatchAllSelector{}) const
 
template<typename PROD >
std::vector< Handle< PROD > > getMany (SelectorBase const &selector=MatchAllSelector{}) 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:327
BranchType const branchType_
Definition: DataViewImpl.h:324
ModuleDescription const & md_
Definition: DataViewImpl.h:333
ModuleContext const & mc_
Definition: DataViewImpl.h:330
bool const recordParents_
Definition: DataViewImpl.h:340
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:327
Timestamp const & beginTime() const
Definition: Principal.cc:1154
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:327
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
Timestamp const & endTime() const
Definition: Principal.cc:1163
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:1121
Principal const & principal_
Definition: DataViewImpl.h:327
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:327
EventAuxiliary::ExperimentType ExperimentType() const
Definition: Principal.cc:953
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
template<typename PROD >
bool art::DataViewImpl::get ( SelectorBase const &  sel,
Handle< PROD > &  result 
) const

Definition at line 386 of file DataViewImpl.h.

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

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

387  {
388  std::lock_guard lock{mutex_};
389  result.clear();
390  // We do *not* track whether consumes was called for a SelectorBase.
391  ProcessTag const processTag{"", md_.processName()};
392  auto qr = principal_.getBySelector(
393  mc_, WrappedTypeID::make<PROD>(), sel, processTag);
394  result = Handle<PROD>{qr};
395  bool const ok = qr.succeeded() && !qr.failed();
396  if (recordParents_ && ok) {
397  recordAsParent_(qr.result());
398  }
399  return ok;
400  }
Principal const & principal_
Definition: DataViewImpl.h:327
std::string const & processName() const
GroupQueryResult getBySelector(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:678
ModuleDescription const & md_
Definition: DataViewImpl.h:333
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
ModuleContext const & mc_
Definition: DataViewImpl.h:330
bool const recordParents_
Definition: DataViewImpl.h:340
template<typename PROD >
bool art::DataViewImpl::get ( ProductID const  pid,
Handle< PROD > &  result 
) const

Definition at line 404 of file DataViewImpl.h.

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

405  {
406  std::lock_guard lock{mutex_};
407  result.clear();
408  auto qr = principal_.getByProductID(pid);
409  result = Handle<PROD>{qr};
410  bool const ok = qr.succeeded() && !qr.failed();
411  if (recordParents_ && ok) {
412  recordAsParent_(qr.result());
413  }
414  return ok;
415  }
Principal const & principal_
Definition: DataViewImpl.h:327
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
GroupQueryResult getByProductID(ProductID const pid) const
Definition: Principal.cc:1220
bool const recordParents_
Definition: DataViewImpl.h:340
template<typename PROD >
bool art::DataViewImpl::getByLabel ( std::string const &  label,
std::string const &  instance,
Handle< PROD > &  result 
) const

Definition at line 446 of file DataViewImpl.h.

References instance.

Referenced by lar::util::details::FindAllP< Source, Dest >::Add(), reco3d::PlotSpacePoints::analyze(), cheat::CheckBackTracking::analyze(), opdet::OpDigiAna::analyze(), hit::MCHitAnaExample::analyze(), shower::TCShowerAnalysis::analyze(), opdet::OpFlashSimpleAna::analyze(), opdet::OpFlashMCTruthAna::analyze(), opdet::FIFOHistogramAna::analyze(), calo::PrintCalorimetry::analyze(), pid::PIDAAnalyzer::analyze(), MCBTDemo::analyze(), opdet::OpHitAna::analyze(), detsim::SimWireAna::analyze(), trk::TrackContainmentAnalyzer::analyze(), opdet::OpFlashAna::analyze(), shower::TCShowerElectronLikelihood::analyze(), shower::TCShowerTemplateMaker::analyze(), detsim::WienerFilterAna::analyze(), larg::LArSimChannelAna::analyze(), vertex::AggregateVertexAna::analyze(), opdet::FlashHypothesisAna::analyze(), larg4::ISCalcAna::analyze(), microboone::CosmicRemovalAna::analyze(), hit::MagDriftAna::analyze(), cluster::HoughLineFinderAna::analyze(), cluster::ClusterPCA::analyze(), caldata::CalWireAna::analyze(), opreco::OpticalRecoAna::analyze(), hit::HitAnaModule::analyze(), cluster::ClusterAna::analyze(), cheat::RecoCheckAna::analyze(), hit::HitFinderAna::analyze(), opdet::LEDCalibrationAna::analyze(), lar_pandora::ConsolidatedPFParticleAnalysisTemplate::analyze(), hit::GausHitFinderAna::analyze(), pfpf::PFPAna::analyze(), cluster::DBclusterAna::analyze(), rwgt::ReweightAna::analyze(), vertex::FeatureVertexFinderAna::analyze(), trkf::SpacePointAna::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::ShowerPFPVertexStartPosition::CalculateElement(), ShowerRecoTools::ShowerResidualTrackHitFinder::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::DrawLArVoxel3D::Draw(), evdb_tool::DrawSimEnergyDeposit3D::drawAll(), evd::AnalysisBaseDrawer::DrawDeDx(), evd::AnalysisBaseDrawer::DrawKineticEnergy(), evdb_tool::DrawSimEnergyDeposit3D::drawMCPartAssociated(), 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::processSimChannel(), wc::CellTree::processSpacePointTruthDepo(), wc::CellTree::processTrigger(), trkf::FeatureTracker::produce(), MCReco::produce(), pid::Chi2ParticleID::produce(), opdet::OpticalRawDigitReformatter::produce(), hit::MCHitFinder::produce(), cosmic::TrackPFParticleMatch::produce(), hit::DisambigCheater::produce(), vertex::VertexCheater::produce(), cosmic::CosmicClusterTagger::produce(), shwf::ShowerCheater::produce(), trk::TrackContainmentTagger::produce(), hit::TTHitFinder::produce(), cosmic::CosmicTrackTagger::produce(), event::EventCheater::produce(), trkf::SpacePointCheater::produce(), trkf::SpacePointFinder::produce(), apa::APAHitFinder::produce(), sppt::TTSpacePointFinder::produce(), cluster::ClusterCheater::produce(), noisefilteralg::WireCellNoiseFilter::produce(), hit::RawHitFinder::produce(), hit::RFFHitFinder::produce(), opdet::OpFlashFinder::produce(), trkf::TrackCheater::produce(), hit::FFTHitFinder::produce(), cosmic::CosmicPFParticleTagger::produce(), larg4::IonAndScint::produce(), cluster::DBcluster::produce(), spacecharge::ShiftEdepSCE::produce(), trkf::TrackStitcher::produce(), sim::MergeSimSources::produce(), shwf::ShowerFinder::produce(), cosmic::BeamFlashTrackMatchTagger::produce(), cluster::LineMerger::produce(), vertex::PrimaryVertexFinder::produce(), caldata::CalWire::produce(), cluster::EndPointModule::produce(), caldata::CalWireT962::produce(), calo::TrackCalorimetry::produce(), ShowerReco3D::produce(), shower::TCShower::produce(), CRHitRemoval::produce(), cluster::BlurredClustering::produce(), trkf::SpacePts::produce(), t0::MCParticleTrackMatching::produce(), trkf::TrackKalmanCheater::produce(), cosmic::CosmicPCAxisTagger::produce(), trkf::Track3Dreco::produce(), t0::MCParticleShowerMatching::produce(), cluster::TrajCluster::produce(), opdet::OpHitFinder::produce(), reco::shower::TRACS::produce(), reco3d::SpacePointSolver::produce(), phot::PDFastSimPVS::produce(), trkf::CCTrackMaker::produce(), ems::EMShower3D::produce(), shwf::ShowerReco::produce(), hit::GausHitFinder::produce(), trkf::MCSFitProducer::produce(), cluster::SmallClusterFinder::produce(), trkf::Track3DKalman::produce(), shower::EMShower::produce(), vertex::VertexFinder2D::produce(), hit::DPRawHitFinder::produce(), lbne::PhotonCounterT0Matching::produce(), CRHitRemovalByPCA::produce(), detsim::DriftElectronstoPlane::produce(), t0::MCTruthT0Matching::produce(), calo::Calorimetry::produce(), vertex::FeatureVertexFinder::produce(), trkf::PMAlgTrajFitter::produce(), trkf::Track3DKalmanSPS::produce(), detsim::SimDriftElectrons::produce(), trkf::KalmanFilterTrajectoryFitter::produce(), trkf::CosmicTracker::produce(), larg4::LArG4::produce(), phot::PDFastSimPAR::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().

449  {
450  return getByLabel<PROD>(moduleLabel, instance, {}, result);
451  }
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 419 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().

423  {
424  std::lock_guard lock{mutex_};
425  result.clear();
426  auto const wrapped = WrappedTypeID::make<PROD>();
427  ProcessTag const processTag{processName, md_.processName()};
428  ProductInfo const pinfo{ProductInfo::ConsumableType::Product,
429  wrapped.product_type,
430  moduleLabel,
431  productInstanceName,
432  processTag};
434  GroupQueryResult qr = principal_.getByLabel(
435  mc_, wrapped, moduleLabel, productInstanceName, processTag);
436  result = Handle<PROD>{qr};
437  bool const ok = qr.succeeded() && !qr.failed();
438  if (recordParents_ && ok) {
439  recordAsParent_(qr.result());
440  }
441  return ok;
442  }
Principal const & principal_
Definition: DataViewImpl.h:327
static ConsumesInfo * instance()
Definition: ConsumesInfo.cc:24
BranchType const branchType_
Definition: DataViewImpl.h:324
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:333
void validateConsumedProduct(BranchType const, ModuleDescription const &, ProductInfo const &productInfo)
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:695
ModuleContext const & mc_
Definition: DataViewImpl.h:330
bool const recordParents_
Definition: DataViewImpl.h:340
template<typename PROD >
PROD const & art::DataViewImpl::getByLabel ( InputTag const &  tag) const

Definition at line 473 of file DataViewImpl.h.

474  {
475  Handle<PROD> h;
476  getByLabel(tag, h);
477  return *h;
478  }
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
template<typename PROD >
bool art::DataViewImpl::getByLabel ( InputTag const &  tag,
Handle< PROD > &  result 
) const

Definition at line 455 of file DataViewImpl.h.

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

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

Definition at line 462 of file DataViewImpl.h.

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

464  {
465  return getByLabel<PROD>(token.inputTag_.label(),
466  token.inputTag_.instance(),
467  token.inputTag_.process(),
468  result);
469  }
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::resolve_products(), 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 const groups = principal_.getMatchingSequence(
345  mc_,
346  Selector{ModuleLabelSelector{moduleLabel} &&
347  ProductInstanceNameSelector{productInstanceName} &&
348  ProcessNameSelector{processTag.name()}},
349  processTag);
350  auto qrs = resolve_products(groups, TypeID{});
351  // Remove any containers that do not allow upcasting of their
352  // elements to the desired element type.
353  auto new_end =
354  remove_if(qrs.begin(), qrs.end(), [&typeID](auto const& gqr) {
355  auto const group = gqr.result();
356  assert(group->productDescription().supportsView());
357  return !detail::upcastAllowed(*group->uniqueProduct()->typeInfo(),
358  typeID.typeInfo());
359  });
360  qrs.erase(new_end, qrs.end());
361  // Throw if there is not one and only one container to return.
362  if (qrs.size() != 1) {
364  e << "getView: Found "
365  << (qrs.empty() ? "no products" : "more than one product")
366  << " matching all criteria\n"
367  << "Looking for sequence of type: " << typeID << "\n"
368  << "Looking for module label: " << moduleLabel << "\n"
369  << "Looking for productInstanceName: " << productInstanceName << "\n";
370  if (!processTag.name().empty()) {
371  e << "Looking for processName: " << processTag.name() << "\n";
372  }
373  throw e;
374  }
375  // And return the single result.
376  return qrs[0].result();
377  }
Principal const & principal_
Definition: DataViewImpl.h:327
static ConsumesInfo * instance()
Definition: ConsumesInfo.cc:24
BranchType const branchType_
Definition: DataViewImpl.h:324
ModuleDescription const & md_
Definition: DataViewImpl.h:333
std::vector< cet::exempt_ptr< Group > > getMatchingSequence(ModuleContext const &, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:733
void validateConsumedProduct(BranchType const, ModuleDescription const &, ProductInfo const &productInfo)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool upcastAllowed(std::type_info const &tiFrom, std::type_info const &tiTo)
ModuleContext const & mc_
Definition: DataViewImpl.h:330
Float_t e
Definition: plot.C:34
std::vector< GroupQueryResult > resolve_products(std::vector< cet::exempt_ptr< art::Group >> const &groups, art::TypeID const &wrapped_type)
Definition: Group.cc:439
template<typename PROD >
std::vector< InputTag > art::DataViewImpl::getInputTags ( SelectorBase const &  selector = MatchAllSelector{}) const

Definition at line 507 of file DataViewImpl.h.

508  {
509  auto const wrapped = WrappedTypeID::make<PROD>();
510  ProcessTag const processTag{"", md_.processName()};
511  return principal_.getInputTags(mc_, wrapped, selector, processTag);
512  }
Principal const & principal_
Definition: DataViewImpl.h:327
std::vector< InputTag > getInputTags(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:709
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:333
ModuleContext const & mc_
Definition: DataViewImpl.h:330
template<typename PROD >
std::vector< Handle< PROD > > art::DataViewImpl::getMany ( SelectorBase const &  selector = MatchAllSelector{}) const

Definition at line 529 of file DataViewImpl.h.

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

530  {
531  std::lock_guard lock{mutex_};
532  auto const wrapped = WrappedTypeID::make<PROD>();
534  branchType_,
535  md_,
536  ProductInfo{ProductInfo::ConsumableType::Many, wrapped.product_type});
537  ProcessTag const processTag{"", md_.processName()};
538  std::vector<Handle<PROD>> products;
539  for (auto const& qr : principal_.getMany(mc_, wrapped, sel, processTag)) {
540  products.emplace_back(qr);
541  if (recordParents_) {
542  recordAsParent_(qr.result());
543  }
544  }
545  return products;
546  }
Principal const & principal_
Definition: DataViewImpl.h:327
static ConsumesInfo * instance()
Definition: ConsumesInfo.cc:24
BranchType const branchType_
Definition: DataViewImpl.h:324
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:333
void validateConsumedProduct(BranchType const, ModuleDescription const &, ProductInfo const &productInfo)
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
void recordAsParent_(cet::exempt_ptr< Group const > grp) const
std::vector< GroupQueryResult > getMany(ModuleContext const &mc, WrappedTypeID const &wrapped, SelectorBase const &, ProcessTag const &) const
Definition: Principal.cc:723
ModuleContext const & mc_
Definition: DataViewImpl.h:330
bool const recordParents_
Definition: DataViewImpl.h:340
template<typename PROD >
void art::DataViewImpl::getMany ( SelectorBase const &  sel,
std::vector< Handle< PROD >> &  results 
) const

Definition at line 550 of file DataViewImpl.h.

552  {
553  results = getMany<PROD>(sel);
554  }
template<typename PROD >
PROD const * art::DataViewImpl::getPointerByLabel ( InputTag const &  tag) const

Definition at line 482 of file DataViewImpl.h.

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

483  {
484  Handle<PROD> h;
485  getByLabel(tag, h);
486  return h.product();
487  }
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
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:333
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:327
static collection_type const & get() noexcept
History const & history() const
Definition: Principal.cc:959
BranchType const branchType_
Definition: DataViewImpl.h:324
static collection_type const & get()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:327
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
Definition: Principal.cc:1051
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:327
std::string const & moduleLabel() const
const std::string instance
BranchType const branchType_
Definition: DataViewImpl.h:324
std::string const & processName() const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
Definition: Principal.cc:1051
ModuleDescription const & md_
Definition: DataViewImpl.h:333
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:321
template<typename PROD >
ProductID art::DataViewImpl::getProductID ( std::string const &  instance_name = "") const

Definition at line 358 of file DataViewImpl.h.

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

Referenced by evgb::util::CreateAssn(), 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().

359  {
360  std::lock_guard lock{mutex_};
361  TypeID const type{typeid(PROD)};
362  auto const& product_name = canonicalProductName(
363  type.friendlyClassName(), md_.moduleLabel(), instance, md_.processName());
364  ProductID const pid{product_name};
365  auto desc = principal_.getProductDescription(pid);
366  if (!desc) {
368  "DataViewImpl::getProductID: error while trying to "
369  "retrieve product description:\n")
370  << "No product is registered for\n"
371  << " process name: '" << md_.processName() << "'\n"
372  << " module label: '" << md_.moduleLabel() << "'\n"
373  << " product friendly class name: '" << type.friendlyClassName()
374  << "'\n"
375  << " product instance name: '" << instance << "'\n"
376  << " branch type: '" << branchType_ << "'\n";
377  }
378  // The description object is owned by either the source or the
379  // event processor, whose lifetimes exceed that of the
380  // DataViewImpl object. It is therefore safe to dereference.
381  return desc->productID();
382  }
Principal const & principal_
Definition: DataViewImpl.h:327
std::string const & moduleLabel() const
const std::string instance
BranchType const branchType_
Definition: DataViewImpl.h:324
std::string const & processName() const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
Definition: Principal.cc:1051
ModuleDescription const & md_
Definition: DataViewImpl.h:333
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:321
template<typename PROD >
std::vector< ProductToken< PROD > > art::DataViewImpl::getProductTokens ( SelectorBase const &  selector = MatchAllSelector{}) const

Definition at line 516 of file DataViewImpl.h.

517  {
518  auto const tags = getInputTags<PROD>(selector);
519  std::vector<ProductToken<PROD>> tokens;
520  tokens.reserve(tags.size());
521  cet::transform_all(tags, back_inserter(tokens), [](auto const& tag) {
522  return ProductToken<PROD>{tag};
523  });
524  return tokens;
525  }
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 671 of file DataViewImpl.h.

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

675  {
676  std::lock_guard lock{mutex_};
677  auto grp = getContainerForView_(TypeID{typeid(ELEMENT)},
678  moduleLabel,
679  productInstanceName,
680  ProcessTag{processName, md_.processName()});
681  if (recordParents_) {
682  recordAsParent_(grp);
683  }
684  std::vector<void const*> view;
685  grp->uniqueProduct()->fillView(view);
686  std::size_t i{0};
687  for (auto p : view) {
688  result.emplace_back(
689  grp->productID(), static_cast<ELEMENT const*>(p), i++);
690  }
691  }
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:333
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:340
template<typename ELEMENT >
void art::DataViewImpl::getPtrVector ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
PtrVector< ELEMENT > &  result 
) const

Definition at line 695 of file DataViewImpl.h.

698  {
699  getPtrVector(moduleLabel, productInstanceName, {}, result);
700  }
void getPtrVector(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, PtrVector< ELEMENT > &result) const
Definition: DataViewImpl.h:671
template<typename ELEMENT >
void art::DataViewImpl::getPtrVector ( InputTag const &  tag,
PtrVector< ELEMENT > &  result 
) const

Definition at line 704 of file DataViewImpl.h.

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

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

Definition at line 712 of file DataViewImpl.h.

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

714  {
715  getPtrVector(token.inputTag_.label(),
716  token.inputTag_.instance(),
717  token.inputTag_.process(),
718  result);
719  }
void getPtrVector(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, PtrVector< ELEMENT > &result) const
Definition: DataViewImpl.h:671
template<typename PROD >
ValidHandle< PROD > art::DataViewImpl::getValidHandle ( InputTag const &  tag) const

Definition at line 491 of file DataViewImpl.h.

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

Referenced by detsim::SimDriftedElectronClusterAna::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::HoughLineFinder::produce(), cluster::DBCluster3D::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().

492  {
493  Handle<PROD> h;
494  getByLabel(tag, h);
495  return ValidHandle{h.product(), *h.provenance()};
496  }
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
template<typename PROD >
ValidHandle< PROD > art::DataViewImpl::getValidHandle ( ProductToken< PROD > const &  token) const

Definition at line 500 of file DataViewImpl.h.

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

501  {
502  return getValidHandle<PROD>(token.inputTag_);
503  }
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 565 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().

569  {
570  std::lock_guard lock{mutex_};
571  std::size_t const orig_size = result.size();
572  auto grp = getContainerForView_(TypeID{typeid(ELEMENT)},
573  moduleLabel,
574  productInstanceName,
575  ProcessTag{processName, md_.processName()});
576  if (recordParents_) {
577  recordAsParent_(grp);
578  }
579  std::vector<void const*> view;
580  grp->uniqueProduct()->fillView(view);
581  std::vector<ELEMENT const*> castedView;
582  for (auto p : view) {
583  castedView.push_back(static_cast<ELEMENT const*>(p));
584  }
585  result = std::move(castedView);
586  return result.size() - orig_size;
587  }
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:333
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:340
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 591 of file DataViewImpl.h.

594  {
595  return getView(moduleLabel, productInstanceName, {}, result);
596  }
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:565
template<typename ELEMENT >
std::size_t art::DataViewImpl::getView ( InputTag const &  tag,
std::vector< ELEMENT const * > &  result 
) const

Definition at line 600 of file DataViewImpl.h.

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

602  {
603  return getView(tag.label(), tag.instance(), tag.process(), result);
604  }
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:565
template<typename ELEMENT >
std::size_t art::DataViewImpl::getView ( ViewToken< ELEMENT > const &  token,
std::vector< ELEMENT const * > &  result 
) const

Definition at line 608 of file DataViewImpl.h.

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

610  {
611  return getView(token.inputTag_.label(),
612  token.inputTag_.instance(),
613  token.inputTag_.process(),
614  result);
615  }
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:565
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 619 of file DataViewImpl.h.

623  {
624  std::lock_guard lock{mutex_};
625  auto grp = getContainerForView_(TypeID{typeid(ELEMENT)},
626  moduleLabel,
627  productInstanceName,
628  ProcessTag{processName, md_.processName()});
629  if (recordParents_) {
630  recordAsParent_(grp);
631  }
632  std::vector<void const*> view;
633  grp->uniqueProduct()->fillView(view);
634  std::vector<ELEMENT const*> castedView;
635  for (auto p : view) {
636  castedView.push_back(static_cast<ELEMENT const*>(p));
637  }
638  result = View{castedView, grp->productID(), grp->uniqueProduct()};
639  return true;
640  }
std::string const & processName() const
ModuleDescription const & md_
Definition: DataViewImpl.h:333
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:340
template<typename ELEMENT >
bool art::DataViewImpl::getView ( std::string const &  moduleLabel,
std::string const &  productInstanceName,
View< ELEMENT > &  result 
) const

Definition at line 644 of file DataViewImpl.h.

647  {
648  return getView(moduleLabel, productInstanceName, {}, result);
649  }
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:565
template<typename ELEMENT >
bool art::DataViewImpl::getView ( InputTag const &  tag,
View< ELEMENT > &  result 
) const

Definition at line 653 of file DataViewImpl.h.

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

654  {
655  return getView(tag.label(), tag.instance(), tag.process(), result);
656  }
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:565
template<typename ELEMENT >
bool art::DataViewImpl::getView ( ViewToken< ELEMENT > const &  token,
View< ELEMENT > &  result 
) const

Definition at line 660 of file DataViewImpl.h.

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

662  {
663  return getView(token.inputTag_.label(),
664  token.inputTag_.instance(),
665  token.inputTag_.process(),
666  result);
667  }
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:565
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:327
History const & history() const
Definition: Principal.cc:959
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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(), hit::HitFinderAna::analyze(), cluster::DBclusterAna::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:327
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
bool isReal() const
Definition: Principal.cc:947
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:324
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
std::map< TypeLabel, PMValue > putProducts_
Definition: DataViewImpl.h:353
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:324
std::set< ProductID > retrievedProducts_
Definition: DataViewImpl.h:349
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
std::map< TypeLabel, PMValue > putProducts_
Definition: DataViewImpl.h:353
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:327
ProcessHistory const & processHistory() const
Definition: Principal.cc:386
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:327
History const & history() const
Definition: Principal.cc:959
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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 730 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::TextFileGen::beginRun(), evgen::NeutronOsc::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(), lar_pandora::LArPandoraShowerCreation::produce(), trk::TrackContainmentTagger::produce(), shwf::ShowerCheater::produce(), cosmic::CosmicTrackTagger::produce(), event::EventCheater::produce(), trkf::SpacePointCheater::produce(), trkf::SpacePointFinder::produce(), trkf::TCTrack::produce(), cluster::LineCluster::produce(), tss::TrackShowerHits::produce(), sppt::TTSpacePointFinder::produce(), noisefilteralg::WireCellNoiseFilter::produce(), cluster::ClusterCheater::produce(), cluster::ClusterCrawler::produce(), evgen::CosmicsGen::produce(), opdet::OptDetDigitizer::produce(), opdet::OpFlashFinder::produce(), trkf::TrackCheater::produce(), evwgh::EventWeight::produce(), cosmic::CosmicPFParticleTagger::produce(), cluster::DBcluster::produce(), trkf::TrackStitcher::produce(), spacecharge::ShiftEdepSCE::produce(), shwf::ShowerFinder::produce(), sim::MergeSimSources::produce(), cluster::LineMerger::produce(), opdet::OpMCDigi::produce(), cosmic::BeamFlashTrackMatchTagger::produce(), vertex::PrimaryVertexFinder::produce(), cluster::EndPointModule::produce(), t0::MCParticleHitMatching::produce(), cluster::HoughLineFinder::produce(), evgen::FileMuons::produce(), caldata::CalWire::produce(), cluster::DBCluster3D::produce(), caldata::CalWireT962::produce(), calo::TrackCalorimetry::produce(), ShowerReco3D::produce(), cluster::BlurredClustering::produce(), TrackProducerFromTrack::produce(), shower::TCShower::produce(), trkf::SpacePts::produce(), TrackProducerFromTrackTrajectory::produce(), t0::MCParticleTrackMatching::produce(), cosmic::CosmicPCAxisTagger::produce(), trkf::TrackKalmanCheater::produce(), t0::MCParticleShowerMatching::produce(), trkf::Track3Dreco::produce(), evgen::NDKGen::produce(), cluster::TrajCluster::produce(), detsim::SimWire::produce(), opdet::OpHitFinder::produce(), reco3d::SpacePointSolver::produce(), trkf::CCTrackMaker::produce(), calo::ShowerCalorimetry::produce(), ems::EMShower3D::produce(), shwf::ShowerReco::produce(), evgen::NucleonDecay::produce(), trkf::MCSFitProducer::produce(), cluster::SmallClusterFinder::produce(), trkf::Track3DKalman::produce(), shower::EMShower::produce(), evgen::GaisserParam::produce(), vertex::VertexFinder2D::produce(), evgen::MarleyGen::produce(), trkf::Track3DKalmanHit::produce(), CRHitRemovalByPCA::produce(), lbne::PhotonCounterT0Matching::produce(), evgen::TextFileGen::produce(), evgen::NeutronOsc::produce(), evgen::GENIEGen::produce(), evd::GraphCluster::produce(), t0::MCTruthT0Matching::produce(), evgen::RadioGen::produce(), calo::Calorimetry::produce(), vertex::FeatureVertexFinder::produce(), trkf::PMAlgTrajFitter::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().

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

Definition at line 738 of file DataViewImpl.h.

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

Definition at line 746 of file DataViewImpl.h.

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

Definition at line 754 of file DataViewImpl.h.

References art::RangeSet::forRun().

757  {
758  return put(move(edp), instance, RangeSet::forRun(runID()));
759  }
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:730
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 763 of file DataViewImpl.h.

References art::errors::ProductPutFailure.

766  {
767  std::lock_guard lock{mutex_};
768  static_assert(
770  "\n\n"
771  "art error: A Run product put with the semantic 'RunFragment'\n"
772  " must be able to be aggregated. Please add the appropriate\n"
773  " void aggregate(T const&)\n"
774  " function to your class, or contact artists@fnal.gov.\n");
775  if (rangeSet_.collapse().is_full_run()) {
776  throw art::Exception{errors::ProductPutFailure, "Run::put"}
777  << "\nCannot put a product corresponding to a full Run using\n"
778  << "art::runFragment(). This can happen if you attempted to\n"
779  << "put a product at beginRun using art::runFragment().\n"
780  << "Please use either:\n"
781  << " art::fullRun(), or\n"
782  << " art::runFragment(art::RangeSet const&)\n"
783  << "or contact artists@fnal.gov for assistance.\n";
784  }
785  return put(move(edp), instance, rangeSet_);
786  }
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:321
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
RangedFragmentSemantic< Level::Run semantic 
)

Definition at line 790 of file DataViewImpl.h.

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

793  {
794  std::lock_guard lock{mutex_};
795  static_assert(
797  "\n\n"
798  "art error: A Run product put with the semantic 'RunFragment'\n"
799  " must be able to be aggregated. Please add the appropriate\n"
800  " void aggregate(T const&)\n"
801  " function to your class, or contact artists@fnal.gov.\n");
802  if (semantic.rs.collapse().is_full_run()) {
803  throw art::Exception{errors::ProductPutFailure, "Run::put"}
804  << "\nCannot put a product corresponding to a full Run using\n"
805  << "art::runFragment(art::RangeSet&). Please use:\n"
806  << " art::fullRun()\n"
807  << "or contact artists@fnal.gov for assistance.\n";
808  }
809  return put(move(edp), instance, semantic.rs);
810  }
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:321
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
FullSemantic< Level::SubRun > const  semantic 
)

Definition at line 814 of file DataViewImpl.h.

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

Definition at line 822 of file DataViewImpl.h.

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

Definition at line 830 of file DataViewImpl.h.

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

Definition at line 838 of file DataViewImpl.h.

References art::RangeSet::forSubRun().

841  {
842  return put(move(edp), instance, RangeSet::forSubRun(subRunID()));
843  }
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:730
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
FragmentSemantic< Level::SubRun  
)

Definition at line 847 of file DataViewImpl.h.

References art::errors::ProductPutFailure.

850  {
851  std::lock_guard lock{mutex_};
852  static_assert(
854  "\n\n"
855  "art error: A SubRun product put with the semantic 'SubRunFragment'\n"
856  " must be able to be aggregated. Please add the appropriate\n"
857  " void aggregate(T const&)\n"
858  " function to your class, or contact artists@fnal.gov.\n");
860  throw art::Exception(errors::ProductPutFailure, "SubRun::put")
861  << "\nCannot put a product corresponding to a full SubRun using\n"
862  << "art::subRunFragment(). This can happen if you attempted to\n"
863  << "put a product at beginSubRun using art::subRunFragment().\n"
864  << "Please use either:\n"
865  << " art::fullSubRun(), or\n"
866  << " art::subRunFragment(art::RangeSet const&)\n"
867  << "or contact artists@fnal.gov for assistance.\n";
868  }
869  return put(move(edp), instance, rangeSet_);
870  }
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:321
bool is_full_subRun() const
Definition: RangeSet.cc:131
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp,
std::string const &  instance,
RangedFragmentSemantic< Level::SubRun semantic 
)

Definition at line 874 of file DataViewImpl.h.

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

877  {
878  std::lock_guard lock{mutex_};
879  static_assert(
881  "\n\n"
882  "art error: A SubRun product put with the semantic 'SubRunFragment'\n"
883  " must be able to be aggregated. Please add the appropriate\n"
884  " void aggregate(T const&)\n"
885  " function to your class, or contact artists@fnal.gov.\n");
886  if (semantic.rs.collapse().is_full_subRun()) {
887  throw art::Exception{errors::ProductPutFailure, "Run::put"}
888  << "\nCannot put a product corresponding to a full SubRun using\n"
889  << "art::subRunFragment(art::RangeSet&). Please use:\n"
890  << " art::fullSubRun()\n"
891  << "or contact artists@fnal.gov for assistance.\n";
892  }
893  return put(move(edp), instance, semantic.rs);
894  }
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:321
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
template<typename PROD >
ProductID art::DataViewImpl::put ( std::unique_ptr< PROD > &&  edp)

Definition at line 723 of file DataViewImpl.h.

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

Definition at line 898 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().

899  {
900  std::lock_guard lock{mutex_};
901  TypeID const tid{typeid(PROD)};
902  if (edp.get() == nullptr) {
904  << "Event::put: A null unique_ptr was passed to 'put'.\n"
905  << "The pointer is of type " << tid << ".\n"
906  << "The specified productInstanceName was '" << instance << "'.\n";
907  }
908  auto const& bd = getProductDescription_(tid, instance, true);
909  assert(bd.productID() != ProductID::invalid());
910  auto const typeLabel =
912  auto wp = std::make_unique<Wrapper<PROD>>(move(edp));
913  auto const& rs = detail::range_sets_supported(branchType_) ?
914  rangeSet_.collapse() :
916  bool const result =
917  putProducts_.try_emplace(typeLabel, PMValue{std::move(wp), bd, rs})
918  .second;
919  if (!result) {
920  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
RangeSet & collapse()
Definition: RangeSet.cc:263
BranchType const branchType_
Definition: DataViewImpl.h:324
ModuleDescription const & md_
Definition: DataViewImpl.h:333
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:321
std::map< TypeLabel, PMValue > putProducts_
Definition: DataViewImpl.h:353
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:85
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 933 of file DataViewImpl.h.

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

936  {
937  std::lock_guard lock{mutex_};
938  TypeID const tid{typeid(PROD)};
939  if (edp.get() == nullptr) {
941  << "Event::put: A null unique_ptr was passed to 'put'.\n"
942  << "The pointer is of type " << tid << ".\n"
943  << "The specified productInstanceName was '" << instance << "'.\n";
944  }
945  if (!rs.is_valid()) {
946  throw art::Exception{errors::ProductPutFailure, "SubRun::put"}
947  << "\nCannot put a product with an invalid RangeSet.\n"
948  << "Please contact artists@fnal.gov.\n";
949  }
950  auto const& bd = getProductDescription_(tid, instance, true);
951  assert(bd.productID() != ProductID::invalid());
952  auto const typeLabel =
954  auto wp = std::make_unique<Wrapper<PROD>>(move(edp));
955  auto result =
956  putProducts_.try_emplace(typeLabel, PMValue{move(wp), bd, rs}).second;
957  if (!result) {
958  constexpr cet::HorizontalRule rule{30};
960  << "Event::put: Attempt to put multiple products with the\n"
961  << " following description onto the Event.\n"
962  << " Products must be unique per Event.\n"
963  << rule('=') << '\n'
964  << bd << rule('=') << '\n';
965  }
966  return bd.productID();
967  }
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:333
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:321
std::map< TypeLabel, PMValue > putProducts_
Definition: DataViewImpl.h:353
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:85
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:87
std::set< ProductID > retrievedProducts_
Definition: DataViewImpl.h:349
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:82
template<typename PROD >
bool art::DataViewImpl::removeCachedProduct ( Handle< PROD > &  h) const

Definition at line 971 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().

972  {
973  std::lock_guard lock{mutex_};
974  bool result{false};
975  if (h.isValid() && !h.provenance()->produced()) {
977  h.clear();
978  result = true;
979  }
980  return result;
981  }
Principal const & principal_
Definition: DataViewImpl.h:327
void removeCachedProduct(ProductID) const
Definition: Principal.cc:440
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
RunNumber_t art::DataViewImpl::run ( ) const

Definition at line 82 of file DataViewImpl.cc.

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

Referenced by shower::TCShowerAnalysis::analyze(), detsim::SimDriftedElectronClusterAna::analyze(), opdet::FIFOHistogramAna::analyze(), pid::PIDAAnalyzer::analyze(), lar_pandora::PFParticleTrackAna::analyze(), calo::PrintCalorimetry::analyze(), trk::TrackContainmentAnalyzer::analyze(), lar_pandora::PFParticleCosmicAna::analyze(), lar_pandora::PFParticleAnalysis::analyze(), lar_pandora::PFParticleMonitoring::analyze(), lar_pandora::PFParticleHitDumper::analyze(), larg4::LArG4Ana::analyze(), opdet::FlashHypothesisAna::analyze(), larg4::ISCalcAna::analyze(), microboone::CosmicRemovalAna::analyze(), hit::HitAnaModule::analyze(), opdet::LEDCalibrationAna::analyze(), hit::HitFinderAna::analyze(), cheat::RecoCheckAna::analyze(), hit::GausHitFinderAna::analyze(), cluster::DBclusterAna::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(), and evgen::MarleyTimeGen::produce().

83  {
84  std::lock_guard lock{mutex_};
85  return principal_.run();
86  }
RunNumber_t run() const
Definition: Principal.cc:1127
Principal const & principal_
Definition: DataViewImpl.h:327
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:327
RunID const & runID() const
Definition: Principal.cc:1109
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321
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:327
SubRunID subRunID() const
Definition: Principal.cc:1115
std::recursive_mutex mutex_
Definition: DataViewImpl.h:321

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 330 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 353 of file DataViewImpl.h.

Referenced by movePutProductsToPrincipal().

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

Definition at line 344 of file DataViewImpl.h.

Referenced by DataViewImpl().

bool const art::DataViewImpl::recordParents_
private

Definition at line 340 of file DataViewImpl.h.

Referenced by DataViewImpl().

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

Definition at line 349 of file DataViewImpl.h.

Referenced by movePutProductsToPrincipal(), and recordAsParent_().


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