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 "AliLhcBeam.h"
25 #include <TMultiGraph.h>
29 AliLhcBeam::AliLhcBeam(AliLHC* lhc)
35 AliLhcBeam::AliLhcBeam(const AliLhcBeam& beam)
40 AliLhcBeam::~AliLhcBeam()
46 void AliLhcBeam::Init()
49 printf("\n Initializing Beam");
50 printf("\n ^^^^^^^^^^^^^^^^^");
51 // Scale energy with regidity
53 fGamma = fEnergy/0.938272;
54 fEmittance = fNEmittance/fGamma;
55 fEmittance0 = fEmittance;
57 fEmittanceL0 = fEmittanceL;
60 printf("\n Beam Energy :%10.3e GeV", fEnergy);
61 printf("\n Beam Normalized Emittance :%10.3e cm ", fNEmittance);
62 printf("\n Beam Particles per Bunch :%10.3e ", fN);
65 void AliLhcBeam::RemoveParticles(Float_t loss)
70 void AliLhcBeam::IncreaseEmittance(Float_t de, Float_t del)
72 fEmittance *= (1.+de);
73 fEmittanceL *= (1.+del);
74 fEnergySpread *= (1.+del);
77 AliLhcBeam& AliLhcBeam::operator=(const AliLhcBeam & rhs)
79 // Assignment operator
82 void AliLhcBeam::SetMonitor(Int_t n)
85 if (fEmittanceArray) delete fEmittanceArray;
86 if (fEmittanceLArray) delete fEmittanceLArray;
89 fEmittanceArray = new Float_t[n];
90 fEmittanceLArray = new Float_t[n];
93 void AliLhcBeam::Record()
95 fEmittanceArray [fAccelerator->Nt()] = fEmittance/fEmittance0;
96 fEmittanceLArray[fAccelerator->Nt()] = fEmittanceL/fEmittanceL0;
100 void AliLhcBeam::DrawPlots()
102 // Draw monitor plots
103 Float_t* t = fAccelerator->TimeA();
105 TH1 *e1 = new TH1F("e1","Hor. Emittance",fNmax,0,t[fNmax]);
107 e1->SetMaximum(fEmittanceArray[fNmax]*1.1);
109 e1->GetXaxis()->SetTitle("t (h)");
110 e1->GetYaxis()->SetTitle("rel. Emittance (t)");
112 TH1 *e2 = new TH1F("e2","Long. Emittance",fNmax,0,t[fNmax]);
114 e2->SetMaximum(fEmittanceLArray[fNmax]*1.1);
116 e2->GetXaxis()->SetTitle("t (h)");
117 e2->GetYaxis()->SetTitle("rel. Emittance (t)");
120 TGraph* grE = new TGraph(fNmax, t, fEmittanceArray);
121 grE->SetHistogram(e1);
122 TGraph* grEl = new TGraph(fNmax, t, fEmittanceLArray);
123 grEl->SetHistogram(e2);
124 grEl->SetLineStyle(2);
126 TMultiGraph* mg = new TMultiGraph();
130 TCanvas *c2 = new TCanvas("c2","Emittance Increase", 200, 10, 700, 500);
133 mg->GetXaxis()->SetTitle("t (h)");
134 mg->GetYaxis()->SetTitle("rel. Emittance(t)");