116 const std::vector<double> gains = {7.8*
GUnit, 14.0*
GUnit};
123 cerr <<
"Using nticks=" << nticks <<
endl;
127 for (
size_t ind=0; ind<gains.size(); ++ind) {
131 const double tshape_us = shapings[ind]/
units::us;
132 auto tit = Form(
"Cold Electronics Response at %.0fus peaking",
146 auto tit =
"RC Response at 1ms time constant";
155 auto tit =
"RC Response at 1ms time constant (suppress delta)";
163 auto tit =
"Response Gaussian smear by default";
170 Binning ttt(nsigma*2*smear/tick, -nsigma*smear, nsigma*smear);
174 auto tit =
"Response Gaussian 2 us smear";
183 TGraph* timings[4] = {
184 new TGraph,
new TGraph,
new TGraph,
new TGraph
188 std::vector<int> nsampleslist{128, 256,
207 const int ntries = 1000;
208 for (
auto nsamps : nsampleslist) {
210 const Binning bins(nsamps, 0, maxtime);
214 double fwd_time = 0.0;
215 for (
int itry=0; itry<ntries; ++itry) {
223 double rev_time = 0.0;
224 for (
int itry=0; itry<ntries; ++itry) {
232 cerr <<
"DFT nsamples=" << nsamps
233 <<
"\n\tforward: " << fwd_time/1000.0 <<
" us, " << fwd_time/nsamps/1000.0 <<
" us/sample" 234 <<
"\n\treverse: " << rev_time/1000.0 <<
" us, " << rev_time/nsamps/1000.0 <<
" us/sample" 235 <<
"\n\taverage: " << 0.5*(fwd_time+rev_time)/1000.0 <<
" us" 238 cout <<
"timing " << nsamps <<
" " 239 << fwd_time/1000.0 <<
" " 240 << rev_time/1000.0 <<
"\n";
242 timings[0]->SetPoint(timings[0]->GetN(), nsamps, fwd_time);
243 timings[1]->SetPoint(timings[1]->GetN(), nsamps, fwd_time/nsamps);
244 timings[2]->SetPoint(timings[2]->GetN(), nsamps, rev_time);
245 timings[3]->SetPoint(timings[3]->GetN(), nsamps, rev_time/nsamps);
249 pdf.canvas.Divide(1,2);
251 auto text =
new TText;
253 auto pad = pdf.canvas.cd(1);
257 auto graph = timings[0];
258 auto frame =
graph->GetHistogram();
259 frame->SetTitle(
"Fwd/rev DFT timing (absolute)");
260 frame->GetXaxis()->SetTitle(
"number of samples");
261 frame->GetYaxis()->SetTitle(
"time (ns)");
262 timings[0]->Draw(
"AL");
263 timings[2]->Draw(
"L");
264 for (
int ind=0; ind<
graph->GetN(); ++ind) {
265 auto x =
graph->GetX()[ind];
266 auto y =
graph->GetY()[ind];
267 text->DrawText(
x,
y,Form(
"%.0f",
x));
272 auto pad = pdf.canvas.cd(2);
276 auto frame = timings[1]->GetHistogram();
277 frame->SetTitle(
"Fwd/rev DFT timing (relative)");
278 frame->GetXaxis()->SetTitle(
"number of samples");
279 frame->GetYaxis()->SetTitle(
"time per sample (ns/samp)");
280 timings[1]->Draw(
"AL");
281 timings[3]->Draw(
"L");
def graph(desc, maker=maker)
A functional object caching gain and shape.
Binning tbins(nticks, t0, t0+readout_time)
void draw_time_freq(MultiPdf &pdf, Waveform::realseq_t &res, const std::string &title, const Binning &tbins)
T gaus(T x, T amplitude, T mean, T sigma)
Tests GausssianFit object with a known input.
WireCell::Waveform::realseq_t generate(const WireCell::Waveform::Domain &domain, int nsamples)
FIXME: eradicate Domain in favor of Binning.
array_xxf idft(const array_xxc &arr)
array_xxc dft(const array_xxf &arr)
QTextStream & endl(QTextStream &s)
nanosecond nanoseconds
Alias for common language habits.