LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
art::Consumer Class Reference

#include "Consumer.h"

Inheritance diagram for art::Consumer:
art::EDAnalyzer art::EDFilter art::EDProducer art::OutputModule art::ResultsProducer caldata::CalWireAna caldata::DumpWires calo::PrintCalorimetry cheat::CheckBackTracking cheat::RecoCheckAna cluster::ClusterAna cluster::ClusterPCA cluster::DBclusterAna cluster::HoughLineFinderAna ClusteringValidation::ClusteringValidation detsim::DumpOpDetWaveforms detsim::DumpRawDigits detsim::SimWireAna detsim::WienerFilterAna DUNE::MuonTrackingEff DUNE::NeutrinoShowerEff DUNE::NeutrinoTrackingEff ems::MultiEMShowers evd::EVD evd::Landed geo::DumpChannelMap geo::DumpGeometry hit::DumpHits hit::GausHitFinderAna hit::HitAnaModule hit::HitFinderAna hit::MagDriftAna hit::MCHitAnaExample lar::ComputePi lar::example::AnalysisExample lar::example::Exploder lar_pandora::ConsolidatedPFParticleAnalysisTemplate lar_pandora::LArPandoraEventDump lar_pandora::PFParticleAnalysis lar_pandora::PFParticleCosmicAna lar_pandora::PFParticleHitDumper lar_pandora::PFParticleMonitoring lar_pandora::PFParticleTrackAna lar_pandora::PFParticleValidation larg4::ISCalculationAna larg4::LArG4Ana larg::LArSimChannelAna MCBTDemo microboone::CosmicRemovalAna opdet::FIFOHistogramAna opdet::FlashHypothesisAna opdet::FlashPurityCheckAna opdet::LEDCalibrationAna opdet::OpDigiAna opdet::OpFlashAna opdet::OpFlashMCTruthAna opdet::OpFlashSimpleAna opdet::OpHitAna opdet::SimPhotonCounter opdet::TrackTimeAssocAna opreco::OpticalRecoAna pfpf::PFPAna phot::CreateHybridLibrary phot::PhotonLibraryAnalyzer pid::PIDAAnalyzer pmtana::PMTAna reco3d::PlotSpacePoints recob::DumpChargedSpacePoints recob::DumpClusters recob::DumpPCAxes recob::DumpPFParticles recob::DumpSeeds recob::DumpSpacePoints recob::DumpTracks recob::DumpVertices RecoProxyUsageExample rwgt::ReweightAna ShowerQuality sim::DumpGTruth sim::DumpMCParticles sim::DumpMCShowers sim::DumpMCTracks sim::DumpMCTruth sim::DumpOpDetBacktrackerRecords sim::DumpSimChannels sim::DumpSimPhotons sim::DumpSimPhotonsLite trk::TrackContainmentAnalyzer trkf::SeedAna trkf::SpacePointAna trkf::TrackAna vertex::AggregateVertexAna vertex::FeatureVertexFinderAna wc::CellTree art::BlockingPrescaler art::EventIDFilter art::MixFilter< T > art::Prescaler cluster::SmallClusterFilter filt::EmptyFilter filt::FinalStateParticleFilter filt::FinalStateSelectFilter filt::LArG4ParticleFilter filter::ADCFilter filter::EventFilter filter::MuonFilter simfilter::FilterCryostatNus simfilter::FilterGenInTime simfilter::FilterNoDirtNeutrinos simfilter::FilterNoMCParticles simfilter::FilterPrimaryPDG simfilter::FilterSimPhotonTime simfilter::FilterStoppingMuon apa::APAHitFinder art::RandomNumberSaver art::TriggerResultInserter bogoblip::BlipMaker butcher::EventButcher caldata::CalWire caldata::CalWireT962 calo::BezierCalorimetry calo::Calorimetry calo::GeneralCalorimetry calo::TrackCalorimetry cheat::BackTrackerLoader cheat::PhotonBackTrackerLoader cluster::BlurredClustering cluster::ClusterCheater cluster::ClusterCrawler cluster::DBcluster cluster::EndPointModule cluster::fuzzyCluster cluster::FuzzyClusterMerger cluster::HoughLineFinder cluster::LineCluster cluster::LineMerger cluster::SimpleClusterMerger cluster::SmallClusterFinder cluster::TrajCluster cosmic::BeamFlashTrackMatchTagger cosmic::CosmicClusterTagger cosmic::CosmicPCAxisTagger cosmic::CosmicPFParticleTagger cosmic::CosmicTrackTagger cosmic::TrackPFParticleMatch CRHitRemoval CRHitRemovalByPCA detsim::SimDriftElectrons detsim::SimWire detsim::SimWireT962 ems::EMShower3D ems::MergeEMShower3D evd::GraphCluster event::AggregateEvent event::EventCheater event::EventMaker evgen::CORSIKAGen evgen::CosmicsGen evgen::FileMuons evgen::GaisserParam evgen::GENIEGen evgen::LightSource evgen::MarleyGen evgen::MarleyTimeGen evgen::MUSUN evgen::NDKGen evgen::NeutronOsc evgen::NUANCEGen evgen::NucleonDecay evgen::RadioGen evgen::SingleGen evgen::SNNueAr40CCGen evgen::TextFileGen evwgh::EventWeight hit::DisambigCheater hit::DPRawHitFinder hit::FFTHitFinder hit::GausHitFinder hit::HitCheater hit::HitFinder hit::MCHitFinder hit::RawHitFinder hit::RFFHitFinder hit::TTHitFinder lar::example::Disturbance lar::example::RemoveIsolatedSpacePoints lar::example::TotallyCheatTracker lar_cluster3d::Cluster3D lar_pandora::CollectionMerging lar_pandora::CollectionSplitting lar_pandora::ILArPandora lar_pandora::LArPandoraShowerCreation lar_pandora::LArPandoraTrackCreation larg4::LArG4 lbne::PhotonCounterT0Matching MCReco mvapid::MVAPID noisefilteralg::WireCellNoiseFilter opdet::BeamFlashCompatabilityCheck opdet::BoDataFrameInput opdet::FlashClusterMatch opdet::OpFlashFinder opdet::OpHitFinder opdet::OpMCDigi opdet::OptDetDigitizer opdet::OpticalRawDigitReformatter opdet::TrackTimeAssoc phot::PhotonLibraryPropagation pid::Chi2ParticleID raw::RecompressRawDigits reco3d::SpacePointSolver shower::EMShower ShowerReco3D shwf::ShowerCheater shwf::ShowerFinder shwf::ShowerReco sim::MergeSimSources spacecharge::ShiftEdepSCE sppt::TTSpacePointFinder t0::MCParticleHitMatching t0::MCParticleShowerMatching t0::MCParticleTrackMatching t0::MCTruthT0Matching ToyOneShowerGen TrackProducerFromPFParticle TrackProducerFromTrack TrackProducerFromTrackTrajectory trk::TrackContainmentTagger trkf::BezierTrackerModule trkf::CCTrackMaker trkf::CosmicTracker trkf::FeatureTracker trkf::KalmanFilterFinalTrackFitter trkf::KalmanFilterTrajectoryFitter trkf::MCSFitProducer trkf::PMAlgTrackMaker trkf::PMAlgTrajFitter trkf::SeedFinderModule trkf::SpacePointCheater trkf::SpacePointFinder trkf::SpacePts trkf::TCTrack trkf::Track3DKalman trkf::Track3DKalmanHit trkf::Track3DKalmanSPS trkf::Track3Dreco trkf::TrackCheater trkf::TrackKalmanCheater trkf::TrackStitcher trkf::VertexFitter tss::TrackShowerHits vertex::AggregateVertex vertex::CornerFinder vertex::FeatureVertexFinder vertex::HarrisVertexFinder vertex::PrimaryVertexFinder vertex::VertexCheater vertex::VertexFinder2D vertex::VertexMatch wc::MergeWireCell wcls::WireCellToolkit art::FileDumperOutput art::ProvenanceCheckerOutput art::ProvenanceDumper< DETAIL, Enable > art::ProvenanceDumper< DETAIL,                                                                                                                                                                                   cet::enable_if_type_exists_t< typename DETAIL::Config > > art::RootOutput

