]>
Commit | Line | Data |
---|---|---|
11141716 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
803d1ab0 | 16 | /* $Id$ */ |
21aa51f2 | 17 | // |
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 | |
24 | // | |
11141716 | 25 | |
26 | #include "AliLhcBeam.h" | |
27 | #include "AliLHC.h" | |
28 | #include <TMath.h> | |
29 | #include <TCanvas.h> | |
30 | #include <TGraph.h> | |
31 | #include <TMultiGraph.h> | |
32 | ||
33 | ClassImp(AliLhcBeam) | |
34 | ||
35 | AliLhcBeam::AliLhcBeam(AliLHC* lhc) | |
36 | { | |
37 | // Constructor | |
38 | fAccelerator = lhc; | |
39 | } | |
40 | ||
41 | AliLhcBeam::AliLhcBeam(const AliLhcBeam& beam) | |
e76f229f | 42 | : TNamed(beam), AliLhcMonitor(beam) |
11141716 | 43 | { |
44 | // copy constructor | |
45 | } | |
46 | ||
47 | AliLhcBeam::~AliLhcBeam() | |
48 | { | |
49 | // Destructor | |
50 | ||
51 | } | |
52 | ||
53 | void AliLhcBeam::Init() | |
54 | { | |
55 | // Initialization | |
56 | printf("\n Initializing Beam"); | |
57 | printf("\n ^^^^^^^^^^^^^^^^^"); | |
58 | // Scale energy with regidity | |
59 | fEnergy *= fZ/fA; | |
60 | fGamma = fEnergy/0.938272; | |
61 | fEmittance = fNEmittance/fGamma; | |
62 | fEmittance0 = fEmittance; | |
63 | fEmittanceL *= fZ; | |
64 | fEmittanceL0 = fEmittanceL; | |
65 | fN0=fN; | |
66 | ||
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); | |
70 | } | |
71 | ||
72 | void AliLhcBeam::RemoveParticles(Float_t loss) | |
73 | { | |
74 | fN-=loss; | |
75 | } | |
76 | ||
77 | void AliLhcBeam::IncreaseEmittance(Float_t de, Float_t del) | |
78 | { | |
21aa51f2 | 79 | // |
80 | // Increase the emittance | |
11141716 | 81 | fEmittance *= (1.+de); |
82 | fEmittanceL *= (1.+del); | |
83 | fEnergySpread *= (1.+del); | |
84 | } | |
85 | ||
e76f229f | 86 | AliLhcBeam& AliLhcBeam::operator=(const AliLhcBeam & /*rhs*/) |
11141716 | 87 | { |
88 | // Assignment operator | |
89 | return *this; | |
90 | } | |
91 | void AliLhcBeam::SetMonitor(Int_t n) | |
92 | { | |
21aa51f2 | 93 | // |
94 | // Initialize a monitor with n time bins | |
11141716 | 95 | fNmax = n; |
96 | if (fEmittanceArray) delete fEmittanceArray; | |
97 | if (fEmittanceLArray) delete fEmittanceLArray; | |
98 | ||
99 | ||
100 | fEmittanceArray = new Float_t[n]; | |
101 | fEmittanceLArray = new Float_t[n]; | |
102 | } | |
103 | ||
104 | void AliLhcBeam::Record() | |
105 | { | |
106 | fEmittanceArray [fAccelerator->Nt()] = fEmittance/fEmittance0; | |
107 | fEmittanceLArray[fAccelerator->Nt()] = fEmittanceL/fEmittanceL0; | |
108 | } | |
109 | ||
110 | ||
111 | void AliLhcBeam::DrawPlots() | |
112 | { | |
113 | // Draw monitor plots | |
114 | Float_t* t = fAccelerator->TimeA(); | |
115 | ||
116 | TH1 *e1 = new TH1F("e1","Hor. Emittance",fNmax,0,t[fNmax]); | |
117 | e1->SetMinimum(1); | |
118 | e1->SetMaximum(fEmittanceArray[fNmax]*1.1); | |
119 | e1->SetStats(0); | |
120 | e1->GetXaxis()->SetTitle("t (h)"); | |
121 | e1->GetYaxis()->SetTitle("rel. Emittance (t)"); | |
122 | ||
123 | TH1 *e2 = new TH1F("e2","Long. Emittance",fNmax,0,t[fNmax]); | |
124 | e2->SetMinimum(1); | |
125 | e2->SetMaximum(fEmittanceLArray[fNmax]*1.1); | |
126 | e2->SetStats(0); | |
127 | e2->GetXaxis()->SetTitle("t (h)"); | |
128 | e2->GetYaxis()->SetTitle("rel. Emittance (t)"); | |
129 | ||
130 | ||
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); | |
136 | ||
137 | TMultiGraph* mg = new TMultiGraph(); | |
138 | mg->Add(grE); | |
139 | mg->Add(grEl); | |
140 | ||
141 | TCanvas *c2 = new TCanvas("c2","Emittance Increase", 200, 10, 700, 500); | |
142 | c2->SetGrid(); | |
143 | mg->Draw("AC"); | |
144 | mg->GetXaxis()->SetTitle("t (h)"); | |
145 | mg->GetYaxis()->SetTitle("rel. Emittance(t)"); | |
146 | mg->Draw("AC"); | |
147 | } | |
148 | ||
149 | ||
150 | ||
151 |