Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
art::FileDumperOutput Class Reference
Inheritance diagram for art::FileDumperOutput:
art::OutputModule art::EventObserverBase art::Consumer

Classes

struct  Config
 

Public Types

using Parameters = fhicl::WrappedTable< Config, OutputModule::Config::KeysToIgnore >
 
using ModuleType = OutputModule
 
using WorkerType = OutputWorker
 

Public Member Functions

 FileDumperOutput (Parameters const &)
 
int maxEvents () const
 
int remainingEvents () const
 
bool fileIsOpen () const
 
OutputFileStatus fileStatus () const
 
virtual std::string const & lastClosedFileName () const
 
bool selected (BranchDescription const &) const
 
SelectionsArray const & keptProducts () const
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
BranchChildren const & branchChildren () const
 
void selectProducts (ProductList const &)
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
bool modifiesEvent () const
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
ModuleDescription const & description () const
 
virtual void postSelectProducts ()
 
virtual void doRegisterProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
detail::CachedProductscachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

void write (EventPrincipal &e) override
 
void writeRun (RunPrincipal &r) override
 
void writeSubRun (SubRunPrincipal &sr) override
 
void readResults (ResultsPrincipal const &resp) override
 
template<typename P >
void printPrincipal (P const &p)
 
void printProductInfo (std::vector< std::size_t > const &columnWidths, std::string const &processName, detail::ProductInfo const &pi) const
 

Private Attributes

bool wantProductFullClassName_
 
bool wantProductFriendlyClassName_
 
bool wantResolveProducts_
 
bool wantPresentOnly_
 

Detailed Description

Definition at line 96 of file FileDumperOutput_module.cc.

Member Typedef Documentation

Definition at line 60 of file OutputModule.h.

Definition at line 111 of file FileDumperOutput_module.cc.

Definition at line 61 of file OutputModule.h.

Constructor & Destructor Documentation

art::FileDumperOutput::FileDumperOutput ( Parameters const &  ps)
explicit

Definition at line 134 of file FileDumperOutput_module.cc.

References fhicl::WrappedTable< T, KeysToIgnore >::get_PSet(), nd_projection_maker::ps, wantPresentOnly_, wantProductFriendlyClassName_, wantProductFullClassName_, and wantResolveProducts_.

136  : OutputModule{ps().omConfig, ps.get_PSet()}
137  , wantProductFullClassName_{ps().wantProductFullClassName()}
138  , wantProductFriendlyClassName_{ps().wantProductFriendlyClassName()}
139  , wantResolveProducts_{ps().resolveProducts()}
140  , wantPresentOnly_{ps().onlyIfPresent()}
141 {}
OutputModule(OutputModule const &)=delete

Member Function Documentation

art::BranchChildren const & art::OutputModule::branchChildren ( ) const
inlineinherited

Definition at line 347 of file OutputModule.h.

References art::OutputModule::branchChildren_.

Referenced by art::OutputModule::fileIsOpen().

348 {
349  return branchChildren_;
350 }
BranchChildren branchChildren_
Definition: OutputModule.h:170
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

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

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
art::CurrentProcessingContext const * art::OutputModule::currentContext ( ) const
inlineprotectedinherited

Definition at line 303 of file OutputModule.h.

References art::OutputModule::current_context_, and cet::exempt_ptr< Element >::get().

Referenced by art::OutputModule::fileIsOpen().

304 {
305  return current_context_.get();
306 }
pointer get() const noexcept
Definition: exempt_ptr.h:146
cet::exempt_ptr< CurrentProcessingContext const > current_context_
Definition: OutputModule.h:165
art::ModuleDescription const & art::OutputModule::description ( ) const
inlineprotectedinherited
virtual void art::OutputModule::doRegisterProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
protectedvirtualinherited

Reimplemented in art::RootOutput.

Referenced by art::OutputModule::fileIsOpen().

bool art::OutputModule::fileIsOpen ( ) const
inlineinherited
OutputFileStatus art::OutputModule::fileStatus ( ) const
inherited
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
auto art::OutputModule::hasNewlyDroppedBranch ( ) const
inlineinherited
auto art::OutputModule::keptProducts ( ) const
inlineinherited

Definition at line 334 of file OutputModule.h.

References art::OutputModule::keptProducts_.

Referenced by art::OutputModule::fileIsOpen().

335 {
336  return keptProducts_;
337 }
SelectionsArray keptProducts_
Definition: OutputModule.h:156
virtual std::string const& art::OutputModule::lastClosedFileName ( ) const
virtualinherited

