-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.html
892 lines (865 loc) · 75 KB
/
main.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.3.197">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="Christian Haack">
<meta name="description" content="This document summarizes the simulation of the R14374 PMT and the digitization electronics.">
<title>P-ONE PMT Properties & Simulation</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<script src="main_files/libs/clipboard/clipboard.min.js"></script>
<script src="main_files/libs/quarto-html/quarto.js"></script>
<script src="main_files/libs/quarto-html/popper.min.js"></script>
<script src="main_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="main_files/libs/quarto-html/anchor.min.js"></script>
<link href="main_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="main_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="main_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="main_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="main_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script async="" src="https://hypothes.is/embed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" integrity="sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
<script type="application/javascript">define('jquery', [],function() {return window.jQuery;})</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
</head>
<body>
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<nav id="TOC" role="doc-toc" class="toc-active">
<h2 id="toc-title">Table of contents</h2>
<ul class="collapse">
<li><a href="#pmt-simulation" id="toc-pmt-simulation" class="nav-link active" data-scroll-target="#pmt-simulation">PMT Simulation</a>
<ul class="collapse">
<li><a href="#simulation-code" id="toc-simulation-code" class="nav-link" data-scroll-target="#simulation-code">Simulation Code</a></li>
<li><a href="#pulse-shape" id="toc-pulse-shape" class="nav-link" data-scroll-target="#pulse-shape">Pulse Shape</a></li>
<li><a href="#transit-time" id="toc-transit-time" class="nav-link" data-scroll-target="#transit-time">Transit Time</a></li>
<li><a href="#spe-distribution" id="toc-spe-distribution" class="nav-link" data-scroll-target="#spe-distribution">SPE Distribution</a></li>
<li><a href="#pmt-pulses" id="toc-pmt-pulses" class="nav-link" data-scroll-target="#pmt-pulses">PMT Pulses</a></li>
<li><a href="#waveforms" id="toc-waveforms" class="nav-link" data-scroll-target="#waveforms">Waveforms</a></li>
<li><a href="#unfolding" id="toc-unfolding" class="nav-link" data-scroll-target="#unfolding">Unfolding</a></li>
<li><a href="#timing-study" id="toc-timing-study" class="nav-link" data-scroll-target="#timing-study">Timing Study</a></li>
<li><a href="#double-pulse-study" id="toc-double-pulse-study" class="nav-link" data-scroll-target="#double-pulse-study">Double Pulse Study</a></li>
</ul></li>
</ul>
</nav>
</div>
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">P-ONE PMT Properties & Simulation</h1>
</div>
<div>
<div class="description">
<p>This document summarizes the simulation of the <a href="https://p-one.atlassian.net/wiki/spaces/PONE/pages/31260673/Photomultiplier+Tube+-+Design+Documentation">R14374 PMT</a> and the digitization electronics.</p>
</div>
</div>
<div class="quarto-title-meta-author">
<div class="quarto-title-meta-heading">Author</div>
<div class="quarto-title-meta-heading">Affiliation</div>
<div class="quarto-title-meta-contents">
<p class="author">Christian Haack </p>
</div>
<div class="quarto-title-meta-contents">
<p class="affiliation">
<a href="https://www.ph.nat.tum.de/cosmic-particles/experimental-physics-with-cosmic-particles/">
ECP, TU Munich
</a>
</p>
</div>
</div>
<div class="quarto-title-meta">
</div>
</header>
<section id="pmt-simulation" class="level1">
<h1>PMT Simulation</h1>
<section id="simulation-code" class="level2">
<h2 class="anchored" data-anchor-id="simulation-code">Simulation Code</h2>
<p>The PMT simulation is implemented in the <a href="https://github.com/PLEnuM-group/PMTSimulation.jl">PMTSimulation.jl</a> julia package.</p>
</section>
<section id="pulse-shape" class="level2">
<h2 class="anchored" data-anchor-id="pulse-shape">Pulse Shape</h2>
<p>The PMT pulse shape is modelled by a gumbel distribution: <span class="math display">\[
p(t) = \frac{1}{b} \exp \left (- \frac{(x-a)}{b} - e^{-\frac{(x-a)}{b}} \right )
\]</span> with parameters:</p>
<div class="cell" data-execution_count="2">
<div class="cell-output cell-output-stdout">
<pre><code>a=10.00, b=1.94, FWHM=6.0ns</code></pre>
</div>
</div>
<div class="cell" data-execution_count="3">
<div class="cell-output cell-output-display" data-execution_count="23">
<div id="fig-pulseshape" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-pulseshape-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 1: Pulse shape of unfiltered (blue) and filtered (125MHz LPF, yellow)</figcaption><p></p>
</figure>
</div>
</div>
</div>
<p><a href="#fig-pulseshape">Figure 1</a> shows the pulse shape and the filtered pulse after applying a 125Mhz low pass filter (LPF). The (unshifted) Gumbel distribution has a non-zero contribution for <span class="math inline">\(x<0\)</span>, thus the distribution is shifted by an arbitrary location parameter. This shift is later compensated in the transit time.</p>
</section>
<section id="transit-time" class="level2">
<h2 class="anchored" data-anchor-id="transit-time">Transit Time</h2>
</section>
<section id="spe-distribution" class="level2">
<h2 class="anchored" data-anchor-id="spe-distribution">SPE Distribution</h2>
<p>The SPE distribution is modelled as a mixture of a truncated normal distribution and an exponential distribution: <span class="math display">\[ p(q) = a \cdot \frac{1}{\sqrt{2\pi\sigma^2}} \exp \left ( -\frac{(q-\mu)^2}{\sigma^2} \right ) + (1-a)\cdot \frac{1}{\theta}\exp \left( - \frac{q}{\theta}\right)\]</span></p>
<div class="cell" data-execution_count="4">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">lines</span>(<span class="fl">0</span><span class="op">:</span><span class="fl">0.01</span><span class="op">:</span><span class="fl">5</span>, x <span class="op">-></span> <span class="fu">pdf</span>(spe_d, x),</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> axis<span class="op">=</span>(; title<span class="op">=</span><span class="st">"SPE Distribution"</span>, xlabel<span class="op">=</span><span class="st">"Charge (PE)"</span>, ylabel<span class="op">=</span><span class="st">"PDF"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="24">
<div id="fig-spedist" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-spedist-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 2: SPE Distribution</figcaption><p></p>
</figure>
</div>
</div>
</div>
</section>
<section id="pmt-pulses" class="level2">
<h2 class="anchored" data-anchor-id="pmt-pulses">PMT Pulses</h2>
<p>The PMT pulse amplitude (in units of PE) is drawn from the SPE distribution:</p>
<div class="cell" data-execution_count="5">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>charges <span class="op">=</span> <span class="fu">rand</span>(spe_d, <span class="fl">1000</span>)</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="fu">hist</span>(charges, axis<span class="op">=</span>(; xlabel<span class="op">=</span><span class="st">"Charge (PE)"</span>, ylabel<span class="op">=</span><span class="st">"Counts"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="25">
<div id="fig-spedist-sampl" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-spedist-sampl-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 3: Sampled SPE Distribution</figcaption><p></p>
</figure>
</div>
</div>
</div>
</section>
<section id="waveforms" class="level2">
<h2 class="anchored" data-anchor-id="waveforms">Waveforms</h2>
<section id="pulse-series" class="level3">
<h3 class="anchored" data-anchor-id="pulse-series">Pulse Series</h3>
<p>Pulse series are a collection of pulses at timestamps <span class="math inline">\(t_1, \ldots, t_n\)</span> with charges <span class="math inline">\(q_1, \ldots, q_n\)</span>. Evaluating the pulse series corresponds to the analog output signal of the PMT:</p>
<div class="cell" data-execution_count="6">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>pulse_series <span class="op">=</span> <span class="fu">PulseSeries</span>([<span class="fl">0</span>, <span class="fl">5</span>, <span class="fl">10</span>], [<span class="fl">1</span>, <span class="fl">5</span>, <span class="fl">1</span>], pmt_config.pulse_model)</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a>eval_grid <span class="op">=</span> <span class="op">-</span><span class="fl">5</span><span class="op">:</span><span class="fl">0.05</span><span class="op">:</span><span class="fl">25</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a>eval_ps <span class="op">=</span> <span class="fu">evaluate_pulse_series</span>(eval_grid, pulse_series)</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a>fig, ax <span class="op">=</span> <span class="fu">lines</span>(eval_grid, eval_ps, axis<span class="op">=</span>(; xlabel<span class="op">=</span><span class="st">"Time (ns)"</span>, ylabel<span class="op">=</span><span class="st">"Amplitude (mV)"</span>))</span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (t, q) <span class="kw">in</span> pulse_series</span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">lines!</span>(ax, eval_grid, x <span class="op">-></span> q <span class="op">*</span> <span class="fu">evaluate_pulse_template</span>(pmt_config.pulse_model, t, x))</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a>fig</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="26">
<div id="fig-ps-example" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-ps-example-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 4: PMT signal (black) for three pulses (colored) at times 0ns, 5ns and 10ns with charges 1PE, 5PE and 1PE</figcaption><p></p>
</figure>
</div>
</div>
</div>
</section>
<section id="raw-waveforms" class="level3">
<h3 class="anchored" data-anchor-id="raw-waveforms">Raw Waveforms</h3>
<p>Raw waveforms are created by evaluating the pulse series with a given sampling frequency and adding gaussian white noise on top:</p>
<div class="cell" data-execution_count="7">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>waveform <span class="op">=</span> <span class="fu">Waveform</span>(pulse_series, pmt_config.sampling_freq, pmt_config.noise_amp)</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="fu">lines</span>(waveform.timestamps, waveform.values, axis<span class="op">=</span>(; xlabel<span class="op">=</span><span class="st">"Time (ns)"</span>, ylabel<span class="op">=</span><span class="st">"Amplitude (mV)"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="27">
<div id="fig-wf-example" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-wf-example-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 5: Raw Waveform for three pulses at times 0ns, 5ns and 10ns with charges 1PE, 5PE and 1PE</figcaption><p></p>
</figure>
</div>
</div>
</div>
</section>
<section id="waveform-digitization" class="level3">
<h3 class="anchored" data-anchor-id="waveform-digitization">Waveform digitization</h3>
<p>Waveforms are digitized in multiple steps:</p>
<ol type="1">
<li>Applying a filter (125MHz LPF) to the waveform</li>
<li>Resampling the waveform with a given digitizer frequency</li>
<li>Quantizing the waveform values with given digitizer levels</li>
</ol>
<div class="cell" data-execution_count="8">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>digi_wg <span class="op">=</span> <span class="fu">digitize_waveform</span>(</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> waveform,</span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> pmt_config.sampling_freq,</span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> pmt_config.adc_freq,</span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a> pmt_config.lp_filter,</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a> yrange<span class="op">=</span>pmt_config.adc_dyn_range,</span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a> yres_bits<span class="op">=</span>pmt_config.adc_bits)</span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a>fig, ax <span class="op">=</span> <span class="fu">lines</span>(</span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a> waveform.timestamps, waveform.values,</span>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a> axis<span class="op">=</span>(; xlabel<span class="op">=</span><span class="st">"Time (ns)"</span>, ylabel<span class="op">=</span><span class="st">"Amplitude (mV)"</span>), label<span class="op">=</span><span class="st">"Raw Waveform"</span>)</span>
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a><span class="fu">lines!</span>(ax, digi_wg.timestamps, digi_wg.values, label<span class="op">=</span><span class="st">"Digitized Waveform"</span>)</span>
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a>fig</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="28">
<div id="fig-digiwf-example" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-digiwf-example-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 6: Digitized Waveform for three pulses at times 0ns, 5ns and 10ns with charges 1PE, 5PE and 1PE</figcaption><p></p>
</figure>
</div>
</div>
</div>
</section>
<section id="dynamic-range" class="level3">
<h3 class="anchored" data-anchor-id="dynamic-range">Dynamic range</h3>
<p>We can test the effect of the dynamic range on small pulses. <a href="#fig-digiwf-small-pulse">Figure 7</a> shows the digitized waveform for pulses with charges [0.1, 0.2, 0.3, 0.4] PE, with 12bits in a range of (0, 1)V. <a href="#fig-digiwf-small-pulse-threev">Figure 8</a> shows the waveform with 12bits in a range of (0, 3)V.</p>
<div class="cell" data-execution_count="9">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>pulse_series <span class="op">=</span> <span class="fu">PulseSeries</span>([<span class="fl">0</span>, <span class="fl">20</span>, <span class="fl">40</span>, <span class="fl">60</span>], [<span class="fl">0.1</span>, <span class="fl">0.2</span>, <span class="fl">0.3</span>, <span class="fl">0.4</span>], pmt_config.pulse_model)</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a>waveform <span class="op">=</span> <span class="fu">Waveform</span>(pulse_series, pmt_config.sampling_freq, pmt_config.noise_amp)</span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a>fig <span class="op">=</span> <span class="fu">Figure</span>()</span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a>ax <span class="op">=</span> <span class="fu">Axis</span>(fig[<span class="fl">1</span>, <span class="fl">1</span>], xlabel<span class="op">=</span><span class="st">"Time (ns)"</span>, ylabel<span class="op">=</span><span class="st">"Amplitude (mV)"</span>)</span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a>eval_grid <span class="op">=</span> <span class="op">-</span><span class="fl">50</span><span class="op">:</span><span class="fl">0.05</span><span class="op">:</span><span class="fl">150</span></span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a>p1 <span class="op">=</span> <span class="cn">nothing</span></span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (t, q) <span class="kw">in</span> pulse_series</span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true" tabindex="-1"></a> p1 <span class="op">=</span> <span class="fu">lines!</span>(ax, eval_grid, x <span class="op">-></span> q <span class="op">*</span> <span class="fu">evaluate_pulse_template</span>(pmt_config.pulse_model, t, x), color<span class="op">=:</span>tomato)</span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a>digi_wg <span class="op">=</span> <span class="fu">digitize_waveform</span>(</span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a> waveform,</span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true" tabindex="-1"></a> pmt_config.sampling_freq,</span>
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true" tabindex="-1"></a> pmt_config.adc_freq,</span>
<span id="cb7-18"><a href="#cb7-18" aria-hidden="true" tabindex="-1"></a> pmt_config.lp_filter,</span>
<span id="cb7-19"><a href="#cb7-19" aria-hidden="true" tabindex="-1"></a> yrange<span class="op">=</span>pmt_config.adc_dyn_range,</span>
<span id="cb7-20"><a href="#cb7-20" aria-hidden="true" tabindex="-1"></a> yres_bits<span class="op">=</span>pmt_config.adc_bits)</span>
<span id="cb7-21"><a href="#cb7-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-22"><a href="#cb7-22" aria-hidden="true" tabindex="-1"></a>p2 <span class="op">=</span> <span class="fu">lines!</span>(ax, digi_wg.timestamps, digi_wg.values, label<span class="op">=</span><span class="st">"Digitized Waveform"</span>, linewidth<span class="op">=</span><span class="fl">2</span>)</span>
<span id="cb7-23"><a href="#cb7-23" aria-hidden="true" tabindex="-1"></a>bins <span class="op">=</span> <span class="fu">adc_bins</span>(pmt_config.adc_dyn_range, pmt_config.adc_bits)</span>
<span id="cb7-24"><a href="#cb7-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-25"><a href="#cb7-25" aria-hidden="true" tabindex="-1"></a>p3 <span class="op">=</span> <span class="fu">hlines!</span>(ax, bins[<span class="fl">1</span><span class="op">:</span><span class="fl">15</span>], color<span class="op">=</span>(<span class="op">:</span>black, <span class="fl">0.5</span>), linestyle<span class="op">=:</span>dot, label<span class="op">=</span><span class="st">"ADC Levels"</span>)</span>
<span id="cb7-26"><a href="#cb7-26" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-27"><a href="#cb7-27" aria-hidden="true" tabindex="-1"></a><span class="fu">Legend</span>(fig[<span class="fl">1</span>, <span class="fl">2</span>], [p1, p2, p3], [<span class="st">"Pulses"</span>, <span class="st">"Digitized Waveform"</span>, <span class="st">"ADC Levels"</span>])</span>
<span id="cb7-28"><a href="#cb7-28" aria-hidden="true" tabindex="-1"></a>fig</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="29">
<div id="fig-digiwf-small-pulse" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-digiwf-small-pulse-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 7: Digitized Waveform for three pulses at times 0ns, 5ns and 10ns with charges 1PE, 5PE and 1PE</figcaption><p></p>
</figure>
</div>
</div>
</div>
<div class="callout callout-style-default callout-note callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>Note that the dynamic range is typically defined as ratio between the smallest and largest value which can be assumed by the signal.</p>
<div class="cell" data-execution_count="10">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">println</span>(<span class="fu">format</span>(<span class="st">"DNR for 12 bits in ({:.0f}, {:.0f}): {:.2f}"</span>, pmt_config.adc_dyn_range<span class="op">...</span>, <span class="fl">10</span> <span class="op">*</span> <span class="fu">log10</span>(bins[<span class="fl">2</span>] <span class="op">/</span> bins[<span class="kw">end</span>])))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>DNR for 12 bits in (0, 1000): -36.12</code></pre>
</div>
</div>
</div>
</div>
<div class="cell" data-execution_count="11">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>fig <span class="op">=</span> <span class="fu">Figure</span>()</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a>ax <span class="op">=</span> <span class="fu">Axis</span>(fig[<span class="fl">1</span>, <span class="fl">1</span>], xlabel<span class="op">=</span><span class="st">"Time (ns)"</span>, ylabel<span class="op">=</span><span class="st">"Amplitude (mV)"</span>)</span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a>eval_grid <span class="op">=</span> <span class="op">-</span><span class="fl">50</span><span class="op">:</span><span class="fl">0.05</span><span class="op">:</span><span class="fl">150</span></span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a>p1 <span class="op">=</span> <span class="cn">nothing</span></span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (t, q) <span class="kw">in</span> pulse_series</span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a> p1 <span class="op">=</span> <span class="fu">lines!</span>(ax, eval_grid, x <span class="op">-></span> q <span class="op">*</span> <span class="fu">evaluate_pulse_template</span>(pmt_config.pulse_model, t, x), color<span class="op">=:</span>tomato)</span>
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-10"><a href="#cb10-10" aria-hidden="true" tabindex="-1"></a>digi_wg <span class="op">=</span> <span class="fu">digitize_waveform</span>(</span>
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true" tabindex="-1"></a> waveform,</span>
<span id="cb10-12"><a href="#cb10-12" aria-hidden="true" tabindex="-1"></a> pmt_config.sampling_freq,</span>
<span id="cb10-13"><a href="#cb10-13" aria-hidden="true" tabindex="-1"></a> pmt_config.adc_freq,</span>
<span id="cb10-14"><a href="#cb10-14" aria-hidden="true" tabindex="-1"></a> pmt_config.lp_filter,</span>
<span id="cb10-15"><a href="#cb10-15" aria-hidden="true" tabindex="-1"></a> yrange<span class="op">=</span>(<span class="fl">0.0</span>, <span class="fl">3000.0</span>),</span>
<span id="cb10-16"><a href="#cb10-16" aria-hidden="true" tabindex="-1"></a> yres_bits<span class="op">=</span>pmt_config.adc_bits)</span>
<span id="cb10-17"><a href="#cb10-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-18"><a href="#cb10-18" aria-hidden="true" tabindex="-1"></a>p2 <span class="op">=</span> <span class="fu">lines!</span>(ax, digi_wg.timestamps, digi_wg.values, label<span class="op">=</span><span class="st">"Digitized Waveform"</span>, linewidth<span class="op">=</span><span class="fl">2</span>)</span>
<span id="cb10-19"><a href="#cb10-19" aria-hidden="true" tabindex="-1"></a>bins <span class="op">=</span> <span class="fu">adc_bins</span>((<span class="fl">0.0</span>, <span class="fl">3000.0</span>), pmt_config.adc_bits)</span>
<span id="cb10-20"><a href="#cb10-20" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-21"><a href="#cb10-21" aria-hidden="true" tabindex="-1"></a>p3 <span class="op">=</span> <span class="fu">hlines!</span>(ax, bins[<span class="fl">1</span><span class="op">:</span><span class="fl">5</span>], color<span class="op">=</span>(<span class="op">:</span>black, <span class="fl">0.5</span>), linestyle<span class="op">=:</span>dot, label<span class="op">=</span><span class="st">"ADC Levels"</span>)</span>
<span id="cb10-22"><a href="#cb10-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-23"><a href="#cb10-23" aria-hidden="true" tabindex="-1"></a><span class="fu">Legend</span>(fig[<span class="fl">1</span>, <span class="fl">2</span>], [p1, p2, p3], [<span class="st">"Pulses"</span>, <span class="st">"Digitized Waveform"</span>, <span class="st">"ADC Levels"</span>])</span>
<span id="cb10-24"><a href="#cb10-24" aria-hidden="true" tabindex="-1"></a>fig</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="31">
<div id="fig-digiwf-small-pulse-threev" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-digiwf-small-pulse-threev-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 8: Digitized Waveform for three pulses at times 0ns, 5ns and 10ns with charges 1PE, 5PE and 1PE</figcaption><p></p>
</figure>
</div>
</div>
</div>
</section>
</section>
<section id="unfolding" class="level2">
<h2 class="anchored" data-anchor-id="unfolding">Unfolding</h2>
<p>Pulses are unfolded from digitized waveforms using non-negative least squares (NNLS). Pulse templates (PMT pulses after they have passed through the digitization chain) are placed on a fine time grid, with resolution smaller than the expected time resolution. The resulting summed signal is fitted to the digitized waveform, yielding a <code>charge</code> (scaling factor) for each pulse template which best matches the waveform. Pulses with small charges (<span class="math inline">\(<0.1\)</span> PE) are cut out. <a href="#fig-unfolding">Figure 9</a> shows an example of such an unfolding.</p>
<div class="cell" data-execution_count="12">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>ps <span class="op">=</span> <span class="fu">PulseSeries</span>([<span class="fl">5.0</span>], [<span class="fl">1.0</span>], pmt_config.pulse_model)</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a>digi_wf <span class="op">=</span> <span class="fu">digitize_waveform</span>(ps, pmt_config.sampling_freq, pmt_config.adc_freq, pmt_config.noise_amp, pmt_config.lp_filter, time_range<span class="op">=</span>[<span class="op">-</span><span class="fl">10</span>, <span class="fl">50</span>], yrange<span class="op">=</span>(<span class="fl">0.0</span>, <span class="fl">1000.0</span>),)</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a>unfolded <span class="op">=</span> <span class="fu">unfold_waveform</span>(digi_wf, pmt_config.pulse_model_filt, pmt_config.unf_pulse_res, <span class="fl">0.3</span>, <span class="op">:</span>nnls)</span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a>reco <span class="op">=</span> <span class="fu">PulseSeries</span>(unfolded.times, unfolded.charges, pmt_config.pulse_model)</span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a>ts <span class="op">=</span> <span class="op">-</span><span class="fl">20</span><span class="op">:</span><span class="fl">0.1</span><span class="op">:</span><span class="fl">50</span></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a>fig, ax <span class="op">=</span> <span class="fu">lines</span>(ts, <span class="fu">evaluate_pulse_series</span>(ts, ps), label<span class="op">=</span><span class="st">"Original Pulse"</span>,</span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true" tabindex="-1"></a> axis<span class="op">=</span>(; xlabel<span class="op">=</span><span class="st">"Time (ns)"</span>, ylabel<span class="op">=</span><span class="st">"Amplitude (mV)"</span>))</span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a><span class="fu">lines!</span>(ax, digi_wf.timestamps, digi_wf.values, label<span class="op">=</span><span class="st">"Digitized Pulse"</span>)</span>
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a><span class="fu">lines!</span>(ax, ts, <span class="fu">evaluate_pulse_series</span>(ts, reco), label<span class="op">=</span><span class="st">"Reconstructed Pulse"</span>)</span>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-13"><a href="#cb11-13" aria-hidden="true" tabindex="-1"></a><span class="fu">Legend</span>(fig[<span class="fl">1</span>, <span class="fl">2</span>], ax)</span>
<span id="cb11-14"><a href="#cb11-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-15"><a href="#cb11-15" aria-hidden="true" tabindex="-1"></a>fig</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="32">
<div id="fig-unfolding" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-unfolding-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 9: Pulse unfolding for a 1PE pulse.</figcaption><p></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-execution_count="13">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>pulse_charges <span class="op">=</span> [<span class="fl">0.1</span>, <span class="fl">0.2</span>, <span class="fl">0.3</span>, <span class="fl">0.5</span>, <span class="fl">1</span>, <span class="fl">5</span>, <span class="fl">10</span>, <span class="fl">50</span>, <span class="fl">100</span>]</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a>dyn_ranges_end <span class="op">=</span> (<span class="fl">100.0</span>, <span class="fl">1000.0</span>, <span class="fl">3000.0</span>) <span class="co"># mV</span></span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a>data_unf_res <span class="op">=</span> []</span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (dr_end, c) <span class="kw">in</span> <span class="fu">product</span>(dyn_ranges_end, pulse_charges)</span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> pulse_times <span class="op">=</span> <span class="fu">rand</span>(<span class="fu">Uniform</span>(<span class="fl">0</span>, <span class="fl">10</span>), <span class="fl">500</span>)</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a> noise_amp <span class="op">=</span> <span class="fu">find_noise_scale</span>(<span class="fl">0.6</span>, (<span class="fl">0</span>, dr_end), adc_bits)</span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> t <span class="kw">in</span> pulse_times</span>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a> ps <span class="op">=</span> <span class="fu">PulseSeries</span>([t], [c], pmt_config.pulse_model)</span>
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a> digi_wf <span class="op">=</span> <span class="fu">digitize_waveform</span>(ps, pmt_config.sampling_freq, pmt_config.adc_freq, noise_amp, pmt_config.lp_filter, time_range<span class="op">=</span>[<span class="op">-</span><span class="fl">10</span>, <span class="fl">50</span>], yrange<span class="op">=</span>(<span class="fl">0.0</span>, dr_end),)</span>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a> unfolded <span class="op">=</span> <span class="fu">unfold_waveform</span>(digi_wf, pmt_config.pulse_model_filt, pmt_config.unf_pulse_res, <span class="fl">0.1</span>, <span class="op">:</span>nnls)</span>
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="fu">length</span>(unfolded) <span class="op">></span> <span class="fl">0</span></span>
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a> amax <span class="op">=</span> <span class="fu">sortperm</span>(unfolded.charges)[<span class="kw">end</span>]</span>
<span id="cb12-15"><a href="#cb12-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-16"><a href="#cb12-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">push!</span>(data_unf_res, (dr_end<span class="op">=</span>dr_end, charge<span class="op">=</span>c, time<span class="op">=</span>t, reco_time<span class="op">=</span>unfolded.times[amax], reco_charge<span class="op">=</span><span class="fu">sum</span>(unfolded.charges)))</span>
<span id="cb12-17"><a href="#cb12-17" aria-hidden="true" tabindex="-1"></a> <span class="cf">end</span></span>
<span id="cb12-18"><a href="#cb12-18" aria-hidden="true" tabindex="-1"></a> <span class="cf">end</span></span>
<span id="cb12-19"><a href="#cb12-19" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb12-20"><a href="#cb12-20" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-21"><a href="#cb12-21" aria-hidden="true" tabindex="-1"></a>data_unf_res_low_noise <span class="op">=</span> []</span>
<span id="cb12-22"><a href="#cb12-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-23"><a href="#cb12-23" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (dr_end, c) <span class="kw">in</span> <span class="fu">product</span>(dyn_ranges_end, pulse_charges)</span>
<span id="cb12-24"><a href="#cb12-24" aria-hidden="true" tabindex="-1"></a> pulse_times <span class="op">=</span> <span class="fu">rand</span>(<span class="fu">Uniform</span>(<span class="fl">0</span>, <span class="fl">10</span>), <span class="fl">100</span>)</span>
<span id="cb12-25"><a href="#cb12-25" aria-hidden="true" tabindex="-1"></a> noise_amp <span class="op">=</span> <span class="fu">find_noise_scale</span>(<span class="fl">0.6</span>, (<span class="fl">0</span>, dr_end), adc_bits)</span>
<span id="cb12-26"><a href="#cb12-26" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> t <span class="kw">in</span> pulse_times</span>
<span id="cb12-27"><a href="#cb12-27" aria-hidden="true" tabindex="-1"></a> ps <span class="op">=</span> <span class="fu">PulseSeries</span>([t], [c], pmt_config_high_sampl.pulse_model)</span>
<span id="cb12-28"><a href="#cb12-28" aria-hidden="true" tabindex="-1"></a> digi_wf <span class="op">=</span> <span class="fu">digitize_waveform</span>(ps, pmt_config_high_sampl.sampling_freq, pmt_config_high_sampl.adc_freq, noise_amp, pmt_config_high_sampl.lp_filter, time_range<span class="op">=</span>[<span class="op">-</span><span class="fl">10</span>, <span class="fl">50</span>], yrange<span class="op">=</span>(<span class="fl">0.0</span>, dr_end),)</span>
<span id="cb12-29"><a href="#cb12-29" aria-hidden="true" tabindex="-1"></a> unfolded <span class="op">=</span> <span class="fu">unfold_waveform</span>(digi_wf, pmt_config_high_sampl.pulse_model_filt, pmt_config_high_sampl.unf_pulse_res, <span class="fl">0.1</span>, <span class="op">:</span>nnls)</span>
<span id="cb12-30"><a href="#cb12-30" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="fu">length</span>(unfolded) <span class="op">></span> <span class="fl">0</span></span>
<span id="cb12-31"><a href="#cb12-31" aria-hidden="true" tabindex="-1"></a> amax <span class="op">=</span> <span class="fu">sortperm</span>(unfolded.charges)[<span class="kw">end</span>]</span>
<span id="cb12-32"><a href="#cb12-32" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-33"><a href="#cb12-33" aria-hidden="true" tabindex="-1"></a> <span class="fu">push!</span>(data_unf_res_low_noise, (dr_end<span class="op">=</span>dr_end, charge<span class="op">=</span>c, time<span class="op">=</span>t, reco_time<span class="op">=</span>unfolded.times[amax], reco_charge<span class="op">=</span><span class="fu">sum</span>(unfolded.charges)))</span>
<span id="cb12-34"><a href="#cb12-34" aria-hidden="true" tabindex="-1"></a> <span class="cf">end</span></span>
<span id="cb12-35"><a href="#cb12-35" aria-hidden="true" tabindex="-1"></a> <span class="cf">end</span></span>
<span id="cb12-36"><a href="#cb12-36" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb12-37"><a href="#cb12-37" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-38"><a href="#cb12-38" aria-hidden="true" tabindex="-1"></a>data_unf_res_low_noise <span class="op">=</span> <span class="fu">DataFrame</span>(data_unf_res_low_noise)</span>
<span id="cb12-39"><a href="#cb12-39" aria-hidden="true" tabindex="-1"></a>data_unf_res_low_noise[<span class="op">:</span>, <span class="op">:</span>dt] <span class="op">=</span> data_unf_res_low_noise[<span class="op">:</span>, <span class="op">:</span>reco_time] <span class="op">-</span> data_unf_res_low_noise[<span class="op">:</span>, <span class="op">:</span>time]</span>
<span id="cb12-40"><a href="#cb12-40" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-41"><a href="#cb12-41" aria-hidden="true" tabindex="-1"></a>time_res_low_noise <span class="op">=</span> <span class="fu">combine</span>(<span class="fu">groupby</span>(data_unf_res_low_noise, [<span class="op">:</span>charge, <span class="op">:</span>dr_end]), <span class="op">:</span>dt <span class="op">=></span> mean, <span class="op">:</span>dt <span class="op">=></span> std, <span class="op">:</span>dt <span class="op">=></span> iqr)</span>
<span id="cb12-42"><a href="#cb12-42" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-43"><a href="#cb12-43" aria-hidden="true" tabindex="-1"></a>data_unf_res <span class="op">=</span> <span class="fu">DataFrame</span>(data_unf_res)</span>
<span id="cb12-44"><a href="#cb12-44" aria-hidden="true" tabindex="-1"></a>data_unf_res[<span class="op">:</span>, <span class="op">:</span>dt] <span class="op">=</span> data_unf_res[<span class="op">:</span>, <span class="op">:</span>reco_time] <span class="op">-</span> data_unf_res[<span class="op">:</span>, <span class="op">:</span>time]</span>
<span id="cb12-45"><a href="#cb12-45" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-46"><a href="#cb12-46" aria-hidden="true" tabindex="-1"></a>time_res <span class="op">=</span> <span class="fu">combine</span>(<span class="fu">groupby</span>(data_unf_res, [<span class="op">:</span>charge, <span class="op">:</span>dr_end]), <span class="op">:</span>dt <span class="op">=></span> mean, <span class="op">:</span>dt <span class="op">=></span> std, <span class="op">:</span>dt <span class="op">=></span> iqr)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section>
<section id="timing-study" class="level2">
<h2 class="anchored" data-anchor-id="timing-study">Timing Study</h2>
<p>To test the impact of the digitization chain on the timing resolution, we can conduct a study with pulses for different charges and different settings of the dynamic range and the noise rate. <a href="#fig-time-res">Figure 10</a> summarizes the results. <a href="#fig-dt-dist">Figure 11</a> shows the time difference distribution for one simulation set. Note, that this simulation does not include the SPE distribution. The noise level (in units of ADC counts) assumed in the following studies is:</p>
<div class="cell" data-execution_count="14">
<div class="cell-output cell-output-stdout">
<pre><code>Noise level: 0.600 counts </code></pre>
</div>
</div>
<div class="cell" data-execution_count="15">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>colors <span class="op">=</span> Makie.<span class="fu">wong_colors</span>()</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a>fig <span class="op">=</span> <span class="fu">Figure</span>()</span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a>ax <span class="op">=</span> <span class="fu">Axis</span>(fig[<span class="fl">1</span>, <span class="fl">1</span>], xscale<span class="op">=</span>log10, xlabel<span class="op">=</span><span class="st">"Pulse Charge (PE)"</span>, ylabel<span class="op">=</span><span class="st">"Time Resolution [IQR] (ns)"</span>)</span>
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-7"><a href="#cb14-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-8"><a href="#cb14-8" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (i, (grpkey, grp)) <span class="kw">in</span> <span class="fu">enumerate</span>(<span class="fu">pairs</span>(<span class="fu">groupby</span>(time_res, <span class="op">:</span>dr_end)))</span>
<span id="cb14-9"><a href="#cb14-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">lines!</span>(ax, grp[<span class="op">:</span>, <span class="op">:</span>charge], grp[<span class="op">:</span>, <span class="op">:</span>dt_iqr], label<span class="op">=</span><span class="fu">string</span>(grpkey[<span class="fl">1</span>]), color<span class="op">=</span>colors[i])</span>
<span id="cb14-10"><a href="#cb14-10" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb14-11"><a href="#cb14-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-12"><a href="#cb14-12" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (i, (grpkey, grp)) <span class="kw">in</span> <span class="fu">enumerate</span>(<span class="fu">pairs</span>(<span class="fu">groupby</span>(time_res_low_noise, <span class="op">:</span>dr_end)))</span>
<span id="cb14-13"><a href="#cb14-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">lines!</span>(ax, grp[<span class="op">:</span>, <span class="op">:</span>charge], grp[<span class="op">:</span>, <span class="op">:</span>dt_iqr], linestyle<span class="op">=:</span>dash, color<span class="op">=</span>colors[i])</span>
<span id="cb14-14"><a href="#cb14-14" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb14-15"><a href="#cb14-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-16"><a href="#cb14-16" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-17"><a href="#cb14-17" aria-hidden="true" tabindex="-1"></a>group_color <span class="op">=</span> [<span class="fu">PolyElement</span>(color<span class="op">=</span>color, strokecolor<span class="op">=:</span>transparent)</span>
<span id="cb14-18"><a href="#cb14-18" aria-hidden="true" tabindex="-1"></a> for color <span class="kw">in</span> colors[<span class="fl">1</span><span class="op">:</span><span class="fl">3</span>]]</span>
<span id="cb14-19"><a href="#cb14-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-20"><a href="#cb14-20" aria-hidden="true" tabindex="-1"></a>group_linestyles <span class="op">=</span> [<span class="fu">LineElement</span>(color<span class="op">=:</span>black, linestyle<span class="op">=:</span>solid),</span>
<span id="cb14-21"><a href="#cb14-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">LineElement</span>(color<span class="op">=:</span>black, linestyle<span class="op">=:</span>dash)]</span>
<span id="cb14-22"><a href="#cb14-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-23"><a href="#cb14-23" aria-hidden="true" tabindex="-1"></a><span class="fu">ylims!</span>(ax, <span class="fl">0</span>, <span class="fl">5</span>)</span>
<span id="cb14-24"><a href="#cb14-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-25"><a href="#cb14-25" aria-hidden="true" tabindex="-1"></a>dyn_range_labels <span class="op">=</span> <span class="fu">getproperty</span>.(<span class="fu">keys</span>(<span class="fu">groupby</span>(time_res, <span class="op">:</span>dr_end)), <span class="op">:</span>dr_end)</span>
<span id="cb14-26"><a href="#cb14-26" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-27"><a href="#cb14-27" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-28"><a href="#cb14-28" aria-hidden="true" tabindex="-1"></a><span class="fu">Legend</span>(</span>
<span id="cb14-29"><a href="#cb14-29" aria-hidden="true" tabindex="-1"></a> fig[<span class="fl">1</span>, <span class="fl">2</span>],</span>
<span id="cb14-30"><a href="#cb14-30" aria-hidden="true" tabindex="-1"></a> [group_color, group_linestyles],</span>
<span id="cb14-31"><a href="#cb14-31" aria-hidden="true" tabindex="-1"></a> [<span class="fu">string</span>.(dyn_range_labels), [<span class="fu">format</span>(<span class="st">"{:.2f}"</span>, pmt_config.adc_freq), <span class="fu">format</span>(<span class="st">"{:.2f}"</span>, pmt_config_high_sampl.adc_freq)]],</span>
<span id="cb14-32"><a href="#cb14-32" aria-hidden="true" tabindex="-1"></a> [<span class="st">"Dynamic range (mV)"</span>, <span class="st">"Sampling Rate (MHz)"</span>])</span>
<span id="cb14-33"><a href="#cb14-33" aria-hidden="true" tabindex="-1"></a>fig</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="35">
<div id="fig-time-res" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-time-res-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 10: Time resolution of unfolded pulses.</figcaption><p></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-execution_count="16">
<div class="cell-output cell-output-display" data-execution_count="36">
<div id="fig-dt-dist" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-dt-dist-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 11: Distribution of the time difference between pulse time and unfolded pulse time for 1PE pulses and 3mV dynamic range</figcaption><p></p>
</figure>
</div>
</div>
</div>
</section>
<section id="double-pulse-study" class="level2">
<h2 class="anchored" data-anchor-id="double-pulse-study">Double Pulse Study</h2>
<p>In order to identify <span class="math inline">\(\nu_\tau\)</span> below 100TeV, analyzing the waveform structure for double pulse signatures might be beneficial. Here, we study the ability to recognize to distinct SPE pulses separated by a certain distance in time. As a metric we use the mean number of unfolded pulses, evaluated for double pulses vs. single, 2PE pulses. Here, the SPE distribution is included. The pulse separation time <span class="math inline">\(\Delta t\)</span> can be converted into a <span class="math inline">\(\nu_\tau\)</span> energy equivalent by using: <span class="math display">\[ \Delta t = \frac{1}{c} \cdot \frac{50~\mathrm{m} \cdot E}{\mathrm{PeV}}\]</span> which estimates the expected time difference between interaction vertex and decay vertex for a <span class="math inline">\(\tau\)</span> of energy <span class="math inline">\(E\)</span>. This estimation is valid for <span class="math inline">\(\tau\)</span> directions aligned with the line of sight of an individual PMT. <a href="#fig-doublepulse">Figure 12</a> shows the result of this study. At energies of 20TeV-30TeV, the mean number of unfolded pulses is significantly higher than for a single pulse with 2PE charge.</p>
<div class="callout callout-style-default callout-note callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>Note that the metric used here is not necessarily the optimal metric in identifying double pulses, but should be understood as a conservative estimate. Also note that this study does not average over different alignments of the tau relative to the PMT line of sight.</p>
</div>
</div>
<div class="cell" data-execution_count="17">
<details>
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>time_sep_per_GeV <span class="op">=</span> (<span class="fl">50</span> <span class="op">/</span> <span class="fl">0.3</span>) <span class="op">/</span> <span class="fl">1E6</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a>tau_log_e <span class="op">=</span> <span class="fl">3</span><span class="op">:</span><span class="fl">0.05</span><span class="op">:</span><span class="fl">5</span></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a>time_sep <span class="op">=</span> time_sep_per_GeV <span class="op">.*</span> <span class="fl">10</span> <span class="op">.^</span> tau_log_e</span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a>pulse_times <span class="op">=</span> <span class="fu">rand</span>(<span class="fu">Uniform</span>(<span class="fl">0</span>, <span class="fl">10</span>), <span class="fl">200</span>)</span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true" tabindex="-1"></a>rdt <span class="op">=</span> []</span>
<span id="cb15-8"><a href="#cb15-8" aria-hidden="true" tabindex="-1"></a>rdc <span class="op">=</span> []</span>
<span id="cb15-9"><a href="#cb15-9" aria-hidden="true" tabindex="-1"></a>sucess <span class="op">=</span> []</span>
<span id="cb15-10"><a href="#cb15-10" aria-hidden="true" tabindex="-1"></a>results <span class="op">=</span> []</span>
<span id="cb15-11"><a href="#cb15-11" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> tle <span class="kw">in</span> tau_log_e</span>
<span id="cb15-12"><a href="#cb15-12" aria-hidden="true" tabindex="-1"></a> time_sep <span class="op">=</span> <span class="fl">10</span><span class="op">^</span>tle <span class="op">*</span> time_sep_per_GeV</span>
<span id="cb15-13"><a href="#cb15-13" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> t <span class="kw">in</span> pulse_times</span>
<span id="cb15-14"><a href="#cb15-14" aria-hidden="true" tabindex="-1"></a> c <span class="op">=</span> <span class="fu">rand</span>(spe_d)</span>
<span id="cb15-15"><a href="#cb15-15" aria-hidden="true" tabindex="-1"></a> ps <span class="op">=</span> <span class="fu">PulseSeries</span>([t, t <span class="op">+</span> time_sep], <span class="fu">rand</span>(spe_d, <span class="fl">2</span>), pmt_config.pulse_model)</span>
<span id="cb15-16"><a href="#cb15-16" aria-hidden="true" tabindex="-1"></a> digi_wf <span class="op">=</span> <span class="fu">digitize_waveform</span>(ps, pmt_config.sampling_freq, pmt_config.adc_freq, pmt_config.noise_amp, pmt_config.lp_filter, time_range<span class="op">=</span>[<span class="op">-</span><span class="fl">10</span>, <span class="fl">50</span>])</span>
<span id="cb15-17"><a href="#cb15-17" aria-hidden="true" tabindex="-1"></a> unfolded_sig <span class="op">=</span> <span class="fu">unfold_waveform</span>(digi_wf, pmt_config.pulse_model_filt, pmt_config.unf_pulse_res, <span class="fl">0.3</span>, <span class="op">:</span>nnls)</span>
<span id="cb15-18"><a href="#cb15-18" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-19"><a href="#cb15-19" aria-hidden="true" tabindex="-1"></a> ps <span class="op">=</span> <span class="fu">PulseSeries</span>([t, t], <span class="fu">rand</span>(spe_d, <span class="fl">2</span>), pmt_config.pulse_model)</span>
<span id="cb15-20"><a href="#cb15-20" aria-hidden="true" tabindex="-1"></a> digi_wf <span class="op">=</span> <span class="fu">digitize_waveform</span>(ps, pmt_config.sampling_freq, pmt_config.adc_freq, pmt_config.noise_amp, pmt_config.lp_filter, time_range<span class="op">=</span>[<span class="op">-</span><span class="fl">10</span>, <span class="fl">50</span>])</span>
<span id="cb15-21"><a href="#cb15-21" aria-hidden="true" tabindex="-1"></a> unfolded_bg <span class="op">=</span> <span class="fu">unfold_waveform</span>(digi_wf, pmt_config.pulse_model_filt, pmt_config.unf_pulse_res, <span class="fl">0.3</span>, <span class="op">:</span>nnls)</span>
<span id="cb15-22"><a href="#cb15-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-23"><a href="#cb15-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">push!</span>(results, (np_sig<span class="op">=</span><span class="fu">length</span>(unfolded_sig), np_bg<span class="op">=</span><span class="fu">length</span>(unfolded_bg), tle<span class="op">=</span>tle, time_sep<span class="op">=</span>time_sep))</span>
<span id="cb15-24"><a href="#cb15-24" aria-hidden="true" tabindex="-1"></a> <span class="cf">end</span></span>
<span id="cb15-25"><a href="#cb15-25" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span>
<span id="cb15-26"><a href="#cb15-26" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-27"><a href="#cb15-27" aria-hidden="true" tabindex="-1"></a>results <span class="op">=</span> <span class="fu">DataFrame</span>(results)</span>
<span id="cb15-28"><a href="#cb15-28" aria-hidden="true" tabindex="-1"></a>results_mean <span class="op">=</span> <span class="fu">combine</span>(<span class="fu">groupby</span>(results, <span class="op">:</span>tle), [<span class="op">:</span>np_sig, <span class="op">:</span>np_bg] <span class="op">.=></span> mean, <span class="op">:</span>time_sep <span class="op">=></span> first)</span>
<span id="cb15-29"><a href="#cb15-29" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-30"><a href="#cb15-30" aria-hidden="true" tabindex="-1"></a>fig <span class="op">=</span> <span class="fu">Figure</span>()</span>
<span id="cb15-31"><a href="#cb15-31" aria-hidden="true" tabindex="-1"></a>ax <span class="op">=</span> <span class="fu">Axis</span>(fig[<span class="fl">1</span>, <span class="fl">1</span>], xlabel<span class="op">=</span><span class="st">"Log10(Energy)"</span>, ylabel<span class="op">=</span><span class="st">"Mean number of reco pulses"</span>,</span>
<span id="cb15-32"><a href="#cb15-32" aria-hidden="true" tabindex="-1"></a> xscale<span class="op">=</span>log10)</span>
<span id="cb15-33"><a href="#cb15-33" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-34"><a href="#cb15-34" aria-hidden="true" tabindex="-1"></a><span class="fu">lines!</span>(ax, <span class="fl">10</span> <span class="op">.^</span> results_mean[<span class="op">:</span>, <span class="op">:</span>tle], results_mean[<span class="op">:</span>, <span class="op">:</span>np_sig_mean], label<span class="op">=</span><span class="st">"Signal"</span>)</span>
<span id="cb15-35"><a href="#cb15-35" aria-hidden="true" tabindex="-1"></a><span class="fu">lines!</span>(ax, <span class="fl">10</span> <span class="op">.^</span> results_mean[<span class="op">:</span>, <span class="op">:</span>tle], results_mean[<span class="op">:</span>, <span class="op">:</span>np_bg_mean], label<span class="op">=</span><span class="st">"BG (2PE single)"</span>)</span>
<span id="cb15-36"><a href="#cb15-36" aria-hidden="true" tabindex="-1"></a><span class="fu">axislegend</span>(ax, position<span class="op">=:</span>lt)</span>
<span id="cb15-37"><a href="#cb15-37" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-38"><a href="#cb15-38" aria-hidden="true" tabindex="-1"></a>ax2 <span class="op">=</span> <span class="fu">Axis</span>(</span>
<span id="cb15-39"><a href="#cb15-39" aria-hidden="true" tabindex="-1"></a> fig[<span class="fl">1</span>, <span class="fl">1</span>],</span>
<span id="cb15-40"><a href="#cb15-40" aria-hidden="true" tabindex="-1"></a> limits<span class="op">=</span>(<span class="fu">minimum</span>(results_mean[<span class="op">:</span>, <span class="op">:</span>time_sep_first]), <span class="fu">maximum</span>(results_mean[<span class="op">:</span>, <span class="op">:</span>time_sep_first]), <span class="fl">0</span>, <span class="fl">1</span>),</span>
<span id="cb15-41"><a href="#cb15-41" aria-hidden="true" tabindex="-1"></a> xaxisposition<span class="op">=:</span>top,</span>
<span id="cb15-42"><a href="#cb15-42" aria-hidden="true" tabindex="-1"></a> xlabel<span class="op">=</span><span class="st">"Time Separation (ns)"</span>,</span>
<span id="cb15-43"><a href="#cb15-43" aria-hidden="true" tabindex="-1"></a> xscale<span class="op">=</span>log10)</span>
<span id="cb15-44"><a href="#cb15-44" aria-hidden="true" tabindex="-1"></a><span class="fu">hidespines!</span>(ax2)</span>
<span id="cb15-45"><a href="#cb15-45" aria-hidden="true" tabindex="-1"></a><span class="fu">hideydecorations!</span>(ax2)</span>
<span id="cb15-46"><a href="#cb15-46" aria-hidden="true" tabindex="-1"></a><span class="fu">xlims!</span>(ax, <span class="fl">10</span><span class="op">^</span>tau_log_e[<span class="fl">1</span>], <span class="fl">10</span><span class="op">^</span>tau_log_e[<span class="kw">end</span>])</span>
<span id="cb15-47"><a href="#cb15-47" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-48"><a href="#cb15-48" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-49"><a href="#cb15-49" aria-hidden="true" tabindex="-1"></a>fig</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
<div class="cell-output cell-output-display" data-execution_count="37">
<div id="fig-doublepulse" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
<p><img src="main_files/figure-html/fig-doublepulse-output-1.svg" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">Figure 12: Mean number of unfolded pulses for two distinct SPE (blue) vs. a single 2SPE pulse (orange)</figcaption><p></p>
</figure>
</div>
</div>
</div>
</section>
</section>
<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{haack,
author = {Christian Haack},
title = {P-ONE {PMT} {Properties} \& {Simulation}},
langid = {en}
}
</code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-haack" class="csl-entry quarto-appendix-citeas" role="doc-biblioentry">
Christian Haack. n.d. <span>“P-ONE PMT Properties &
Simulation.”</span>
</div></div></section></div></main>
<!-- /main column -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const clipboard = new window.ClipboardJS('.code-copy-button', {
target: function(trigger) {
return trigger.previousElementSibling;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
let tooltip;
if (window.bootstrap) {
button.setAttribute("data-bs-toggle", "tooltip");
button.setAttribute("data-bs-placement", "left");
button.setAttribute("data-bs-title", "Copied!");
tooltip = new bootstrap.Tooltip(button,
{ trigger: "manual",
customClass: "code-copy-button-tooltip",
offset: [0, -8]});
tooltip.show();
}
setTimeout(function() {
if (tooltip) {
tooltip.hide();
button.removeAttribute("data-bs-title");
button.removeAttribute("data-bs-toggle");
button.removeAttribute("data-bs-placement");
}
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start'
};
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
// use id or data attribute instead here
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
let selectedAnnoteEl;
const selectorForAnnotation = ( cell, annotation) => {
let cellAttr = 'data-code-cell="' + cell + '"';
let lineAttr = 'data-code-annotation="' + annotation + '"';
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
return selector;
}
const selectCodeLines = (annoteEl) => {
const doc = window.document;
const targetCell = annoteEl.getAttribute("data-target-cell");
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
const lineIds = lines.map((line) => {
return targetCell + "-" + line;
})
let top = null;
let height = null;
let parent = null;
if (lineIds.length > 0) {
//compute the position of the single el (top and bottom and make a div)
const el = window.document.getElementById(lineIds[0]);
top = el.offsetTop;
height = el.offsetHeight;
parent = el.parentElement.parentElement;
if (lineIds.length > 1) {
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
height = bottom - top;
}
if (top !== null && height !== null && parent !== null) {
// cook up a div (if necessary) and position it
let div = window.document.getElementById("code-annotation-line-highlight");
if (div === null) {
div = window.document.createElement("div");
div.setAttribute("id", "code-annotation-line-highlight");
div.style.position = 'absolute';
parent.appendChild(div);
}
div.style.top = top - 2 + "px";
div.style.height = height + 4 + "px";
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
if (gutterDiv === null) {
gutterDiv = window.document.createElement("div");
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
gutterDiv.style.position = 'absolute';
const codeCell = window.document.getElementById(targetCell);
const gutter = codeCell.querySelector('.code-annotation-gutter');
gutter.appendChild(gutterDiv);
}
gutterDiv.style.top = top - 2 + "px";
gutterDiv.style.height = height + 4 + "px";
}
selectedAnnoteEl = annoteEl;
}
};
const unselectCodeLines = () => {
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
elementsIds.forEach((elId) => {
const div = window.document.getElementById(elId);
if (div) {
div.remove();
}
});
selectedAnnoteEl = undefined;
};
// Attach click handler to the DT
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
for (const annoteDlNode of annoteDls) {
annoteDlNode.addEventListener('click', (event) => {
const clickedEl = event.target;
if (clickedEl !== selectedAnnoteEl) {
unselectCodeLines();
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
if (activeEl) {
activeEl.classList.remove('code-annotation-active');
}
selectCodeLines(clickedEl);
clickedEl.classList.add('code-annotation-active');
} else {
// Unselect the line
unselectCodeLines();
clickedEl.classList.remove('code-annotation-active');
}
});
}
const findCites = (el) => {
const parentEl = el.parentElement;
if (parentEl) {
const cites = parentEl.dataset.cites;
if (cites) {
return {
el,
cites: cites.split(' ')
};
} else {
return findCites(el.parentElement)
}
} else {
return undefined;
}
};
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
for (var i=0; i<bibliorefs.length; i++) {
const ref = bibliorefs[i];
const citeInfo = findCites(ref);
if (citeInfo) {
tippyHover(citeInfo.el, function() {
var popup = window.document.createElement('div');
citeInfo.cites.forEach(function(cite) {
var citeDiv = window.document.createElement('div');
citeDiv.classList.add('hanging-indent');
citeDiv.classList.add('csl-entry');
var biblioDiv = window.document.getElementById('ref-' + cite);
if (biblioDiv) {
citeDiv.innerHTML = biblioDiv.innerHTML;
}
popup.appendChild(citeDiv);
});
return popup.innerHTML;
});
}
}
});
</script>
</div> <!-- /content -->
</body></html>