]> git.uio.no Git - u/mrichter/AliRoot.git/blame - LHC/AliLhcBeam.cxx
monitor histograms for HLT added
[u/mrichter/AliRoot.git] / LHC / AliLhcBeam.cxx
CommitLineData
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$ */
11141716 17
18#include "AliLhcBeam.h"
19#include "AliLHC.h"
20#include <TMath.h>
21#include <TCanvas.h>
22#include <TGraph.h>
23#include <TMultiGraph.h>
24
25ClassImp(AliLhcBeam)
26
27AliLhcBeam::AliLhcBeam(AliLHC* lhc)
28{
29// Constructor
30 fAccelerator = lhc;
31}
32
33AliLhcBeam::AliLhcBeam(const AliLhcBeam& beam)
34{
35// copy constructor
36}
37
38AliLhcBeam::~AliLhcBeam()
39{
40// Destructor
41
42}
43
44void AliLhcBeam::Init()
45{
46 // Initialization
47 printf("\n Initializing Beam");
48 printf("\n ^^^^^^^^^^^^^^^^^");
49 // Scale energy with regidity
50 fEnergy *= fZ/fA;
51 fGamma = fEnergy/0.938272;
52 fEmittance = fNEmittance/fGamma;
53 fEmittance0 = fEmittance;
54 fEmittanceL *= fZ;
55 fEmittanceL0 = fEmittanceL;
56 fN0=fN;
57
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);
61}
62
63void AliLhcBeam::RemoveParticles(Float_t loss)
64{
65 fN-=loss;
66}
67
68void AliLhcBeam::IncreaseEmittance(Float_t de, Float_t del)
69{
70 fEmittance *= (1.+de);
71 fEmittanceL *= (1.+del);
72 fEnergySpread *= (1.+del);
73}
74
75AliLhcBeam& AliLhcBeam::operator=(const AliLhcBeam & rhs)
76{
77// Assignment operator
78 return *this;
79}
80void AliLhcBeam::SetMonitor(Int_t n)
81{
82 fNmax = n;
83 if (fEmittanceArray) delete fEmittanceArray;
84 if (fEmittanceLArray) delete fEmittanceLArray;
85
86
87 fEmittanceArray = new Float_t[n];
88 fEmittanceLArray = new Float_t[n];
89}
90
91void AliLhcBeam::Record()
92{
93 fEmittanceArray [fAccelerator->Nt()] = fEmittance/fEmittance0;
94 fEmittanceLArray[fAccelerator->Nt()] = fEmittanceL/fEmittanceL0;
95}
96
97
98void AliLhcBeam::DrawPlots()
99{
100 // Draw monitor plots
101 Float_t* t = fAccelerator->TimeA();
102
103 TH1 *e1 = new TH1F("e1","Hor. Emittance",fNmax,0,t[fNmax]);
104 e1->SetMinimum(1);
105 e1->SetMaximum(fEmittanceArray[fNmax]*1.1);
106 e1->SetStats(0);
107 e1->GetXaxis()->SetTitle("t (h)");
108 e1->GetYaxis()->SetTitle("rel. Emittance (t)");
109
110 TH1 *e2 = new TH1F("e2","Long. Emittance",fNmax,0,t[fNmax]);
111 e2->SetMinimum(1);
112 e2->SetMaximum(fEmittanceLArray[fNmax]*1.1);
113 e2->SetStats(0);
114 e2->GetXaxis()->SetTitle("t (h)");
115 e2->GetYaxis()->SetTitle("rel. Emittance (t)");
116
117
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);
123
124 TMultiGraph* mg = new TMultiGraph();
125 mg->Add(grE);
126 mg->Add(grEl);
127
128 TCanvas *c2 = new TCanvas("c2","Emittance Increase", 200, 10, 700, 500);
129 c2->SetGrid();
130 mg->Draw("AC");
131 mg->GetXaxis()->SetTitle("t (h)");
132 mg->GetYaxis()->SetTitle("rel. Emittance(t)");
133 mg->Draw("AC");
134}
135
136
137
138