User code should never do this.
174 const std::string pcr_filename =
"microboone-channel-responses-v1.json.bz2";
180 cerr <<
"testing with " <<
argv[1] <<
endl;
182 extvar[
"detector"] =
"uboone";
185 for (
auto jone : cfg) {
186 string the_type = jone[
"type"].asString();
187 if (the_type ==
"wclsChannelNoiseDB" || the_type ==
"OmniChannelNoiseDB") {
196 cerr <<
"testing with build in config text\n";
199 cfg[
"anode"] = anode_tns[0];
201 auto icfg = Factory::lookup_tn<IConfigurable>(
"OmniChannelNoiseDB");
202 auto def = icfg->default_configuration();
204 icfg->configure(cfg);
207 auto anode = Factory::find_tn<IAnodePlane>(anode_tns[0]);
208 const int nchannels = anode->channels().size();
210 auto idb = Factory::find_tn<IChannelNoiseDatabase>(
"OmniChannelNoiseDB");
212 gStyle->SetOptStat(0);
213 TCanvas canvas(
"canvas",
"canvas",500,500);
215 string pdfname = Form(
"%s.pdf",
argv[0]);
217 canvas.Print((pdfname+
"[").c_str(),
"pdf");
220 double tick = idb->sample_time();
221 cerr <<
"tick = " << tick/
units::us <<
" us.\n";
223 std::vector<std::string> scalar_names{
224 "nominal baseline",
"gain correction",
"response offset",
"pad window front",
"pad window back",
225 "min rms cut",
"max rms cut",
"rcrc sum",
"config sum",
"noise sum",
"response sum"};
227 const int nscalars = 11;
228 std::vector<TGraph*> scalars;
229 for (
int ind=0; ind<11; ++ind) { scalars.push_back(
new TGraph); }
230 for (
int ch=0; ch<nchannels; ++ch) {
231 scalars[0]->SetPoint(ch, ch, idb->nominal_baseline(ch));
232 scalars[1]->SetPoint(ch, ch, idb->gain_correction(ch));
233 scalars[2]->SetPoint(ch, ch, idb->response_offset(ch));
234 scalars[3]->SetPoint(ch, ch, idb->pad_window_front(ch));
235 scalars[4]->SetPoint(ch, ch, idb->pad_window_back(ch));
236 scalars[5]->SetPoint(ch, ch, idb->min_rms_cut(ch));
237 scalars[6]->SetPoint(ch, ch, idb->max_rms_cut(ch));
246 for (
size_t ind=0; ind<nscalars; ++ind) {
247 TGraph*
graph = scalars[ind];
248 graph->SetName(scalar_names[ind].c_str());
249 graph->SetLineColor(2);
250 graph->SetLineWidth(3);
253 auto frame = graph->GetHistogram();
254 frame->SetTitle(scalar_names[ind].c_str());
255 frame->GetXaxis()->SetTitle(
"channels");
256 canvas.Print(pdfname.c_str(),
"pdf");
259 canvas.Print((pdfname+
"]").c_str(),
"pdf");
Configuration update(Configuration &a, Configuration &b)
Merge dictionary b into a, return a.
const std::string config_text
def graph(desc, maker=maker)
std::map< std::string, std::string > externalvars_t
std::vector< std::string > anode_loader(std::string detector)
IFrame::pointer sum(std::vector< IFrame::pointer > frames, int ident)
Json::Value Configuration
QTextStream & endl(QTextStream &s)
def load(filename, jpath="depos")