Classes | Public Types | Public 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 >
 
- Public Types inherited from art::OutputModule
using ModuleType = OutputModule
 
using WorkerType = OutputWorker
 
using PluginCollection_t = std::vector< std::unique_ptr< FileCatalogMetadataPlugin >>
 

Public Member Functions

 FileDumperOutput (Parameters const &)
 
- Public Member Functions inherited from art::OutputModule
virtual ~OutputModule () noexcept
 
 OutputModule (fhicl::ParameterSet const &pset)
 
 OutputModule (fhicl::TableFragment< Config > const &pset, fhicl::ParameterSet const &containing_pset)
 
 OutputModule (OutputModule const &)=delete
 
 OutputModule (OutputModule &&)=delete
 
OutputModuleoperator= (OutputModule const &)=delete
 
OutputModuleoperator= (OutputModule &&)=delete
 
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
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
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< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 
- Public Member Functions inherited from art::detail::SharedModule
 SharedModule ()
 
 SharedModule (std::string const &moduleLabel)
 
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain () const
 
std::set< std::string > const & sharedResources () const
 
void createQueues (SharedResources const &resources)
 
template<BranchType , typename... T>
void serialize (T const &...resources)
 
template<BranchType , typename... T>
void serializeExternal (T const &...resources)
 

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_
 

Additional Inherited Members

- Protected Member Functions inherited from art::OutputModule
virtual void doRegisterProducts (ProductDescriptions &, ModuleDescription const &)
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (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< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
- Protected Member Functions inherited from art::detail::SharedModule
template<BranchType BT = InEvent, typename... T>
void serialize (T const &...)
 
template<BranchType BT = InEvent, typename... T>
void serializeExternal (T const &...)
 
template<BranchType BT = InEvent>
void async ()
 

Detailed Description

Definition at line 93 of file FileDumperOutput_module.cc.

Member Typedef Documentation

using art::FileDumperOutput::Parameters = fhicl::WrappedTable<Config, OutputModule::Config::KeysToIgnore>

Definition at line 109 of file FileDumperOutput_module.cc.

Constructor & Destructor Documentation

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

Definition at line 133 of file FileDumperOutput_module.cc.

134  : OutputModule{ps().omConfig, ps.get_PSet()}
135  , wantProductFullClassName_{ps().wantProductFullClassName()}
136  , wantProductFriendlyClassName_{ps().wantProductFriendlyClassName()}
137  , wantProductID_{ps().wantProductID()}
138  , wantResolveProducts_{ps().resolveProducts()}
139  , wantPresentOnly_{ps().onlyIfPresent()}
140 {}
static constexpr double ps
Definition: Units.h:99
OutputModule(fhicl::ParameterSet const &pset)
Definition: OutputModule.cc:73

Member Function Documentation

template<typename P >
void art::FileDumperOutput::printPrincipal ( P const &  p)
private

Definition at line 168 of file FileDumperOutput_module.cc.

169 {
170  if (!p.size())
171  return;
172 
173  size_t present{0};
174  size_t not_present{0};
175  std::map<std::string, std::vector<detail::ProductInfo>> products;
176 
177  auto const& dinfo = dummyInfo();
178 
179  products[dummyProcess()].emplace_back(dinfo);
180 
181  for (auto const& pr : p) {
182  auto const& g = *pr.second;
183  auto const& pd = g.productDescription();
184  auto const& oh = p.getForOutput(pd.productID(), wantResolveProducts_);
185 
186  EDProduct const* product = oh.isValid() ? oh.wrapper() : nullptr;
187  bool const productPresent = product != nullptr && product->isPresent();
188 
189  if (productPresent) {
190  ++present;
191  } else {
192  ++not_present;
193  }
194 
195  if (!wantPresentOnly_ || productPresent) {
196  auto pi = detail::ProductInfo{pd.moduleLabel(),
197  pd.productInstanceName(),
198  pd.producedClassName(),
199  pd.friendlyClassName(),
200  std::to_string(pd.productID().value()),
201  product_size(product, productPresent)};
202  products[pd.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::product_id, dinfo.product_id),
220  columnWidth(products, &detail::ProductInfo::str_size, dinfo.str_size)};
221 
222  // Print banner
223  printProductInfo(widths, dummyProcess(), dummyInfo());
224  for (auto const& processConfig : p.processHistory()) {
225  auto const& processName = processConfig.processName();
226  for (auto const& pi : products[processName]) {
227  printProductInfo(widths, processName, pi);
228  }
229  }
230 
231  std::cout << "\nTotal products (present, not present): "
232  << present + not_present << " (" << present << ", " << not_present
233  << ").\n\n";
234 }
std::string const & processName() const
Definition: Observer.cc:68
static constexpr double g
Definition: Units.h:144
std::size_t columnWidth(T const &coll, std::string const Elem::*cp, std::string const &header)
void printProductInfo(std::vector< std::size_t > const &columnWidths, std::string const &processName, detail::ProductInfo const &pi) const
def move(depos, offset)
Definition: depos.py:107
p
Definition: test.py:223
std::string const & BranchTypeToString(BranchType const bt)
Definition: BranchType.cc:65
float pi
Definition: units.py:11
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
constexpr ProductStatus present() noexcept
Definition: ProductStatus.h:10
QTextStream & endl(QTextStream &s)
void art::FileDumperOutput::printProductInfo ( std::vector< std::size_t > const &  columnWidths,
std::string const &  processName,
detail::ProductInfo const &  pi 
) const
private

Definition at line 237 of file FileDumperOutput_module.cc.

240 {
241  std::ostringstream oss;
242  oss << cet::rpad(processName, widths[0], '.') << " | "
243  << cet::rpad(pi.module_label, widths[1], '.') << " | "
244  << cet::rpad(pi.instance_name, widths[2], '.') << " | ";
246  oss << cet::rpad(pi.product_type, widths[3], '.') << " | ";
247  }
249  oss << cet::rpad(pi.friendly_type, widths[4], '.') << " | ";
250  }
251  if (wantProductID_) {
252  oss << cet::rpad(pi.product_id, widths[5], '.') << " | ";
253  }
254  oss << cet::lpad(pi.str_size, widths[6], '.');
255  std::cout << oss.str() << '\n';
256 }
std::string const & processName() const
Definition: Observer.cc:68
std::string rpad(std::string const &pad_me, std::string::size_type wanted_size, char char_to_pad_with= ' ')
Definition: rpad.cc:10
std::string lpad(std::string const &pad_me, std::string::size_type wanted_size, char char_to_pad_with= ' ')
Definition: lpad.cc:10
float pi
Definition: units.py:11
void art::FileDumperOutput::readResults ( ResultsPrincipal const &  resp)
overrideprivatevirtual

