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 "AliLhcBeam.h"
23 #include <TMultiGraph.h>
27 AliLhcBeam::AliLhcBeam(AliLHC* lhc)
33 AliLhcBeam::AliLhcBeam(const AliLhcBeam& beam)
38 AliLhcBeam::~AliLhcBeam()
44 void AliLhcBeam::Init()
47 printf("\n Initializing Beam");
48 printf("\n ^^^^^^^^^^^^^^^^^");
49 // Scale energy with regidity
51 fGamma = fEnergy/0.938272;
52 fEmittance = fNEmittance/fGamma;
53 fEmittance0 = fEmittance;
55 fEmittanceL0 = fEmittanceL;
58 printf("\n Beam Energy :%10.3e GeV", fEnergy);
59 printf("\n Beam Normalized Emittance :%10.3e cm ", fNEmittance);
60 printf("\n Beam Particles per Bunch :%10.3e ", fN);
63 void AliLhcBeam::RemoveParticles(Float_t loss)
68 void AliLhcBeam::IncreaseEmittance(Float_t de, Float_t del)
70 fEmittance *= (1.+de);
71 fEmittanceL *= (1.+del);
72 fEnergySpread *= (1.+del);
75 AliLhcBeam& AliLhcBeam::operator=(const AliLhcBeam & rhs)
77 // Assignment operator
80 void AliLhcBeam::SetMonitor(Int_t n)
83 if (fEmittanceArray) delete fEmittanceArray;
84 if (fEmittanceLArray) delete fEmittanceLArray;
87 fEmittanceArray = new Float_t[n];
88 fEmittanceLArray = new Float_t[n];
91 void AliLhcBeam::Record()
93 fEmittanceArray [fAccelerator->Nt()] = fEmittance/fEmittance0;
94 fEmittanceLArray[fAccelerator->Nt()] = fEmittanceL/fEmittanceL0;
98 void AliLhcBeam::DrawPlots()
100 // Draw monitor plots
101 Float_t* t = fAccelerator->TimeA();
103 TH1 *e1 = new TH1F("e1","Hor. Emittance",fNmax,0,t[fNmax]);
105 e1->SetMaximum(fEmittanceArray[fNmax]*1.1);
107 e1->GetXaxis()->SetTitle("t (h)");
108 e1->GetYaxis()->SetTitle("rel. Emittance (t)");
110 TH1 *e2 = new TH1F("e2","Long. Emittance",fNmax,0,t[fNmax]);
112 e2->SetMaximum(fEmittanceLArray[fNmax]*1.1);
114 e2->GetXaxis()->SetTitle("t (h)");
115 e2->GetYaxis()->SetTitle("rel. Emittance (t)");
118 TGraph* grE = new TGraph(fNmax, t, fEmittanceArray);
119 grE->SetHistogram(e1);
120 TGraph* grEl = new TGraph(fNmax, t, fEmittanceLArray);
121 grEl->SetHistogram(e2);
122 grEl->SetLineStyle(2);
124 TMultiGraph* mg = new TMultiGraph();
128 TCanvas *c2 = new TCanvas("c2","Emittance Increase", 200, 10, 700, 500);
131 mg->GetXaxis()->SetTitle("t (h)");
132 mg->GetYaxis()->SetTitle("rel. Emittance(t)");