]>
Commit | Line | Data |
---|---|---|
11141716 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
803d1ab0 | 16 | /* $Id$ */ |
11141716 | 17 | |
18 | #include "AliLhcIRegion.h" | |
19 | #include "AliLhcBeam.h" | |
20 | #include "AliLHC.h" | |
21 | ||
22 | #include <TMath.h> | |
23 | #include <TCanvas.h> | |
24 | #include <TPad.h> | |
25 | #include <TGraph.h> | |
26 | #include <TMultiGraph.h> | |
27 | #include <TH1.h> | |
28 | ||
29 | ClassImp(AliLhcIRegion) | |
30 | ||
31 | AliLhcIRegion::AliLhcIRegion(AliLHC* lhc, const char* name, const char* title) | |
32 | :TNamed(name,title) | |
33 | { | |
34 | // Constructor | |
35 | fAccelerator=lhc; | |
36 | fLumiArray = 0; | |
37 | fAverageLumiArray = 0; | |
38 | fBetaStarArray = 0; | |
39 | } | |
40 | ||
41 | AliLhcIRegion::AliLhcIRegion(const AliLhcIRegion& region) | |
42 | { | |
43 | // copy constructor | |
44 | } | |
45 | ||
46 | AliLhcIRegion::~AliLhcIRegion() | |
47 | { | |
48 | // Destructor | |
49 | ||
50 | if (fLumiArray) delete fLumiArray; | |
51 | if (fAverageLumiArray) delete fAverageLumiArray; | |
52 | if (fBetaStarArray) delete fBetaStarArray; | |
53 | } | |
54 | ||
55 | ||
56 | AliLhcIRegion& AliLhcIRegion::operator=(const AliLhcIRegion & rhs) | |
57 | { | |
58 | // Assignment operator | |
59 | return *this; | |
60 | } | |
61 | ||
62 | void AliLhcIRegion::Init() | |
63 | { | |
64 | // Initialization | |
65 | printf("\n Initializing Interaction Region %s", GetName()); | |
66 | printf("\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); | |
67 | // Initial Luminosity | |
68 | fBeam1 = fAccelerator->Beam(0); | |
69 | fBeam2 = fAccelerator->Beam(1); | |
70 | fFrequency = 3.e10/(2.*TMath::Pi()*fAccelerator->Radius()); | |
71 | ||
72 | Luminosity(); | |
73 | ||
74 | fLuminosity0 = fLuminosity; | |
75 | fAverageLumi=0.; | |
76 | fBetaStar0 = fBetaStar; | |
77 | printf("\n IR Beta* :%10.3e cm ", fBetaStar); | |
78 | printf("\n IR Initial Luminosity :%10.3e cm^-2s^-1 ", fLuminosity); | |
79 | } | |
80 | ||
81 | Float_t AliLhcIRegion::Luminosity() | |
82 | { | |
83 | Float_t sigma1 = TMath::Sqrt(fBeam1->Emittance()*fBetaStar); | |
84 | Float_t sigma2 = TMath::Sqrt(fBeam2->Emittance()*fBetaStar); | |
85 | fLuminosity = fFrequency * | |
86 | fBeam1->N()*fBeam2->N()/(2.*TMath::Pi()*(sigma1*sigma1+sigma2*sigma2)); | |
87 | return fLuminosity; | |
88 | } | |
89 | ||
90 | void AliLhcIRegion::Update() | |
91 | { | |
92 | Luminosity(); | |
93 | } | |
94 | ||
95 | void AliLhcIRegion::SetMonitor(Int_t n) | |
96 | { | |
97 | // Initialize monitors | |
98 | ||
99 | if (fLumiArray) delete fLumiArray; | |
100 | if (fAverageLumiArray) delete fAverageLumiArray; | |
101 | if (fBetaStarArray) delete fBetaStarArray; | |
102 | ||
103 | fLumiArray = new Float_t[n]; | |
104 | fAverageLumiArray = new Float_t[n]; | |
105 | fBetaStarArray = new Float_t[n]; | |
106 | ||
107 | fAverageLumiArray[0] = 0.; | |
108 | fNmax = n; | |
109 | } | |
110 | ||
111 | void AliLhcIRegion::Record() | |
112 | { | |
113 | // Record some time dependent quantities | |
114 | // | |
115 | Int_t n = fAccelerator->Nt(); | |
116 | // Luminosity | |
117 | ||
118 | fLumiArray[n] = fLuminosity; | |
119 | ||
120 | // Average Luminosity respecting set-up and filling time | |
121 | if (fAccelerator->Time() > fAccelerator->SetUpTime()) | |
122 | fAverageLumi+=fLuminosity*fAccelerator->TimeStep(); | |
123 | ||
124 | fAverageLumiArray[n] = fAverageLumi/ | |
125 | (Float_t(n+1)*fAccelerator->TimeStep()+fAccelerator->FillingTime())/ | |
126 | fLuminosity0; | |
127 | ||
128 | // Beta* | |
129 | fBetaStarArray[n] = fBetaStar; | |
130 | } | |
131 | ||
132 | ||
133 | void AliLhcIRegion::DrawPlots() | |
134 | { | |
135 | // | |
136 | // Draw the monitor plots | |
137 | // | |
138 | Float_t* t = fAccelerator->TimeA(); | |
139 | // | |
140 | char name1[20], name2[20], hname[20]; | |
141 | sprintf(name1,"c%s",GetName()); | |
142 | sprintf(name2,"b%s",GetName()); | |
143 | char title[30]; | |
144 | sprintf(title,"Luminosity Lifetime for %s",GetName()); | |
145 | ||
146 | // | |
147 | sprintf(hname,"%s%d",name1,0); | |
148 | TH1 *g1 = new TH1F(hname,"Luminosity",fNmax,0,t[fNmax]); | |
149 | g1->SetMinimum(0); | |
150 | g1->SetMaximum(fLumiArray[0]*1.1); | |
151 | g1->SetStats(0); | |
152 | g1->GetXaxis()->SetTitle("t (h)"); | |
153 | g1->GetYaxis()->SetTitle("L(t) (cm**-2 s**-1)"); | |
154 | sprintf(hname,"%s%d",name1,1); | |
155 | TH1 *g2 = new TH1F(hname,"Luminosity",fNmax,0,t[fNmax]); | |
156 | g2->SetMinimum(0); | |
157 | g2->SetMaximum(1.1); | |
158 | g2->SetStats(0); | |
159 | g2->GetXaxis()->SetTitle("t (h)"); | |
160 | g2->GetYaxis()->SetTitle("L(t)/L0"); | |
161 | sprintf(hname,"%s%d",name1,3); | |
162 | ||
163 | TH1 *g3 = new TH1F(hname,"Average Luminosity",fNmax,0,t[fNmax]); | |
164 | g3->SetMinimum(0); | |
165 | g3->SetMaximum(1.1); | |
166 | g3->SetStats(0); | |
167 | ||
168 | g3->GetXaxis()->SetTitle("t (h)"); | |
169 | g3->GetYaxis()->SetTitle("L(t)/L0"); | |
170 | sprintf(hname,"%s%d",name1,3); | |
171 | ||
172 | TH1 *g4 = new TH1F(hname,"Beta*",fNmax,0,t[fNmax]); | |
173 | g4->SetMinimum(0); | |
174 | g4->SetMaximum(fBetaStarArray[0]*1.1); | |
175 | g4->SetStats(0); | |
176 | g4->GetXaxis()->SetTitle("t (h)"); | |
177 | g4->GetYaxis()->SetTitle("beta* (cm)"); | |
178 | ||
179 | TGraph* grLumi = new TGraph(fNmax, t, fLumiArray); | |
180 | grLumi->SetHistogram(g1); | |
181 | ||
182 | for (Int_t i=0; i<fNmax; i++) { | |
183 | fLumiArray[i]=fLumiArray[i]/fLuminosity0; | |
184 | } | |
185 | TGraph* grLumiN = new TGraph(fNmax, t, fLumiArray); | |
186 | grLumiN->SetHistogram(g2); | |
187 | ||
188 | TGraph* grLumiA = new TGraph(fNmax, t, fAverageLumiArray); | |
189 | grLumiA->SetHistogram(g3); | |
190 | grLumiA->SetLineStyle(2); | |
191 | ||
192 | TGraph* grLumiB = new TGraph(fNmax, t, fBetaStarArray); | |
193 | grLumiB->SetHistogram(g4); | |
194 | ||
195 | TMultiGraph* mg = new TMultiGraph(); | |
196 | mg->Add(grLumiN); | |
197 | mg->Add(grLumiA); | |
198 | ||
199 | ||
200 | ||
201 | TCanvas *c1 = new TCanvas(name1,title, 200, 10, 700, 500); | |
202 | ||
203 | c1->SetGrid(); | |
204 | mg->Draw("AC"); | |
205 | mg->GetXaxis()->SetTitle("t (h)"); | |
206 | mg->GetYaxis()->SetTitle("L(t)/L0 and <L>/L0"); | |
207 | mg->Draw("AC"); | |
208 | ||
209 | TCanvas *c2 = new TCanvas(name2,title, 200, 10, 700, 500); | |
210 | c1->SetGrid(); | |
211 | grLumiB->Draw("AC"); | |
212 | ||
213 | } | |
214 | ||
215 | ||
216 | ||
217 |