@@ -1390,9 +1390,9 @@ end
1390
1390
xlabel := " Drift Time"
1391
1391
ylabel := " LQ (A.U.)"
1392
1392
framestyle := :box
1393
- left_margin := - 2 Plots . mm
1394
- bottom_margin := - 4 Plots . mm
1395
- top_margin := - 3 Plots . mm
1393
+ left_margin := ( - 2 , :mm )
1394
+ bottom_margin := ( - 4 , :mm )
1395
+ top_margin := ( - 3 , :mm )
1396
1396
color := :viridis
1397
1397
formatter := :plain
1398
1398
thickness_scaling := 1.6
@@ -1476,15 +1476,15 @@ end
1476
1476
1477
1477
# recipe for the lq_cut report
1478
1478
1479
- @recipe function f (report:: NamedTuple{(:cut, :fit_result, :temp_hists, :fit_report)} , lq_class:: Vector{Float64} , e_cal, plot_type:: Symbol )
1479
+ @recipe function f (report:: NamedTuple{(:cut, :fit_result, :temp_hists, :fit_report, :dep_σ, :edges )} , lq_class:: Vector{Float64} , e_cal, plot_type:: Symbol )
1480
1480
1481
1481
# Extract cutvalue from the report
1482
1482
cut_value = Measurements. value .(report. cut)
1483
1483
1484
1484
# Plot configuration for all types
1485
- left_margin := - 2 Plots . mm
1486
- bottom_margin := - 4 Plots . mm
1487
- top_margin := - 3 Plots . mm
1485
+ left_margin := ( - 2 , :mm )
1486
+ bottom_margin := ( - 4 , :mm )
1487
+ top_margin := ( - 3 , :mm )
1488
1488
thickness_scaling := 1.6
1489
1489
size := (1200 , 900 )
1490
1490
framestyle := :box
@@ -1662,10 +1662,40 @@ end
1662
1662
report. temp_hists. hist_sb2
1663
1663
end
1664
1664
1665
-
1665
+ elseif plot_type == :energy_spectrum
1666
+ # Plot energy spectrum with DEP and sideband regions
1667
+ left_margin := (- 2 , :mm )
1668
+ bottom_margin := (- 4 , :mm )
1669
+ top_margin := (- 3 , :mm )
1670
+ thickness_scaling := 1.6
1671
+ size := (1200 , 900 )
1672
+ framestyle := :box
1673
+ formatter := :plain
1674
+ xlabel := " Energy"
1675
+ ylabel := " Counts"
1676
+
1677
+ @series begin
1678
+ seriestype := :stephist
1679
+ label := " Energy Spectrum (σ: $(round (u " keV" , report. dep_σ, sigdigits= 3 )) )"
1680
+ bins := 1000
1681
+ e_cal[1500 u " keV" .< e_cal .< 1660 u " keV" ]
1682
+ end
1683
+
1684
+ @series begin
1685
+ seriestype := :vline
1686
+ label := " DEP Region"
1687
+ fillcolor := :red
1688
+ [report. edges. DEP_edge_left, report. edges. DEP_edge_right]
1689
+ end
1690
+
1691
+ @series begin
1692
+ seriestype := :vline
1693
+ label := " Sideband Edges"
1694
+ fillcolor := :green
1695
+ legend := :topleft
1696
+ [report. edges. sb1_edge, report. edges. sb2_edge]
1697
+ end
1666
1698
end
1667
1699
end
1668
1700
1669
-
1670
-
1671
1701
end # module LegendSpecFitsRecipesBaseExt
0 commit comments