Classes | Public Types | 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::Observer art::detail::SharedModule art::ModuleBase

Classes

struct  Config
 

Public Types

using Parameters = fhicl::WrappedTable< Config, OutputModule::Config::KeysToIgnore >
 
using ModuleType = OutputModule
 
using WorkerType = OutputWorker
 
using PluginCollection_t = std::vector< std::unique_ptr< FileCatalogMetadataPlugin >>
 

Public Member Functions

 FileDumperOutput (Parameters const &)
 
int maxEvents () const
 
int remainingEvents () const
 
bool fileIsOpen () const
 
OutputFileStatus fileStatus () const
 
virtual std::string const & lastClosedFileName () const
 
SelectionsArray const & keptProducts () const
 
bool selected (BranchDescription const &) const
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
void selectProducts (ProductTables const &)
 
void doSelectProducts (ProductTables const &)
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
BranchChildren const & branchChildren () const
 
void fillDescriptions (ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< TconsumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< TmayConsumeView (InputTag const &tag)
 
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain () const
 
void createQueues ()
 
template<BranchType BT = InEvent, typename... T>
void serialize (T const &...)
 
template<BranchType , typename... T>
void serialize (T const &...resources)
 
template<BranchType BT = InEvent, typename... T>
void serializeExternal (T const &...)
 
template<BranchType , typename... T>
void serializeExternal (T const &...resources)
 
template<BranchType BT = InEvent>
void async ()
 

Protected Member Functions

virtual void doRegisterProducts (ProductDescriptions &, ModuleDescription const &)
 
detail::ProcessAndEventSelectorsprocessAndEventSelectors ()
 
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

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 const wantProductFullClassName_
 
bool const wantProductFriendlyClassName_
 
bool const wantProductID_
 
bool const wantResolveProducts_
 
bool const wantPresentOnly_
 

Detailed Description

Definition at line 101 of file FileDumperOutput_module.cc.

Member Typedef Documentation

Definition at line 59 of file OutputModule.h.

Definition at line 117 of file FileDumperOutput_module.cc.

using art::OutputModule::PluginCollection_t = std::vector<std::unique_ptr<FileCatalogMetadataPlugin>>
inherited

Definition at line 63 of file OutputModule.h.

Definition at line 60 of file OutputModule.h.

Constructor & Destructor Documentation

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

Definition at line 141 of file FileDumperOutput_module.cc.

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

142  : OutputModule{ps().omConfig, ps.get_PSet()}
143  , wantProductFullClassName_{ps().wantProductFullClassName()}
144  , wantProductFriendlyClassName_{ps().wantProductFriendlyClassName()}
145  , wantProductID_{ps().wantProductID()}
146  , wantResolveProducts_{ps().resolveProducts()}
147  , wantPresentOnly_{ps().onlyIfPresent()}
148 {}
OutputModule(fhicl::ParameterSet const &pset)

Member Function Documentation

template<BranchType BT = InEvent>
void art::detail::SharedModule::async ( )
inlineinherited

Definition at line 33 of file SharedModule.h.

References art::detail::SharedModule::asyncDeclared_, art::detail::SharedModule::implicit_serialize(), art::InEvent, art::detail::SharedModule::serialize_for(), art::detail::SharedModule::serialize_for_external(), string, and T.

34  {
35  static_assert(
36  BT == InEvent,
37  "async is currently supported only for the 'InEvent' level.");
38  asyncDeclared_ = true;
39  }
BranchChildren const& art::OutputModule::branchChildren ( ) const
inherited
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 55 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumes(), T, and getGoodRuns4SAM::tag.

56  {
57  return collector_.consumes<T, BT>(tag);
58  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ProductToken< T > consumes(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ConsumesCollector& art::ModuleBase::consumesCollector ( )
protectedinherited
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 69 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesMany(), and T.

70  {
71  collector_.consumesMany<T, BT>();
72  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 62 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesView(), T, and getGoodRuns4SAM::tag.

63  {
64  return collector_.consumesView<T, BT>(tag);
65  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > consumesView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
void art::detail::SharedModule::createQueues ( )
inherited
virtual void art::OutputModule::doRegisterProducts ( ProductDescriptions ,
ModuleDescription const &   
)
protectedvirtualinherited
void art::OutputModule::doSelectProducts ( ProductTables const &  )
inherited
bool art::OutputModule::fileIsOpen ( ) const
inherited
OutputFileStatus art::OutputModule::fileStatus ( ) const
inherited
void art::Observer::fillDescriptions ( ModuleDescription const &  )
inherited
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
Handle<TriggerResults> art::Observer::getTriggerResults ( Event const &  e) const
inherited
std::array<bool, NumBranchTypes> const& art::OutputModule::hasNewlyDroppedBranch ( ) const
inherited
SelectionsArray const& art::OutputModule::keptProducts ( ) const
inherited
virtual std::string const& art::OutputModule::lastClosedFileName ( ) const
virtualinherited
int art::OutputModule::maxEvents ( ) const
inherited
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 76 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsume(), T, and getGoodRuns4SAM::tag.

77  {
78  return collector_.mayConsume<T, BT>(tag);
79  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 90 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeMany(), and T.

91  {
93  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 83 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeView(), T, and getGoodRuns4SAM::tag.

84  {
85  return collector_.mayConsumeView<T, BT>(tag);
86  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > mayConsumeView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ModuleDescription const& art::ModuleBase::moduleDescription ( ) const
inherited
template<typename P >
void art::FileDumperOutput::printPrincipal ( P const &  p)
private

Definition at line 176 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::Observer::processName(), art::detail::ProductInfo::product_id, art::detail::ProductInfo::product_type, datagram_client::products, art::detail::ProductInfo::str_size, art::to_string(), wantPresentOnly_, and wantResolveProducts_.

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

177 {
178  if (!p.size())
179  return;
180 
181  size_t present{0};
182  size_t not_present{0};
183  std::map<std::string, std::vector<detail::ProductInfo>> products;
184 
185  auto const& dinfo = dummyInfo();
186 
187  products[dummyProcess()].emplace_back(dinfo);
188 
189  for (auto const& pr : p) {
190  auto const& g = *pr.second;
191  auto const& pd = g.productDescription();
192  auto const& oh = p.getForOutput(pd.productID(), wantResolveProducts_);
193 
194  EDProduct const* product = oh.isValid() ? oh.wrapper() : nullptr;
195  bool const productPresent = product != nullptr && product->isPresent();
196 
197  if (productPresent) {
198  ++present;
199  } else {
200  ++not_present;
201  }
202 
203  if (!wantPresentOnly_ || productPresent) {
204  auto pi = detail::ProductInfo{pd.moduleLabel(),
205  pd.productInstanceName(),
206  pd.producedClassName(),
207  pd.friendlyClassName(),
208  std::to_string(pd.productID().value()),
209  product_size(product, productPresent)};
210  products[pd.processName()].emplace_back(std::move(pi));
211  }
212  }
213 
214  std::cout << "PRINCIPAL TYPE: " << BranchTypeToString(p.branchType())
215  << std::endl;
216 
217  std::vector<std::size_t> const widths{
218  columnWidthFirst(products, dummyProcess()),
219  columnWidth(
220  products, &detail::ProductInfo::module_label, dinfo.module_label),
221  columnWidth(
222  products, &detail::ProductInfo::instance_name, dinfo.instance_name),
223  columnWidth(
224  products, &detail::ProductInfo::product_type, dinfo.product_type),
225  columnWidth(
226  products, &detail::ProductInfo::friendly_type, dinfo.friendly_type),
227  columnWidth(products, &detail::ProductInfo::product_id, dinfo.product_id),
228  columnWidth(products, &detail::ProductInfo::str_size, dinfo.str_size)};
229 
230  // Print banner
231  printProductInfo(widths, dummyProcess(), dummyInfo());
232  for (auto const& processConfig : p.processHistory()) {
233  auto const& processName = processConfig.processName();
234  for (auto const& pi : products[processName]) {
235  printProductInfo(widths, processName, pi);
236  }
237  }
238 
239  std::cout << "\nTotal products (present, not present): "
240  << present + not_present << " (" << present << ", " << not_present
241  << ").\n\n";
242 }
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
std::string const & processName() const
std::string const & BranchTypeToString(BranchType)
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
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 245 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_id, art::detail::ProductInfo::product_type, cet::rpad(), art::detail::ProductInfo::str_size, wantProductFriendlyClassName_, wantProductFullClassName_, and wantProductID_.

Referenced by printPrincipal().

248 {
249  std::ostringstream oss;
250  oss << cet::rpad(processName, widths[0], '.') << " | "
251  << cet::rpad(pi.module_label, widths[1], '.') << " | "
252  << cet::rpad(pi.instance_name, widths[2], '.') << " | ";
254  oss << cet::rpad(pi.product_type, widths[3], '.') << " | ";
255  }
257  oss << cet::rpad(pi.friendly_type, widths[4], '.') << " | ";
258  }
259  if (wantProductID_) {
260  oss << cet::rpad(pi.product_id, widths[5], '.') << " | ";
261  }
262  oss << cet::lpad(pi.str_size, widths[6], '.');
263  std::cout << oss.str() << '\n';
264 }
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
detail::ProcessAndEventSelectors& art::Observer::processAndEventSelectors ( )
protectedinherited
std::string const& art::Observer::processName ( ) const
inherited

Referenced by printPrincipal().

void art::FileDumperOutput::readResults ( ResultsPrincipal const &  resp)
overrideprivatevirtual

Reimplemented from art::OutputModule.

Definition at line 169 of file FileDumperOutput_module.cc.

References printPrincipal().

170 {
171  printPrincipal(resp);
172 }
void art::OutputModule::registerProducts ( ProductDescriptions ,
ModuleDescription const &   
)
inherited
int art::OutputModule::remainingEvents ( ) const
inherited
bool art::OutputModule::selected ( BranchDescription const &  ) const
inherited
fhicl::ParameterSetID art::Observer::selectorConfig ( ) const
inherited
void art::OutputModule::selectProducts ( ProductTables const &  )
inherited
template<BranchType BT = InEvent, typename... T>
void art::detail::SharedModule::serialize ( T const &  ...)
inherited
template<BranchType , typename... T>
void art::detail::SharedModule::serialize ( T const &...  resources)
inherited

Definition at line 79 of file SharedModule.h.

References art::detail::SharedModule::serialize_for_resource(), and T.

80  {
81  serialize_for_resource(resources...);
82  }
void serialize_for_resource(T const &...t)
Definition: SharedModule.h:48
template<BranchType BT = InEvent, typename... T>
void art::detail::SharedModule::serializeExternal ( T const &  ...)
inherited
template<BranchType , typename... T>
void art::detail::SharedModule::serializeExternal ( T const &...  resources)
inherited

Definition at line 86 of file SharedModule.h.

References art::detail::SharedModule::serialize_for_external_resource().

87  {
88  serialize_for_external_resource(resources...);
89  }
void serialize_for_external_resource(T const &...t)
Definition: SharedModule.h:61
hep::concurrency::SerialTaskQueueChain* art::detail::SharedModule::serialTaskQueueChain ( ) const
inherited
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
bool art::Observer::wantAllEvents ( ) const
inherited
bool art::Observer::wantEvent ( Event const &  e)
inherited
void art::FileDumperOutput::write ( EventPrincipal e)
overrideprivatevirtual

Implements art::OutputModule.

Definition at line 151 of file FileDumperOutput_module.cc.

References printPrincipal().

152 {
153  printPrincipal(e);
154 }
Float_t e
Definition: plot.C:35
void art::FileDumperOutput::writeRun ( RunPrincipal r)
overrideprivatevirtual

Implements art::OutputModule.

Definition at line 157 of file FileDumperOutput_module.cc.

References printPrincipal().

158 {
159  printPrincipal(r);
160 }
TRandom3 r(0)
void art::FileDumperOutput::writeSubRun ( SubRunPrincipal sr)
overrideprivatevirtual

Implements art::OutputModule.

Definition at line 163 of file FileDumperOutput_module.cc.

References printPrincipal().

164 {
166 }
caf::StandardRecord * sr

Member Data Documentation

bool const art::FileDumperOutput::wantPresentOnly_
private

Definition at line 138 of file FileDumperOutput_module.cc.

Referenced by FileDumperOutput(), and printPrincipal().

bool const art::FileDumperOutput::wantProductFriendlyClassName_
private

Definition at line 135 of file FileDumperOutput_module.cc.

Referenced by FileDumperOutput(), and printProductInfo().

bool const art::FileDumperOutput::wantProductFullClassName_
private

Definition at line 134 of file FileDumperOutput_module.cc.

Referenced by FileDumperOutput(), and printProductInfo().

bool const art::FileDumperOutput::wantProductID_
private

Definition at line 136 of file FileDumperOutput_module.cc.

Referenced by FileDumperOutput(), and printProductInfo().

bool const art::FileDumperOutput::wantResolveProducts_
private

Definition at line 137 of file FileDumperOutput_module.cc.

Referenced by FileDumperOutput(), and printPrincipal().


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