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 // Class that holds all parameters about an LHC beam.
19 // The parameters can change with time.
20 // A monitor can be set that stores the time distribution of
21 // emittance and number of particles per bunch.
22 // Author: Andreas Morsch
23 // andreas.morsch@cern.ch
30 #include <TMultiGraph.h>
32 #include "AliLhcBeam.h"
37 AliLhcBeam::AliLhcBeam(AliLHC* lhc):
58 AliLhcBeam::AliLhcBeam(const AliLhcBeam& beam):
59 TNamed(beam), AliLhcMonitor(beam),
80 AliLhcBeam::~AliLhcBeam()
86 void AliLhcBeam::Init()
89 printf("\n Initializing Beam");
90 printf("\n ^^^^^^^^^^^^^^^^^");
91 // Scale energy with regidity
93 fGamma = fEnergy/0.938272;
94 fEmittance = fNEmittance/fGamma;
95 fEmittance0 = fEmittance;
97 fEmittanceL0 = fEmittanceL;
100 printf("\n Beam Energy :%10.3e GeV", fEnergy);
101 printf("\n Beam Normalized Emittance :%10.3e cm ", fNEmittance);
102 printf("\n Beam Particles per Bunch :%10.3e ", fN);
105 void AliLhcBeam::RemoveParticles(Float_t loss)
110 void AliLhcBeam::IncreaseEmittance(Float_t de, Float_t del)
113 // Increase the emittance
114 fEmittance *= (1.+de);
115 fEmittanceL *= (1.+del);
116 fEnergySpread *= (1.+del);
119 AliLhcBeam& AliLhcBeam::operator=(const AliLhcBeam & /*rhs*/)
121 // Assignment operator
124 void AliLhcBeam::SetMonitor(Int_t n)
127 // Initialize a monitor with n time bins
129 if (fEmittanceArray) delete fEmittanceArray;
130 if (fEmittanceLArray) delete fEmittanceLArray;
133 fEmittanceArray = new Float_t[n];
134 fEmittanceLArray = new Float_t[n];
137 void AliLhcBeam::Record()
139 fEmittanceArray [fAccelerator->Nt()] = fEmittance/fEmittance0;
140 fEmittanceLArray[fAccelerator->Nt()] = fEmittanceL/fEmittanceL0;
144 void AliLhcBeam::DrawPlots()
146 // Draw monitor plots
147 Float_t* t = fAccelerator->TimeA();
149 TH1 *e1 = new TH1F("e1","Hor. Emittance",fNmax,0,t[fNmax]);
151 e1->SetMaximum(fEmittanceArray[fNmax]*1.1);
153 e1->GetXaxis()->SetTitle("t (h)");
154 e1->GetYaxis()->SetTitle("rel. Emittance (t)");
156 TH1 *e2 = new TH1F("e2","Long. Emittance",fNmax,0,t[fNmax]);
158 e2->SetMaximum(fEmittanceLArray[fNmax]*1.1);
160 e2->GetXaxis()->SetTitle("t (h)");
161 e2->GetYaxis()->SetTitle("rel. Emittance (t)");
164 TGraph* grE = new TGraph(fNmax, t, fEmittanceArray);
165 grE->SetHistogram(e1);
166 TGraph* grEl = new TGraph(fNmax, t, fEmittanceLArray);
167 grEl->SetHistogram(e2);
168 grEl->SetLineStyle(2);
170 TMultiGraph* mg = new TMultiGraph();
174 TCanvas *c2 = new TCanvas("c2","Emittance Increase", 200, 10, 700, 500);
177 mg->GetXaxis()->SetTitle("t (h)");
178 mg->GetYaxis()->SetTitle("rel. Emittance(t)");