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 **************************************************************************/
20 #include "AliLhcIRegion.h"
21 #include "AliLhcBeam.h"
28 #include <TMultiGraph.h>
31 ClassImp(AliLhcIRegion)
33 AliLhcIRegion::AliLhcIRegion(AliLHC* lhc, const char* name, const char* title)
39 fAverageLumiArray = 0;
43 AliLhcIRegion::AliLhcIRegion(const AliLhcIRegion& region)
48 AliLhcIRegion::~AliLhcIRegion()
52 if (fLumiArray) delete fLumiArray;
53 if (fAverageLumiArray) delete fAverageLumiArray;
54 if (fBetaStarArray) delete fBetaStarArray;
58 AliLhcIRegion& AliLhcIRegion::operator=(const AliLhcIRegion & rhs)
60 // Assignment operator
64 void AliLhcIRegion::Init()
67 printf("\n Initializing Interaction Region %s", GetName());
68 printf("\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
70 fBeam1 = fAccelerator->Beam(0);
71 fBeam2 = fAccelerator->Beam(1);
72 fFrequency = 3.e10/(2.*TMath::Pi()*fAccelerator->Radius());
76 fLuminosity0 = fLuminosity;
78 fBetaStar0 = fBetaStar;
79 printf("\n IR Beta* :%10.3e cm ", fBetaStar);
80 printf("\n IR Initial Luminosity :%10.3e cm^-2s^-1 ", fLuminosity);
83 Float_t AliLhcIRegion::Luminosity()
85 Float_t sigma1 = TMath::Sqrt(fBeam1->Emittance()*fBetaStar);
86 Float_t sigma2 = TMath::Sqrt(fBeam2->Emittance()*fBetaStar);
87 fLuminosity = fFrequency *
88 fBeam1->N()*fBeam2->N()/(2.*TMath::Pi()*(sigma1*sigma1+sigma2*sigma2));
92 void AliLhcIRegion::Update()
97 void AliLhcIRegion::SetMonitor(Int_t n)
99 // Initialize monitors
101 if (fLumiArray) delete fLumiArray;
102 if (fAverageLumiArray) delete fAverageLumiArray;
103 if (fBetaStarArray) delete fBetaStarArray;
105 fLumiArray = new Float_t[n];
106 fAverageLumiArray = new Float_t[n];
107 fBetaStarArray = new Float_t[n];
109 fAverageLumiArray[0] = 0.;
113 void AliLhcIRegion::Record()
115 // Record some time dependent quantities
117 Int_t n = fAccelerator->Nt();
120 fLumiArray[n] = fLuminosity;
122 // Average Luminosity respecting set-up and filling time
123 if (fAccelerator->Time() > fAccelerator->SetUpTime())
124 fAverageLumi+=fLuminosity*fAccelerator->TimeStep();
126 fAverageLumiArray[n] = fAverageLumi/
127 (Float_t(n+1)*fAccelerator->TimeStep()+fAccelerator->FillingTime())/
131 fBetaStarArray[n] = fBetaStar;
135 void AliLhcIRegion::DrawPlots()
138 // Draw the monitor plots
140 Float_t* t = fAccelerator->TimeA();
142 char name1[20], name2[20], hname[20];
143 sprintf(name1,"c%s",GetName());
144 sprintf(name2,"b%s",GetName());
146 sprintf(title,"Luminosity Lifetime for %s",GetName());
149 sprintf(hname,"%s%d",name1,0);
150 TH1 *g1 = new TH1F(hname,"Luminosity",fNmax,0,t[fNmax]);
152 g1->SetMaximum(fLumiArray[0]*1.1);
154 g1->GetXaxis()->SetTitle("t (h)");
155 g1->GetYaxis()->SetTitle("L(t) (cm**-2 s**-1)");
156 sprintf(hname,"%s%d",name1,1);
157 TH1 *g2 = new TH1F(hname,"Luminosity",fNmax,0,t[fNmax]);
161 g2->GetXaxis()->SetTitle("t (h)");
162 g2->GetYaxis()->SetTitle("L(t)/L0");
163 sprintf(hname,"%s%d",name1,3);
165 TH1 *g3 = new TH1F(hname,"Average Luminosity",fNmax,0,t[fNmax]);
170 g3->GetXaxis()->SetTitle("t (h)");
171 g3->GetYaxis()->SetTitle("L(t)/L0");
172 sprintf(hname,"%s%d",name1,3);
174 TH1 *g4 = new TH1F(hname,"Beta*",fNmax,0,t[fNmax]);
176 g4->SetMaximum(fBetaStarArray[0]*1.1);
178 g4->GetXaxis()->SetTitle("t (h)");
179 g4->GetYaxis()->SetTitle("beta* (cm)");
181 TGraph* grLumi = new TGraph(fNmax, t, fLumiArray);
182 grLumi->SetHistogram(g1);
184 for (Int_t i=0; i<fNmax; i++) {
185 fLumiArray[i]=fLumiArray[i]/fLuminosity0;
187 TGraph* grLumiN = new TGraph(fNmax, t, fLumiArray);
188 grLumiN->SetHistogram(g2);
190 TGraph* grLumiA = new TGraph(fNmax, t, fAverageLumiArray);
191 grLumiA->SetHistogram(g3);
192 grLumiA->SetLineStyle(2);
194 TGraph* grLumiB = new TGraph(fNmax, t, fBetaStarArray);
195 grLumiB->SetHistogram(g4);
197 TMultiGraph* mg = new TMultiGraph();
203 TCanvas *c1 = new TCanvas(name1,title, 200, 10, 700, 500);
207 mg->GetXaxis()->SetTitle("t (h)");
208 mg->GetYaxis()->SetTitle("L(t)/L0 and <L>/L0");
211 TCanvas *c2 = new TCanvas(name2,title, 200, 10, 700, 500);