Classes

struct  InvalidTag
 

Public Member Functions

 Consumer ()=default
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void setModuleDescription (ModuleDescription const &md)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Types

using ConsumableType = ProductInfo::ConsumableType
 

Private Member Functions

 Consumer (InvalidTag)
 

Private Attributes

bool moduleContext_ {true}
 
bool requireConsumes_ {false}
 
ConsumableProducts consumables_ {}
 
ConsumableProductSets missingConsumes_ {}
 
cet::exempt_ptr< ModuleDescription const > moduleDescription_ {nullptr}
 

Friends

class DataViewImpl
 

Detailed Description

Definition at line 87 of file Consumer.h.

Member Typedef Documentation

Definition at line 133 of file Consumer.h.

Constructor & Destructor Documentation

art::Consumer::Consumer ( )
explicitdefault
art::Consumer::Consumer ( InvalidTag  )
inlineexplicitprivate

Definition at line 134 of file Consumer.h.

134 : moduleContext_{false} {}
bool moduleContext_
Definition: Consumer.h:136

Member Function Documentation

template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)

Definition at line 147 of file Consumer.h.

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

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)

Definition at line 172 of file Consumer.h.

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

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)

Definition at line 190 of file Consumer.h.

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

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)

Definition at line 215 of file Consumer.h.

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

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protected

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
void art::Consumer::setModuleDescription ( ModuleDescription const &  md)
protected

Definition at line 83 of file Consumer.cc.

Referenced by art::ResultsProducer::doBeginJob(), art::EDProducer::setModuleDescription(), art::EDFilter::setModuleDescription(), and art::EDAnalyzer::setModuleDescription().

84 {
85  moduleDescription_ = &md;
86 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
void art::Consumer::showMissingConsumes ( ) const
protected

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protected

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139

Friends And Related Function Documentation

friend class DataViewImpl
friend

Definition at line 118 of file Consumer.h.

Member Data Documentation

ConsumableProducts art::Consumer::consumables_ {}
private

Definition at line 138 of file Consumer.h.

ConsumableProductSets art::Consumer::missingConsumes_ {}
private

Definition at line 139 of file Consumer.h.

bool art::Consumer::moduleContext_ {true}
private

Definition at line 136 of file Consumer.h.

cet::exempt_ptr<ModuleDescription const> art::Consumer::moduleDescription_ {nullptr}
private

Definition at line 140 of file Consumer.h.

bool art::Consumer::requireConsumes_ {false}
private

Definition at line 137 of file Consumer.h.


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