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 "AliLhcProcessIBS.h"
22 #include "AliLhcIRegion.h"
23 #include "AliLhcBeam.h"
29 #include <TMultiGraph.h>
31 ClassImp(AliLhcProcessIBS)
33 Double_t func(Double_t *x, Double_t *par);
35 AliLhcProcessIBS::AliLhcProcessIBS(AliLHC* lhc, const char* name, const char* title)
36 :AliLhcProcess(lhc,name,title)
42 AliLhcProcessIBS::~AliLhcProcessIBS()
48 void AliLhcProcessIBS::Init()
51 const Float_t r0=1.535e-16;
53 printf("\n Initializing Process %s", GetName());
54 printf("\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
56 fIRegions = fAccelerator->IRegions();
58 for (Int_t i = 0; i < 2; i++) {
59 fBeam[i] = fAccelerator->Beam(i);
60 fR[i] = r0*fBeam[i]->Z()*fBeam[i]->Z()/fBeam[i]->A();
61 fE[i] = 0.938*fBeam[i]->A();
65 void AliLhcProcessIBS::Evolve(Float_t dt)
67 printf("\n Here process %s %f:", GetName(), dt);
68 for (Int_t i=0; i<2; i++) {
70 Float_t sige = fBeam[i]->EnergySpread();
71 Float_t avbeta = fAccelerator->AverageBeta();
72 Float_t avd = fAccelerator->AverageDisp();
74 Float_t gamma = fBeam[i]->Gamma();
75 Float_t epsx = fBeam[i]->Emittance()*gamma;
77 Float_t epse = fBeam[i]->LongEmittance();
78 Float_t sigxb = TMath::Sqrt(epsx/gamma*avbeta);
79 Float_t sigx = TMath::Sqrt(sigxb*sigxb+(avd*avd*sige*sige));
80 Float_t ssigx = TMath::Sqrt(epsx/gamma/avbeta);
82 Float_t ssigy = ssigx;
84 Float_t asd = fBeam[i]->N()*fR[i]*fR[i]*fE[i]/
85 (16.*TMath::Pi()*gamma*epsx*epsy*epse);
88 Float_t d = sige*avd/sigx;
90 Float_t at = sige*TMath::Sqrt(1.-d*d)/(gamma*ssigx);
91 Float_t bt = sige*TMath::Sqrt(1.-d*d)/(gamma*ssigy);
92 Float_t ct = sige*TMath::Sqrt(1.-d*d)*TMath::Sqrt(4.*sigy/fR[i]);
98 TF1 *fct = new TF1("func",func, 0., 1., 3);
100 Float_t f = (Float_t) 8.0*TMath::Pi()*
101 fct->Integral(0., 1., par, 1.e-5);
103 fTaux = 1./(asd*f*(d*d-at*at/2.));
104 fTaue = 1./(asd*f*(1.-d*d));
105 // printf("\n taux, taue %f %f", taux, taue);
106 // Float_t tauy = -2./at*at/asd/f;
107 fBeam[i]->IncreaseEmittance(dt/fTaux, dt/fTaue);
112 void AliLhcProcessIBS::SetMonitor(Int_t n)
114 // Initialize Monitor
115 if (fTauxArray) delete fTauxArray;
116 if (fTaueArray) delete fTaueArray;
117 fTauxArray = new Float_t[n];
118 fTaueArray = new Float_t[n];
122 void AliLhcProcessIBS::Record()
124 // Record monitor quantities
125 fTauxArray[fAccelerator->Nt()] = fTaux/3600.;
126 fTaueArray[fAccelerator->Nt()] = fTaue/3600.;
130 void AliLhcProcessIBS::DrawPlots()
132 // Draw monitor plots
133 Float_t* t = fAccelerator->TimeA();
135 TH1 *t1 = new TH1F("t1","Hor. IBS growth time",fNmax,0,t[fNmax]);
137 t1->SetMaximum(fTauxArray[fNmax]*1.1);
139 t1->GetXaxis()->SetTitle("t (h)");
140 t1->GetYaxis()->SetTitle("tau_x (t)");
142 TH1 *t2 = new TH1F("t2","Long. IBS growth time",fNmax,0,t[fNmax]);
144 t2->SetMaximum(fTaueArray[fNmax]*1.1);
146 t2->GetXaxis()->SetTitle("t (h)");
147 t2->GetYaxis()->SetTitle("tau_l (t)");
149 TGraph* grTaux = new TGraph(fNmax, fAccelerator->TimeA(), fTauxArray);
150 grTaux->SetHistogram(t1);
152 TGraph* grTaue = new TGraph(fNmax, fAccelerator->TimeA(), fTaueArray);
153 grTaue->SetHistogram(t2);
154 grTaue->SetLineStyle(2);
156 TMultiGraph* mg = new TMultiGraph();
160 TCanvas *c3 = new TCanvas("c3","IBS", 200, 10, 700, 500);
163 mg->GetXaxis()->SetTitle("t (h)");
164 mg->GetYaxis()->SetTitle("IBS Growth Time (h)");
172 AliLhcProcessIBS& AliLhcProcessIBS::operator=(const AliLhcProcessIBS & rhs)
174 // Assignment operator
178 Double_t func(Double_t *x, Double_t *par)
182 Double_t cc = par[2];
184 const Double_t bc = 0.5772;
188 Double_t p=1.0/TMath::Sqrt(x2+a*a*x1);
189 Double_t q=1.0/TMath::Sqrt(x2+b*b*x1);
190 return (1.0-3.0*x2)*p*q*(2.0*TMath::Log(0.5*cc*(p+q))-bc);