-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormEnergyCurve.cs
66 lines (56 loc) · 1.89 KB
/
FormEnergyCurve.cs
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZedGraph;
namespace crash
{
public partial class FormEnergyCurve : Form
{
private List<double> CoeffList = null;
private Detector Det;
public FormEnergyCurve(Detector detector, List<double> coeffList)
{
InitializeComponent();
CoeffList = coeffList;
Det = detector.Clone();
}
private void FormEnergyCurve_Load(object sender, EventArgs e)
{
if (CoeffList.Count < 2)
return;
string curveName = "";
int counter = 0;
foreach (double coeff in CoeffList)
{
curveName += coeff.ToString("E") + " * x^" + counter.ToString() + " + ";
counter++;
}
curveName = curveName.Substring(0, curveName.Length - 3);
Det.EnergyCurveCoefficients.Clear();
Det.EnergyCurveCoefficients.AddRange(CoeffList);
GraphPane pane = graph.GraphPane;
PointPairList list = new PointPairList();
for (int i = 0; i < Det.NumChannels; i++)
list.Add((double)i, Det.GetEnergy(i));
LineItem energyCurve = pane.AddCurve(curveName, list, Color.Green, SymbolType.None);
graph.RestoreScale(pane);
graph.AxisChange();
graph.Refresh();
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = System.Windows.Forms.DialogResult.Cancel;
Close();
}
private void btnStore_Click(object sender, EventArgs e)
{
DialogResult = System.Windows.Forms.DialogResult.OK;
Close();
}
}
}