Reimplemented from art::OutputModule.

Definition at line 161 of file FileDumperOutput_module.cc.

162 {
163  printPrincipal(resp);
164 }
void art::FileDumperOutput::write ( EventPrincipal e)
overrideprivatevirtual

Implements art::OutputModule.

Definition at line 143 of file FileDumperOutput_module.cc.

144 {
145  printPrincipal(e);
146 }
const double e
void art::FileDumperOutput::writeRun ( RunPrincipal r)
overrideprivatevirtual

Implements art::OutputModule.

Definition at line 149 of file FileDumperOutput_module.cc.

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

Implements art::OutputModule.

Definition at line 155 of file FileDumperOutput_module.cc.

156 {
158 }
static constexpr double sr
Definition: Units.h:166

Member Data Documentation

bool const art::FileDumperOutput::wantPresentOnly_
private

Definition at line 130 of file FileDumperOutput_module.cc.

bool const art::FileDumperOutput::wantProductFriendlyClassName_
private

Definition at line 127 of file FileDumperOutput_module.cc.

bool const art::FileDumperOutput::wantProductFullClassName_
private

Definition at line 126 of file FileDumperOutput_module.cc.

bool const art::FileDumperOutput::wantProductID_
private

Definition at line 128 of file FileDumperOutput_module.cc.

bool const art::FileDumperOutput::wantResolveProducts_
private

Definition at line 129 of file FileDumperOutput_module.cc.


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