Functions | Variables
anode_loader.h File Reference
#include "WireCellUtil/PluginManager.h"
#include "WireCellUtil/NamedFactory.h"
#include "WireCellUtil/Units.h"
#include "WireCellUtil/String.h"
#include "WireCellUtil/Exceptions.h"
#include "WireCellIface/IConfigurable.h"
#include "WireCellIface/IAnodePlane.h"
#include "WireCellIface/IFieldResponse.h"
#include "WireCellIface/IWireSchema.h"
#include <vector>
#include <string>

Go to the source code of this file.

Functions

void known_det (std::string maybe)
 
std::vector< std::stringanode_loader (std::string detector)
 

Variables

std::vector< std::stringknown_dets
 

Function Documentation

std::vector<std::string> anode_loader ( std::string  detector)

Definition at line 35 of file anode_loader.h.

36 {
37  known_det(detector);
38 
39  std::vector<std::string> ret;
40  {
41  int nanodes = 1;
42  // Note: these files must be located via WIRECELL_PATH
43  std::string ws_fname = "microboone-celltree-wires-v2.1.json.bz2";
44  std::string fr_fname = "ub-10-half.json.bz2";
45  if (detector == "uboone") {
46  ws_fname = "microboone-celltree-wires-v2.1.json.bz2";
47  fr_fname = "ub-10-half.json.bz2";
48  }
49  if (detector == "apa") {
50  ws_fname = "apa-wires.json.bz2";
51  fr_fname = "garfield-1d-3planes-21wires-6impacts-dune-v1.json.bz2";
52  }
53  if (detector == "protodune-larsoft") {
54  ws_fname = "protodune-wires-larsoft-v1.json.bz2";
55  fr_fname = "garfield-1d-3planes-21wires-6impacts-dune-v1.json.bz2";
56  nanodes = 6;
57  }
58 
60  pm.add("WireCellSigProc");
61  pm.add("WireCellGen");
62 
63  const std::string fr_tn = "FieldResponse";
64  const std::string ws_tn = "WireSchemaFile";
65 
66  {
67  auto icfg = Factory::lookup<IConfigurable>(fr_tn);
68  auto cfg = icfg->default_configuration();
69  cfg["filename"] = fr_fname;
70  icfg->configure(cfg);
71  }
72  {
73  auto icfg = Factory::lookup<IConfigurable>(ws_tn);
74  auto cfg = icfg->default_configuration();
75  cfg["filename"] = ws_fname;
76  icfg->configure(cfg);
77  }
78 
79  for (int ianode = 0; ianode < nanodes; ++ianode) {
80  std::string tn = String::format("AnodePlane:%d", ianode);
81  ret.push_back(tn);
82  cerr << "Configuring: " << tn << "\n";
83  auto icfg = Factory::lookup_tn<IConfigurable>(tn);
84  auto cfg = icfg->default_configuration();
85  cfg["ident"] = ianode;
86  cfg["wire_schema"] = ws_tn;
87  cfg["faces"][0]["response"] = 10*units::cm - 6*units::mm;
88  cfg["faces"][0]["cathode"] = 2.5604*units::m;
89  cerr << cfg<<endl;
90  icfg->configure(cfg);
91  }
92  }
93  return ret;
94 }
static const double m
Definition: Units.h:79
std::string string
Definition: nybbler.cc:12
const std::string instance
cfg
Definition: dbjson.py:29
void known_det(std::string maybe)
Definition: anode_loader.h:28
static const double mm
Definition: Units.h:73
static const double cm
Definition: Units.h:76
Plugin * add(const std::string &plugin_name, const std::string &libname="")
Add a plugin. If libname is not given, try to derive it.
QTextStream & endl(QTextStream &s)
void known_det ( std::string  maybe)

Definition at line 28 of file anode_loader.h.

29 {
30  for (auto det : known_dets) {
31  if (maybe == det) { return; }
32  }
33  THROW(ValueError() << errmsg{String::format("unknown detector: %s", maybe)});
34 }
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
#define THROW(e)
Definition: Exceptions.h:25
Thrown when a wrong value has been encountered.
Definition: Exceptions.h:37
std::vector< std::string > known_dets
Definition: anode_loader.h:25

Variable Documentation

std::vector<std::string> known_dets
Initial value:
= {
"uboone", "apa", "protodune-larsoft"
}

Definition at line 25 of file anode_loader.h.