Reimplemented in art::RootOutput.

Referenced by art::OutputModule::fileIsOpen().

int art::OutputModule::maxEvents ( ) const
inlineinherited

Definition at line 315 of file OutputModule.h.

References art::OutputModule::maxEvents_.

316 {
317  return maxEvents_;
318 }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

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

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
virtual void art::OutputModule::postSelectProducts ( )
protectedvirtualinherited

Reimplemented in art::RootOutput.

Referenced by art::OutputModule::fileIsOpen().

void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
template<typename P >
void art::FileDumperOutput::printPrincipal ( P const &  p)
private

Definition at line 169 of file FileDumperOutput_module.cc.

References art::BranchTypeToString(), art::detail::columnWidth(), om::cout, allTimeWatchdog::endl, art::detail::ProductInfo::friendly_type, MECModelEnuComparisons::g, art::detail::ProductInfo::instance_name, art::EDProduct::isPresent(), art::detail::ProductInfo::module_label, python.hepunit::pi, gammaraytel::pr, art::productstatus::present(), printProductInfo(), art::EventObserverBase::processName(), stan::io::product(), art::detail::ProductInfo::product_type, datagram_client::products, art::detail::ProductInfo::str_size, wantPresentOnly_, and wantResolveProducts_.

Referenced by readResults(), write(), writeRun(), and writeSubRun().

170 {
171  if (!p.size())
172  return;
173 
174  size_t present{0};
175  size_t not_present{0};
176  std::map<std::string, std::vector<detail::ProductInfo>> products;
177 
178  auto const& dinfo = dummyInfo();
179 
180  products[dummyProcess()].emplace_back(dinfo);
181 
182  for (auto const& pr : p) {
183  auto const& g = *pr.second;
184  auto const& oh =
185  p.getForOutput(g.productDescription().productID(), wantResolveProducts_);
186 
187  EDProduct const* product = oh.isValid() ? oh.wrapper() : nullptr;
188  bool const productPresent = product != nullptr && product->isPresent();
189 
190  if (productPresent) {
191  ++present;
192  } else {
193  ++not_present;
194  }
195 
196  if (!wantPresentOnly_ || productPresent) {
197  auto pi = detail::ProductInfo{g.moduleLabel(),
198  g.productInstanceName(),
199  g.productDescription().producedClassName(),
200  g.productDescription().friendlyClassName(),
201  product_size(product, productPresent)};
202  products[g.processName()].emplace_back(std::move(pi));
203  }
204  }
205 
206  std::cout << "PRINCIPAL TYPE: " << BranchTypeToString(p.branchType())
207  << std::endl;
208 
209  std::vector<std::size_t> const widths{
210  columnWidthFirst(products, dummyProcess()),
211  columnWidth(
212  products, &detail::ProductInfo::module_label, dinfo.module_label),
213  columnWidth(
214  products, &detail::ProductInfo::instance_name, dinfo.instance_name),
215  columnWidth(
216  products, &detail::ProductInfo::product_type, dinfo.product_type),
217  columnWidth(
218  products, &detail::ProductInfo::friendly_type, dinfo.friendly_type),
219  columnWidth(products, &detail::ProductInfo::str_size, dinfo.str_size)};
220 
221  // Print banner
222  printProductInfo(widths, dummyProcess(), dummyInfo());
223  for (auto const& processConfig : p.processHistory()) {
224  auto const& processName = processConfig.processName();
225  for (auto const& pi : products[processName]) {
226  printProductInfo(widths, processName, pi);
227  }
228  }
229 
230  std::cout << "\nTotal products (present, not present): "
231  << present + not_present << " (" << present << ", " << not_present
232  << ").\n\n";
233 }
std::size_t columnWidth(T const &coll, std::string const Elem::*cp, std::string const &header)
const char * p
Definition: xmltok.h:285
void printProductInfo(std::vector< std::size_t > const &columnWidths, std::string const &processName, detail::ProductInfo const &pi) const
OStream cout
Definition: OStream.cxx:6
T product(std::vector< T > dims)
std::string const & BranchTypeToString(BranchType)
std::string const & processName() const
constexpr ProductStatus present() noexcept
Definition: ProductStatus.h:10
void art::FileDumperOutput::printProductInfo ( std::vector< std::size_t > const &  columnWidths,
std::string const &  processName,
detail::ProductInfo const &  pi 
) const
private

