#include "WireCellUtil/Units.h"
#include "WireCellUtil/Testing.h"
#include "WireCellUtil/Exceptions.h"
#include "WireCellUtil/PluginManager.h"
#include "WireCellUtil/NamedFactory.h"
#include "WireCellIface/IChannelResponse.h"
#include "WireCellIface/IAnodePlane.h"
#include "WireCellIface/IConfigurable.h"
#include "TCanvas.h"
#include "TStyle.h"
#include "TH2F.h"
#include "TAxis.h"
#include "TFile.h"
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include "anode_loader.h"
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Finally, we now pretend to be real component code.
assume all responses in a plane are the same size.
Definition at line 33 of file test_perchanresp.cxx.
46 const std::string pcr_filename =
"microboone-channel-responses-v1.json.bz2";
50 auto icfg = Factory::lookup<IConfigurable>(cr_tn);
51 auto cfg = icfg->default_configuration();
52 cfg[
"filename"] = pcr_filename;
58 auto cr = Factory::find_tn<IChannelResponse>(cr_tn);
59 auto ap = Factory::find_tn<IAnodePlane>(ap_tn);
61 auto bins = cr->channel_response_binning();
62 cerr <<
"PerChannelResponse with binning: " << bins.nbins() <<
" bins " 63 <<
" with sample period " << bins.binsize()/
units::us <<
" us and bounds:" 66 std::vector<int> planechans[3];
67 for (
auto ch : ap->channels()) {
68 auto wpid = ap->resolve(ch);
69 planechans[wpid.index()].push_back(ch);
72 auto outfile = TFile::Open(Form(
"%s.root",
argv[0]),
"RECREATE");
74 gStyle->SetOptStat(0);
75 TCanvas
c(
"c",
"c",500,500);
81 for (
int iplane=0; iplane<3; ++iplane) {
86 const int nsamps = bins.nbins();
87 const double mintus = bins.min()/
units::us;
88 const double maxtus = bins.max()/
units::us;
95 TH2F*
hist =
new TH2F(Form(
"hist%d", iplane),
96 Form(
"Per Channel Response Plane %d [mV/fC]", iplane),
97 nsamps, mintus, maxtus,
100 hist->GetXaxis()->SetTitle(
"sample time (us)");
101 hist->GetYaxis()->SetTitle(
"channel indices");
103 for (
int ich=0; ich<nchans; ++ich) {
104 const auto& resp = cr->channel_response(
channels[ich]);
105 for (
int isamp=0; isamp<nsamps; ++isamp) {
106 const double Tus = bins.center(isamp)/
units::us;
107 hist->Fill(Tus, ich+0.5, resp[isamp]/GU);
116 cerr <<
"Now ROOT makes the PDF" <<
endl;
117 c.Print(Form(
"%s.pdf",
argv[0]),
"pdf");
std::vector< std::string > anode_loader(std::string detector)
QTextStream & endl(QTextStream &s)