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)
34 : TNamed(beam), AliLhcMonitor(beam)
39 AliLhcBeam::~AliLhcBeam()
45 void AliLhcBeam::Init()
48 printf("\n Initializing Beam");
49 printf("\n ^^^^^^^^^^^^^^^^^");
50 // Scale energy with regidity
52 fGamma = fEnergy/0.938272;
53 fEmittance = fNEmittance/fGamma;
54 fEmittance0 = fEmittance;
56 fEmittanceL0 = fEmittanceL;
59 printf("\n Beam Energy :%10.3e GeV", fEnergy);
60 printf("\n Beam Normalized Emittance :%10.3e cm ", fNEmittance);
61 printf("\n Beam Particles per Bunch :%10.3e ", fN);
64 void AliLhcBeam::RemoveParticles(Float_t loss)
69 void AliLhcBeam::IncreaseEmittance(Float_t de, Float_t del)
71 fEmittance *= (1.+de);
72 fEmittanceL *= (1.+del);
73 fEnergySpread *= (1.+del);
76 AliLhcBeam& AliLhcBeam::operator=(const AliLhcBeam & /*rhs*/)
78 // Assignment operator
81 void AliLhcBeam::SetMonitor(Int_t n)
84 if (fEmittanceArray) delete fEmittanceArray;
85 if (fEmittanceLArray) delete fEmittanceLArray;
88 fEmittanceArray = new Float_t[n];
89 fEmittanceLArray = new Float_t[n];
92 void AliLhcBeam::Record()
94 fEmittanceArray [fAccelerator->Nt()] = fEmittance/fEmittance0;
95 fEmittanceLArray[fAccelerator->Nt()] = fEmittanceL/fEmittanceL0;
99 void AliLhcBeam::DrawPlots()
101 // Draw monitor plots
102 Float_t* t = fAccelerator->TimeA();
104 TH1 *e1 = new TH1F("e1","Hor. Emittance",fNmax,0,t[fNmax]);
106 e1->SetMaximum(fEmittanceArray[fNmax]*1.1);
108 e1->GetXaxis()->SetTitle("t (h)");
109 e1->GetYaxis()->SetTitle("rel. Emittance (t)");
111 TH1 *e2 = new TH1F("e2","Long. Emittance",fNmax,0,t[fNmax]);
113 e2->SetMaximum(fEmittanceLArray[fNmax]*1.1);
115 e2->GetXaxis()->SetTitle("t (h)");
116 e2->GetYaxis()->SetTitle("rel. Emittance (t)");
119 TGraph* grE = new TGraph(fNmax, t, fEmittanceArray);
120 grE->SetHistogram(e1);
121 TGraph* grEl = new TGraph(fNmax, t, fEmittanceLArray);
122 grEl->SetHistogram(e2);
123 grEl->SetLineStyle(2);
125 TMultiGraph* mg = new TMultiGraph();
129 TCanvas *c2 = new TCanvas("c2","Emittance Increase", 200, 10, 700, 500);
132 mg->GetXaxis()->SetTitle("t (h)");
133 mg->GetYaxis()->SetTitle("rel. Emittance(t)");