Definition at line 236 of file FileDumperOutput_module.cc.

References om::cout, DEFINE_ART_MODULE(), art::detail::ProductInfo::friendly_type, art::detail::ProductInfo::instance_name, cet::lpad(), art::detail::ProductInfo::module_label, art::detail::ProductInfo::product_type, cet::rpad(), art::detail::ProductInfo::str_size, wantProductFriendlyClassName_, and wantProductFullClassName_.

Referenced by printPrincipal().

239 {
240  std::ostringstream oss;
241  oss << cet::rpad(processName, widths[0], '.') << " | "
242  << cet::rpad(pi.module_label, widths[1], '.') << " | "
243  << cet::rpad(pi.instance_name, widths[2], '.') << " | ";
245  oss << cet::rpad(pi.product_type, widths[3], '.') << " | ";
247  oss << cet::rpad(pi.friendly_type, widths[4], '.') << " | ";
248  oss << cet::lpad(pi.str_size, widths[5], '.');
249  std::cout << oss.str() << '\n';
250 }
std::string rpad(std::string const &pad_me, std::string::size_type wanted_size, char char_to_pad_with= ' ')
std::string lpad(std::string const &pad_me, std::string::size_type wanted_size, char char_to_pad_with= ' ')
OStream cout
Definition: OStream.cxx:6
std::string const & processName() const
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited

Definition at line 41 of file EventObserverBase.h.

References art::EventObserverBase::process_name_.

Referenced by printPrincipal(), and art::RootOutput::RootOutput().

42  {
43  return process_name_;
44  }
void art::FileDumperOutput::readResults ( ResultsPrincipal const &  resp)
overrideprivatevirtual

Reimplemented from art::OutputModule.

Definition at line 162 of file FileDumperOutput_module.cc.

References printPrincipal().

163 {
164  printPrincipal(resp);
165 }
void art::OutputModule::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inherited
int art::OutputModule::remainingEvents ( ) const
inlineinherited

Definition at line 321 of file OutputModule.h.

References art::OutputModule::remainingEvents_.

Referenced by art::RootOutput::respondToOpenInputFile().

322 {
323  return remainingEvents_;
324 }
bool art::OutputModule::selected ( BranchDescription const &  pd) const
inlineinherited

Definition at line 327 of file OutputModule.h.

References ana::assert(), and art::OutputModule::groupSelector_.

Referenced by art::OutputModule::fileIsOpen().

328 {
330  return groupSelector_->selected(pd);
331 }
std::unique_ptr< GroupSelector const > groupSelector_
Definition: OutputModule.h:160
assert(nhit_max >=nhit_nbins)
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::OutputModule::selectProducts ( ProductList const &  )
inherited
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

Referenced by art::RootOutput::RootOutput().

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
void art::FileDumperOutput::write ( EventPrincipal e)
overrideprivatevirtual

Implements art::OutputModule.

Definition at line 144 of file FileDumperOutput_module.cc.

References printPrincipal().

145 {
146  printPrincipal(e);
147 }
Float_t e
Definition: plot.C:35
void art::FileDumperOutput::writeRun ( RunPrincipal r)
overrideprivatevirtual

Implements art::OutputModule.

Definition at line 150 of file FileDumperOutput_module.cc.

References printPrincipal().

151 {
152  printPrincipal(r);
153 }
TRandom3 r(0)
void art::FileDumperOutput::writeSubRun ( SubRunPrincipal sr)
overrideprivatevirtual

Implements art::OutputModule.

Definition at line 156 of file FileDumperOutput_module.cc.

References printPrincipal().

157 {
159 }
caf::StandardRecord * sr

Member Data Documentation

bool art::FileDumperOutput::wantPresentOnly_
private

Definition at line 131 of file FileDumperOutput_module.cc.

Referenced by FileDumperOutput(), and printPrincipal().

bool art::FileDumperOutput::wantProductFriendlyClassName_
private

Definition at line 129 of file FileDumperOutput_module.cc.

Referenced by FileDumperOutput(), and printProductInfo().

bool art::FileDumperOutput::wantProductFullClassName_
private

Definition at line 128 of file FileDumperOutput_module.cc.

Referenced by FileDumperOutput(), and printProductInfo().

bool art::FileDumperOutput::wantResolveProducts_
private

Definition at line 130 of file FileDumperOutput_module.cc.

Referenced by FileDumperOutput(), and printPrincipal().


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