All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Attributes | List of all members
wcls::WCLS Class Reference
Inheritance diagram for wcls::WCLS:
wcls::MainTool

Public Types

using Parameters = art::ToolConfigTable< WCLSConfig, WCLSKeysToIgnore >
 

Public Member Functions

 WCLS (Parameters const &ps)
 
virtual ~WCLS ()
 
void produces (art::ProducesCollector &collector)
 
void process (art::Event &event)
 Accept an event to process. More...
 
- Public Member Functions inherited from wcls::MainTool
virtual ~MainTool () noexcept=default
 

Private Attributes

WireCell::Main m_wcmain
 
wcls::IArtEventVisitor::vector m_inputers
 
wcls::IArtEventVisitor::vector m_outputers
 

Detailed Description

Definition at line 79 of file WCLS_tool.cc.

Member Typedef Documentation

using wcls::WCLS::Parameters = art::ToolConfigTable<WCLSConfig, WCLSKeysToIgnore>

Definition at line 81 of file WCLS_tool.cc.

Constructor & Destructor Documentation

wcls::WCLS::WCLS ( Parameters const &  ps)
explicit

Definition at line 103 of file WCLS_tool.cc.

104  : m_wcmain()
105 {
106  const auto& wclscfg = params();
107  WCLSConfig::optional_string_list_t::value_type slist;
108 
109  if (wclscfg.logsinks(slist)) {
110  for (auto logsink : slist) {
111  //std::cerr << "Log sink: \"" << logsink << "\"\n";
112  auto ls = WireCell::String::split(logsink, ":");
113  if (ls.size() == 2) {
114  m_wcmain.add_logsink(ls[0], ls[1]);
115  }
116  else {
117  m_wcmain.add_logsink(ls[0]);
118  }
119  }
120  }
121  slist.clear();
122  if (wclscfg.loglevels(slist)) {
123  for (auto loglevel : slist) {
124  //std::cerr << "Log level: \"" << loglevel << "\"\n";
125  auto ll = WireCell::String::split(loglevel, ":");
126  if (ll.size() == 2) {
127  m_wcmain.set_loglevel(ll[0], ll[1]);
128  }
129  else{
130  m_wcmain.set_loglevel("", ll[0]);
131  }
132  }
133  }
134  slist.clear();
135  WireCell::Log::set_pattern("[%H:%M:%S.%03e] %L [%^%=8n%$] %v");
136 
137  // transfer configuration
138 
139  // required
140 
141  for (auto cfg : wclscfg.configs()) {
142  m_wcmain.add_config(cfg);
143  }
144 
145  for (auto app : wclscfg.apps()) {
146  m_wcmain.add_app(app);
147  }
148 
149  for (auto plugin : wclscfg.plugins()) {
150  m_wcmain.add_plugin(plugin);
151  }
152 
153  // optional
154 
155  if (wclscfg.paths(slist)) {
156  for (auto path : slist) {
157  m_wcmain.add_path(path);
158  }
159  }
160  slist.clear();
161 
162 
163  {
164  fhicl::ParameterSet wcps;
165  if (wclscfg.params.get_if_present(wcps)) {
166  for (auto key : wcps.get_names()) {
167  auto value = wcps.get<std::string>(key);
168  m_wcmain.add_var(key, value);
169  }
170  }
171  }
172  {
173  fhicl::ParameterSet wcps;
174  if (wclscfg.structs.get_if_present(wcps)) {
175  for (auto key : wcps.get_names()) {
176  auto value = wcps.get<std::string>(key);
177  m_wcmain.add_code(key, value);
178  }
179  }
180  }
181 
182  //std::cerr << "Initialize Wire Cell\n";
183  try {
184  m_wcmain.initialize();
185  }
186  catch (WireCell::Exception& e) {
187  std::cerr << "Wire Cell Toolkit threw an exception\n";
188  auto msg = errstr(e);
189  std::cerr << msg << std::endl;
190  throw cet::exception("WireCellLArSoft") << msg;
191  }
192 
193 
194 
195  if (wclscfg.inputers(slist)) {
196  for (auto inputer : slist) {
197  auto iaev = WireCell::Factory::find_tn<IArtEventVisitor>(inputer);
198  m_inputers.push_back(iaev);
199  std::cerr << "Inputer: \"" << inputer << "\"\n";
200  }
201  }
202  slist.clear();
203  if (wclscfg.outputers(slist)) {
204  for (auto outputer : slist) {
205  auto iaev = WireCell::Factory::find_tn<IArtEventVisitor>(outputer);
206  m_outputers.push_back(iaev);
207  std::cerr << "Outputer: \"" << outputer << "\"\n";
208  }
209  }
210  slist.clear();
211 }
wcls::IArtEventVisitor::vector m_outputers
Definition: WCLS_tool.cc:95
BEGIN_PROLOG could also be cerr
then echo Invalid dCache scratch not copying back else ifdh ls
Definition: run_job.sh:111
BEGIN_PROLOG triggeremu_data_config_icarus settings PMTADCthresholds sequence::icarus_stage0_multiTPC_TPC physics sequence::icarus_stage0_EastHits_TPC physics sequence::icarus_stage0_WestHits_TPC physics producers purityana0 caloskimCalorimetryCryoE physics caloskimCalorimetryCryoW physics path
WireCell::Main m_wcmain
Definition: WCLS_tool.cc:94
wcls::IArtEventVisitor::vector m_inputers
Definition: WCLS_tool.cc:95
do i e
temporary value
virtual wcls::WCLS::~WCLS ( )
inlinevirtual

Definition at line 84 of file WCLS_tool.cc.

84 { }

Member Function Documentation

void wcls::WCLS::process ( art::Event &  event)
virtual

Accept an event to process.

Implements wcls::MainTool.

Definition at line 213 of file WCLS_tool.cc.

214 {
215  for (auto iaev : m_inputers) {
216  //std::cerr << "pre visit\n";
217  iaev->visit(event);
218  }
219 
220  //std::cerr << "Running Wire Cell Toolkit...\n";
221  m_wcmain();
222  //std::cerr << "... Wire Cell Toolkit done\n";
223 
224  for (auto iaev : m_outputers) {
225  //std::cerr << "post visit\n";
226  iaev->visit(event);
227  }
228 }
wcls::IArtEventVisitor::vector m_outputers
Definition: WCLS_tool.cc:95
WireCell::Main m_wcmain
Definition: WCLS_tool.cc:94
wcls::IArtEventVisitor::vector m_inputers
Definition: WCLS_tool.cc:95
void wcls::WCLS::produces ( art::ProducesCollector &  collector)
inlinevirtual

Accept a base producer. Typically needed in order to call prod.produces<Type>() for Type of any expected data products

Implements wcls::MainTool.

Definition at line 86 of file WCLS_tool.cc.

86  {
87  for (auto iaev : m_outputers) {
88  iaev->produces(collector);
89  }
90  }
wcls::IArtEventVisitor::vector m_outputers
Definition: WCLS_tool.cc:95

Member Data Documentation

wcls::IArtEventVisitor::vector wcls::WCLS::m_inputers
private

Definition at line 95 of file WCLS_tool.cc.

wcls::IArtEventVisitor::vector wcls::WCLS::m_outputers
private

Definition at line 95 of file WCLS_tool.cc.

WireCell::Main wcls::WCLS::m_wcmain
private

Definition at line 94 of file WCLS_tool.cc.


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