1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliLhcIRegion.h"
19 #include "AliLhcBeam.h"
26 #include <TMultiGraph.h>
29 ClassImp(AliLhcIRegion)
31 AliLhcIRegion::AliLhcIRegion(AliLHC* lhc, const char* name, const char* title)
37 fAverageLumiArray = 0;
41 AliLhcIRegion::AliLhcIRegion(const AliLhcIRegion& region)
42 : TNamed(region), AliLhcMonitor(region)
47 AliLhcIRegion::~AliLhcIRegion()
51 if (fLumiArray) delete fLumiArray;
52 if (fAverageLumiArray) delete fAverageLumiArray;
53 if (fBetaStarArray) delete fBetaStarArray;
57 AliLhcIRegion& AliLhcIRegion::operator=(const AliLhcIRegion & /*rhs*/)
59 // Assignment operator
63 void AliLhcIRegion::Init()
66 printf("\n Initializing Interaction Region %s", GetName());
67 printf("\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
69 fBeam1 = fAccelerator->Beam(0);
70 fBeam2 = fAccelerator->Beam(1);
71 fFrequency = 3.e10/(2.*TMath::Pi()*fAccelerator->Radius());
75 fLuminosity0 = fLuminosity;
77 fBetaStar0 = fBetaStar;
78 printf("\n IR Beta* :%10.3e cm ", fBetaStar);
79 printf("\n IR Initial Luminosity :%10.3e cm^-2s^-1 ", fLuminosity);
82 Float_t AliLhcIRegion::Luminosity()
84 Float_t sigma1 = TMath::Sqrt(fBeam1->Emittance()*fBetaStar);
85 Float_t sigma2 = TMath::Sqrt(fBeam2->Emittance()*fBetaStar);
86 fLuminosity = fFrequency *
87 fBeam1->N()*fBeam2->N()/(2.*TMath::Pi()*(sigma1*sigma1+sigma2*sigma2));
91 void AliLhcIRegion::Update()
96 void AliLhcIRegion::SetMonitor(Int_t n)
98 // Initialize monitors
100 if (fLumiArray) delete fLumiArray;
101 if (fAverageLumiArray) delete fAverageLumiArray;
102 if (fBetaStarArray) delete fBetaStarArray;
104 fLumiArray = new Float_t[n];
105 fAverageLumiArray = new Float_t[n];
106 fBetaStarArray = new Float_t[n];
108 fAverageLumiArray[0] = 0.;
112 void AliLhcIRegion::Record()
114 // Record some time dependent quantities
116 Int_t n = fAccelerator->Nt();
119 fLumiArray[n] = fLuminosity;
121 // Average Luminosity respecting set-up and filling time
122 if (fAccelerator->Time() > fAccelerator->SetUpTime())
123 fAverageLumi+=fLuminosity*fAccelerator->TimeStep();
125 fAverageLumiArray[n] = fAverageLumi/
126 (Float_t(n+1)*fAccelerator->TimeStep()+fAccelerator->FillingTime())/
130 fBetaStarArray[n] = fBetaStar;
134 void AliLhcIRegion::DrawPlots()
137 // Draw the monitor plots
139 Float_t* t = fAccelerator->TimeA();
141 char name1[20], name2[20], hname[20];
142 sprintf(name1,"c%s",GetName());
143 sprintf(name2,"b%s",GetName());
145 sprintf(title,"Luminosity Lifetime for %s",GetName());
148 sprintf(hname,"%s%d",name1,0);
149 TH1 *g1 = new TH1F(hname,"Luminosity",fNmax,0,t[fNmax]);
151 g1->SetMaximum(fLumiArray[0]*1.1);
153 g1->GetXaxis()->SetTitle("t (h)");
154 g1->GetYaxis()->SetTitle("L(t) (cm**-2 s**-1)");
155 sprintf(hname,"%s%d",name1,1);
156 TH1 *g2 = new TH1F(hname,"Luminosity",fNmax,0,t[fNmax]);
160 g2->GetXaxis()->SetTitle("t (h)");
161 g2->GetYaxis()->SetTitle("L(t)/L0");
162 sprintf(hname,"%s%d",name1,3);
164 TH1 *g3 = new TH1F(hname,"Average Luminosity",fNmax,0,t[fNmax]);
169 g3->GetXaxis()->SetTitle("t (h)");
170 g3->GetYaxis()->SetTitle("L(t)/L0");
171 sprintf(hname,"%s%d",name1,3);
173 TH1 *g4 = new TH1F(hname,"Beta*",fNmax,0,t[fNmax]);
175 g4->SetMaximum(fBetaStarArray[0]*1.1);
177 g4->GetXaxis()->SetTitle("t (h)");
178 g4->GetYaxis()->SetTitle("beta* (cm)");
180 TGraph* grLumi = new TGraph(fNmax, t, fLumiArray);
181 grLumi->SetHistogram(g1);
183 for (Int_t i=0; i<fNmax; i++) {
184 fLumiArray[i]=fLumiArray[i]/fLuminosity0;
186 TGraph* grLumiN = new TGraph(fNmax, t, fLumiArray);
187 grLumiN->SetHistogram(g2);
189 TGraph* grLumiA = new TGraph(fNmax, t, fAverageLumiArray);
190 grLumiA->SetHistogram(g3);
191 grLumiA->SetLineStyle(2);
193 TGraph* grLumiB = new TGraph(fNmax, t, fBetaStarArray);
194 grLumiB->SetHistogram(g4);
196 TMultiGraph* mg = new TMultiGraph();
202 TCanvas *c1 = new TCanvas(name1,title, 200, 10, 700, 500);
206 mg->GetXaxis()->SetTitle("t (h)");
207 mg->GetYaxis()->SetTitle("L(t)/L0 and <L>/L0");
210 TCanvas *c2 = new TCanvas(name2,title, 200, 10, 700, 500);