]> git.uio.no Git - u/mrichter/AliRoot.git/blame - LHC/PlotPressure.C
Adding extra checks to protect from fatal aborts.
[u/mrichter/AliRoot.git] / LHC / PlotPressure.C
CommitLineData
c0382a57 1void PlotPressure()
2{
3 FILE* file;
4 file=fopen("gasPressure.dat","r");
5 Float_t z1[20];
6 Float_t g1[20], g2[20], g3[20], g4[20], g5[20];
7 Float_t z2[21];
8 Float_t h1[21], h2[21], h3[21], h4[21], h5[21];
9
10 char c[45];
11 Float_t z;
12
13 for (Int_t i = 0; i < 20; i++)
14 {
15 fscanf(file, "%f %f %f %f %f %f", &z,
16 &g1[i], &g2[i], &g3[i], &g4[i], &g5[i]);
17// printf("%d %f %f %f %f %f %f \n", i, z1[i],
18// g1[i][0], g1[i][1], g1[i][2], g1[i][3], g1[i][4]);
19 if (i > 0) {
20 z1[i] = z1[i-1] + z;
21 } else {
22 z1[i] = 20.;
23 }
24 }
25
26
27 for (Int_t i = 0; i < 21; i++)
28 {
29 fscanf(file, "%f %f %f %f %f %f", &z,
30 &h1[i], &h2[i], &h3[i], &h4[i], &h5[i]);
31 if (i > 0) {
32 z2[i] = z2[i-1] + z;
33 } else {
34 z2[i] = 20.;
35 }
36 }
37
38//
39//
40 TCanvas *c1 = new TCanvas("c1","Gas Pressure Beam 1", 200, 10, 700, 500);
41 gPad->SetLogy();
42
43 TGraph* gr1 = new TGraph(20, z1, g1);
44 gr1->SetMaximum(1e17);
45 gr1->SetMinimum(1e11);
46 gr1->SetLineColor(1);
47 gr1->SetTitle("Ring 1: Beginning of Run");
48
49 TGraph* gr2 = new TGraph(20, z1, g3);
50 gr2->SetLineColor(2);
51
52 TGraph* gr3 = new TGraph(20, z1, g5);
53 gr3->SetLineColor(4);
54
55 gr1->Draw("AL");
56 gr2->Draw("L");
57// gr3->Draw("L");
58 text();
59
60//
61//
62 TCanvas *c2 = new TCanvas("c2","Gas Pressure Beam 1", 200, 10, 700, 500);
63 gPad->SetLogy();
64
65 TGraph* gr4 = new TGraph(20, z1, g2);
66 gr4->SetMaximum(1e17);
67 gr4->SetMinimum(1e11);
68 gr4->SetLineColor(1);
69 gr4->SetTitle("Ring 1");
70
71 TGraph* gr5 = new TGraph(20, z1, g4);
72 gr5->SetLineColor(2);
73
74 TGraph* gr6 = new TGraph(20, z1, g5);
75 gr6->SetLineColor(4);
76
77 gr4->Draw("AL");
78 gr5->Draw("L");
79 gr6->Draw("L");
80 text();
81
82//
83//
84 TCanvas *c3 = new TCanvas("c3","Gas Pressure Beam 2", 200, 10, 700, 500);
85 gPad->SetLogy();
86
87 TGraph* hr1 = new TGraph(21, z2, h1);
88 hr1->SetMaximum(1e17);
89 hr1->SetMinimum(1e11);
90 hr1->SetLineColor(1);
91 hr1->SetTitle("Ring 2: Beginning of Run");
92
93 TGraph* hr2 = new TGraph(21, z2, h3);
94 hr2->SetLineColor(2);
95
96 TGraph* hr3 = new TGraph(21, z2, h5);
97 hr3->SetLineColor(4);
98
99 hr1->Draw("AL");
100 hr2->Draw("L");
101// hr3->Draw("L");
102 text();
103
104//
105//
106 TCanvas *c4 = new TCanvas("c4","Gas Pressure Beam 2", 200, 10, 700, 500);
107 gPad->SetLogy();
108
109 TGraph* hr4 = new TGraph(21, z2, h2);
110 hr4->SetMaximum(1e17);
111 hr4->SetMinimum(1e11);
112 hr4->SetLineColor(1);
113 hr4->SetTitle("Ring 2");
114
115 TGraph* hr5 = new TGraph(21, z2, h4);
116 hr5->SetLineColor(2);
117
118 TGraph* hr6 = new TGraph(21, z2, h5);
119 hr6->SetLineColor(4);
120
121 hr4->Draw("AL");
122 hr5->Draw("L");
123 hr6->Draw("L");
124 text();
f5e004f6 125//
126// One example of interaction rate calculation
127//
128// 3rd year, full intensity
129//
130 Float_t r[20];
131 const Float_t crossSection = 0.094e-28; // m^2
132 const Float_t pFlux = 1.e11/25.e-9; // 1/s
133
134 for (Int_t i= 0; i < 20; i++)
135 {
136 r[i] = g5[i] * crossSection * pFlux; // 1/m/s
137 }
138
139 TCanvas *c5 = new TCanvas("c5","Interaction Rate Beam 1, 3rd year", 200, 10, 700, 500);
140 gPad->SetLogy();
c0382a57 141
f5e004f6 142 TGraph* rr1 = new TGraph(20, z1, r);
143 rr1->SetMaximum(1e6);
144 rr1->SetMinimum(1e1);
145 rr1->SetLineColor(4);
146 rr1->SetTitle("Ring 1");
147 rr1->Draw("AL");
c0382a57 148}
149
150void text()
151{
152
153 TPave *pave = new TPave(194.619,11.0495,293.103,12.6485,4,"br");
154 pave->SetFillColor(18);
155 pave->Draw();
156 TLine *line = new TLine(199.702,11.8109,232.106,11.8109);
157 line->SetLineColor(2);
158 line->Draw();
159 line = new TLine(198.431,12.2868,232.106,12.2868);
160 line->Draw();
161 line = new TLine(199.066,11.3731,232.742,11.3731);
162 line->SetLineColor(4);
163 line->Draw();
164 line = new TLine(215.586,13.3338,215.586,13.3147);
165 line->Draw();
166 tex = new TLatex(239.096,11.6777,"2nd year");
167 tex->SetTextSize(0.05);
168 tex->SetLineWidth(2);
169 tex->Draw();
170 tex = new TLatex(236.554,12.1536,"1st year");
171 tex->SetTextSize(0.0507614);
172 tex->SetLineWidth(2);
173 tex->Draw();
174 tex = new TLatex(239.096,11.2589,"3rd year");
175 tex->SetTextSize(0.05);
176 tex->SetLineWidth(2);
177 tex->Draw();
178 c1->Modified();
179 c1->cd();
180}