114 const int ntbins = p0p0r.
current.size();
116 const double period = fr.
period;
117 const double pitch = p0r.
pitch;
120 std::vector<double> impacts;
121 std::vector<int> regions;
122 for (
auto path : p0r.
paths) {
123 const int region = round((path.pitchpos-0.001)/pitch);
124 const double impact = path.pitchpos - region*pitch;
126 impacts.push_back(impact);
129 regions.push_back(region);
132 sort(impacts.begin(), impacts.end());
133 sort(regions.begin(), regions.end());
135 int plane_colors[] = {2,4,1};
138 int nimpacts = impacts.size();
139 int nregions = regions.size();
140 std::vector<TH1F*>
hists[3];
141 for (
int iplane=0; iplane<3; ++iplane) {
142 hists[iplane].resize(nimpacts*nregions);
143 for (
int imp=0; imp<nimpacts; ++imp) {
145 int wire =
reg - nregions/2;
148 if (wire>0) { sign=
'+'; }
149 if (wire<0) { sign=
'-'; }
153 title = Form(
"Avg Response wire:%c%d", sign,
std::abs(wire));
156 title = Form(
"Fine Response wire:%c%d (impact=%.1f)", sign,
std::abs(wire), impacts[imp]);
159 TH1F*
h =
new TH1F(Form(
"h_%d_%d_%d", iplane, imp,
reg),
161 ntbins,
tstart, tstart + period*ntbins);
162 h->SetLineColor(plane_colors[iplane]);
163 hists[iplane][imp*nregions +
reg] =
h;
168 for (
auto plane : fr.
planes) {
169 int iplane = plane.planeid;
170 for (
auto path : plane.paths) {
172 const int region = round((path.pitchpos-0.001)/pitch);
173 const double impact = path.pitchpos - region*pitch;
176 for (
size_t ind=0; ind<impacts.size(); ++ind) {
177 if (
std::abs(impact-impacts[ind]) < 0.001) {
182 for (
size_t ind=0; ind<regions.size(); ++ind) {
183 if (
std::abs(region-regions[ind]) < 0.001) {
189 TH1F*
hist = hists[iplane][imp*nregions +
reg];
190 for (
int ind=0; ind<ntbins; ++ind) {
191 double value = response[ind];
192 hist->SetBinContent(ind+1, value);
199 mpdf.
canvas.Divide(1,nimpacts);
200 for (
int imp=0; imp<nimpacts; ++imp) {
202 double minval = 999,
maxval=-999;
203 for (
int iplane=0; iplane<3; ++iplane) {
204 TH1F* hist = hists[iplane][imp*nregions +
reg];
205 minval =
min(minval, hist->GetMinimum());
206 maxval =
max(maxval, hist->GetMaximum());
209 double extraval = 0.01*(maxval-minval);
210 for (
int iplane=0; iplane<3; ++iplane) {
211 TH1F* hist = hists[iplane][imp*nregions +
reg];
212 hist->SetMinimum(minval-extraval);
213 hist->SetMaximum(maxval+extraval);
225 for (
int imp=0; imp<nimpacts; ++imp) {
227 for (
int iplane=0; iplane<3; ++iplane) {
228 TH1F* hist = hists[iplane][imp*nregions +
reg];
230 hists[iplane][imp*nregions +
reg] =
nullptr;
double pitch
The pitch distance between neighboring wires.
double tstart
Time at which drift paths begin.
double period
The sampling period of the response function.
std::vector< PlaneResponse > planes
List of PlaneResponse objects.
static int max(int a, int b)
WireCell::Waveform::realseq_t current
An array holding the induced current for the path on the wire-of-interest.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
const GenericPointer< typename T::ValueType > T2 value
std::vector< PathResponse > paths
List of PathResponse objects.
cet::registry_via_id< success_t, val > reg
h
training ###############################