-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpredicted_noise.C
92 lines (73 loc) · 2.81 KB
/
predicted_noise.C
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
{
// noise_in_ADU = sqrt[ (read_noise_in_e*ADU_per_e_for_this_camera)**2 + (dark_rate_in_e_per_pixel_per_s xposure_length_in_s * pixels * ADU_per_e_for_this_camera)**2 ]
// const int ncam = 3;
const int ncam = 1;
/* std::map<TString, int> camera;
cameras["PL0141514"] = 0;
cameras["PL0251514"] = 1;
cameras["PL0261514"] = 2;*/
double pixels = 3056*3056;
double read_noise[ncam];
double adu_pe[ncam];
double dark[ncam];
//read_noise[0] = 11.2;
//read_noise[1] = 10.2;
read_noise[0] = 11.3; //9.6;
//read_noise[0] =7.38;//ADU
//adu_pe[0] = 1.55;
//adu_pe[1] = 1.52;
adu_pe[0] = 1.53; //1.52;
//dark should be: dark[0] = 0.6/(100*adu_pe[1]*pixels); but going to multiply by pixels and gain in calculation, so just omitting here
//dark[0] = 2.5/(100);
//dark[1] = 0.6/(100);
//dark[0] = 40.8/(100); //0.7/(100);//WP taken out and replace with line below
dark[0]=42.73/(100);
//dark[0]=27.93/(100);
double exp[4] = {1.0,2.0,5.0,10.0};
double noise[4];
//TGraph * graphs[ncam];
//TCanvas * c1[ncam];
TCanvas *c1 = new TCanvas("c1","c1",600,400);
TMultiGraph *mg = new TMultiGraph();
//TGraph *gr1[ncam]; //= new TGraph();
//gr1->SetLineColor(kBlue);
//TGraph *gr2 = new TGraph();
//gr2->SetLineColor(kRed);
//for(int c = 0; c < ncam; c++){
for(int i = 0; i < 4; i++){
noise[i] = (TMath::Sqrt(read_noise[0]*adu_pe[0]*read_noise[0]*adu_pe[0] + dark[0]*exp[i]*dark[0]*exp[i]));
//noise[i] = (TMath::Sqrt(read_noise[0]*adu_pe[0] + dark[0]*exp[i]));
//}
gr1 = new TGraph(4,exp,noise);
gr1->SetLineColor(kRed);
/*graphs[c] = new TGraph(5,exp,noise);
c1[c] = new TCanvas();
c1[c]->cd();
graphs[c]->SetTitle(Form("Predicted Noise vs. Exposure Cam %d",c));
graphs[c]->GetXaxis()->SetTitle("Exposure Time (s)");
graphs[c]->GetYaxis()->SetTitle("Predicted Noise (ADU)");
graphs[c]->Draw("alp");*/
gr1->SetLineWidth(4);
}
Double_t exp_time[4] = {1.0,3.0,5.0,10.0};
Double_t noise_meassured[4] = {19.97,20.01,20.04,19.98};//{15.67,15.65,15.67,15.74};
Double_t ex[4] = {0.1,0.1,0.1,0.1};//{.1,.1,.5};
Double_t ey[4] = {0.2,0.2,0.2,0.2};//{.8,.7,.2};
TGraphErrors *gr2 = new TGraphErrors(4,exp_time,noise_meassured,ex,ey);
// gr2->SetLineColor(kRed);
gr2->SetMarkerStyle(21);
gr2->SetMarkerColor(kBlue);
mg->Add(gr1);
mg->Add(gr2);
c1->cd();
mg->Draw("alp");
mg->SetTitle(Form("Predicted Noise vs. Exposure Time"));
mg->GetXaxis()->SetTitle("Exposure Time (s)");
mg->GetYaxis()->SetTitle("Predicted Noise [e]");
auto leg = new TLegend(0.55,0.45,0.85,0.7);
leg->AddEntry(gr1, "Predicted Noise");
leg->AddEntry(gr2, "Measured Noise");
leg->Draw();
// mg->Draw("alp");
c1->Update();
}