Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
gen
test
anode_loader.h
Go to the documentation of this file.
1
// DO NO USE
2
//
3
// This code should not be considered for any user examples. This
4
// reproduces some internal configuration stuff so that units tests
5
// need not specify a configuration file.
6
//
7
8
#include "
WireCellUtil/PluginManager.h
"
9
#include "
WireCellUtil/NamedFactory.h
"
10
#include "
WireCellUtil/Units.h
"
11
#include "
WireCellUtil/String.h
"
12
#include "
WireCellUtil/Exceptions.h
"
13
14
#include "
WireCellIface/IConfigurable.h
"
15
#include "
WireCellIface/IAnodePlane.h
"
16
#include "
WireCellIface/IFieldResponse.h
"
17
#include "
WireCellIface/IWireSchema.h
"
18
19
#include <vector>
20
#include <string>
21
22
using namespace
WireCell
;
23
using namespace
std
;
24
25
std::vector<std::string>
known_dets
= {
26
"uboone"
,
"apa"
,
"protodune-larsoft"
27
};
28
void
known_det
(
std::string
maybe)
29
{
30
for
(
auto
det : known_dets) {
31
if
(maybe == det) {
return
; }
32
}
33
THROW
(
ValueError
() <<
errmsg
{
String::format
(
"unknown detector: %s"
, maybe)});
34
}
35
std::vector<std::string>
anode_loader
(
std::string
detector)
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
59
PluginManager
&
pm
=
PluginManager::instance
();
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
}
WireCell::units::m
static const double m
Definition:
Units.h:63
NamedFactory.h
Exceptions.h
string
std::string string
Definition:
nybbler.cc:12
WireCell::errmsg
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition:
Exceptions.h:54
std
STL namespace.
IConfigurable.h
dbjson.cfg
cfg
Definition:
dbjson.py:29
WireCell::PluginManager::instance
static PluginManager & instance()
Definition:
PluginManager.cxx:26
anode_loader
std::vector< std::string > anode_loader(std::string detector)
Definition:
anode_loader.h:35
THROW
#define THROW(e)
Definition:
Exceptions.h:25
known_det
void known_det(std::string maybe)
Definition:
anode_loader.h:28
WireCell::units::cm
static const double cm
Definition:
Units.h:59
WireCell::ValueError
Thrown when a wrong value has been encountered.
Definition:
Exceptions.h:37
WireCell::units::mm
static const double mm
Definition:
Units.h:55
WireCell::String::format
std::string format(const std::string &form, TYPES...objs)
Definition:
String.h:45
WireCell
Definition:
Main.h:22
IWireSchema.h
IAnodePlane.h
PluginManager.h
known_dets
std::vector< std::string > known_dets
Definition:
anode_loader.h:25
WireCell::PluginManager::add
Plugin * add(const std::string &plugin_name, const std::string &libname="")
Add a plugin. If libname is not given, try to derive it.
Definition:
PluginManager.cxx:32
IFieldResponse.h
ResimTags.pm
pm
Definition:
ResimTags.py:94
String.h
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Units.h
WireCell::PluginManager
Definition:
PluginManager.h:32
Generated by
1.8.11