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
26 #include "AliLhcBeam.h"
31 #include <TMultiGraph.h>
35 AliLhcBeam::AliLhcBeam(AliLHC* lhc)
41 AliLhcBeam::AliLhcBeam(const AliLhcBeam& beam)
42 : TNamed(beam), AliLhcMonitor(beam)
47 AliLhcBeam::~AliLhcBeam()
53 void AliLhcBeam::Init()
56 printf("\n Initializing Beam");
57 printf("\n ^^^^^^^^^^^^^^^^^");
58 // Scale energy with regidity
60 fGamma = fEnergy/0.938272;
61 fEmittance = fNEmittance/fGamma;
62 fEmittance0 = fEmittance;
64 fEmittanceL0 = fEmittanceL;
67 printf("\n Beam Energy :%10.3e GeV", fEnergy);
68 printf("\n Beam Normalized Emittance :%10.3e cm ", fNEmittance);
69 printf("\n Beam Particles per Bunch :%10.3e ", fN);
72 void AliLhcBeam::RemoveParticles(Float_t loss)
77 void AliLhcBeam::IncreaseEmittance(Float_t de, Float_t del)
80 // Increase the emittance
81 fEmittance *= (1.+de);
82 fEmittanceL *= (1.+del);
83 fEnergySpread *= (1.+del);
86 AliLhcBeam& AliLhcBeam::operator=(const AliLhcBeam & /*rhs*/)
88 // Assignment operator
91 void AliLhcBeam::SetMonitor(Int_t n)
94 // Initialize a monitor with n time bins
96 if (fEmittanceArray) delete fEmittanceArray;
97 if (fEmittanceLArray) delete fEmittanceLArray;
100 fEmittanceArray = new Float_t[n];
101 fEmittanceLArray = new Float_t[n];
104 void AliLhcBeam::Record()
106 fEmittanceArray [fAccelerator->Nt()] = fEmittance/fEmittance0;
107 fEmittanceLArray[fAccelerator->Nt()] = fEmittanceL/fEmittanceL0;
111 void AliLhcBeam::DrawPlots()
113 // Draw monitor plots
114 Float_t* t = fAccelerator->TimeA();
116 TH1 *e1 = new TH1F("e1","Hor. Emittance",fNmax,0,t[fNmax]);
118 e1->SetMaximum(fEmittanceArray[fNmax]*1.1);
120 e1->GetXaxis()->SetTitle("t (h)");
121 e1->GetYaxis()->SetTitle("rel. Emittance (t)");
123 TH1 *e2 = new TH1F("e2","Long. Emittance",fNmax,0,t[fNmax]);
125 e2->SetMaximum(fEmittanceLArray[fNmax]*1.1);
127 e2->GetXaxis()->SetTitle("t (h)");
128 e2->GetYaxis()->SetTitle("rel. Emittance (t)");
131 TGraph* grE = new TGraph(fNmax, t, fEmittanceArray);
132 grE->SetHistogram(e1);
133 TGraph* grEl = new TGraph(fNmax, t, fEmittanceLArray);
134 grEl->SetHistogram(e2);
135 grEl->SetLineStyle(2);
137 TMultiGraph* mg = new TMultiGraph();
141 TCanvas *c2 = new TCanvas("c2","Emittance Increase", 200, 10, 700, 500);
144 mg->GetXaxis()->SetTitle("t (h)");
145 mg->GetYaxis()->SetTitle("rel. Emittance(t)");