]>
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$ */ |
cfe4cfcc | 17 | |
11141716 | 18 | #include "AliLHC.h" |
19 | #include "AliLhcIRegion.h" | |
20 | #include "AliLhcProcess.h" | |
21 | #include "AliLhcBeam.h" | |
22 | ||
23 | ClassImp(AliLHC) | |
24 | ||
25 | AliLHC::AliLHC() | |
26 | { | |
27 | // Constructor | |
28 | fIRegions = new TList; | |
29 | fProcesses = new TList; | |
30 | fNRegions = 0; | |
31 | fNProcesses = 0; | |
32 | fBeams = new TObjArray(2); | |
2682e810 | 33 | //PH (*fBeams)[0] = 0; |
34 | //PH (*fBeams)[1] = 0; | |
35 | fBeams->AddAt(0,0); | |
36 | fBeams->AddAt(0,1); | |
11141716 | 37 | fTime = 0; |
38 | fTimeMax = 0; | |
f5a40182 | 39 | fTimeA = 0; |
11141716 | 40 | } |
41 | ||
42 | AliLHC::AliLHC(const AliLHC& lhc) | |
e76f229f | 43 | : TObject(lhc) |
11141716 | 44 | { |
45 | // copy constructor | |
46 | } | |
47 | ||
48 | AliLHC::~AliLHC() | |
49 | { | |
50 | // Destructor | |
51 | delete fIRegions; | |
52 | delete fProcesses; | |
53 | delete fBeams; | |
54 | } | |
55 | ||
56 | void AliLHC::AddIRegion(AliLhcIRegion *region) | |
57 | { | |
58 | // | |
59 | // Add region to list | |
60 | fIRegions->Add(region); | |
61 | fNRegions++; | |
62 | } | |
63 | ||
64 | void AliLHC::AddProcess(AliLhcProcess *process) | |
65 | { | |
66 | // | |
67 | // Add process to list | |
68 | fProcesses->Add(process); | |
69 | fNProcesses++; | |
70 | } | |
71 | ||
72 | void AliLHC::SetBeams(AliLhcBeam *beam1, AliLhcBeam *beam2 ) | |
73 | { | |
74 | ||
75 | // | |
76 | // Set the beams | |
77 | ||
78 | (*fBeams)[0] = beam1; | |
79 | (*fBeams)[1] = beam2; | |
80 | } | |
81 | ||
82 | void AliLHC::Init() | |
83 | { | |
84 | // Initialisation | |
85 | fNt = 0; | |
86 | fNmax = Int_t(fTimeMax/fTimeStep); | |
87 | fTimeA = new Float_t[fNmax]; | |
88 | // | |
89 | Beam(0)->Init(); | |
90 | Beam(1)->Init(); | |
91 | ||
92 | TIter next(fIRegions); | |
93 | AliLhcIRegion *region; | |
94 | // | |
95 | // Loop over generators and initialize | |
96 | while((region = (AliLhcIRegion*)next())) { | |
97 | region->Init(); | |
98 | region->SetMonitor(fNmax); | |
99 | } | |
100 | ||
101 | Beam(0)->SetMonitor(fNmax); | |
102 | Beam(1)->SetMonitor(fNmax); | |
103 | ||
104 | TIter nextp(fProcesses); | |
105 | AliLhcProcess *process; | |
106 | // | |
107 | // Loop over generators and initialize | |
108 | while((process = (AliLhcProcess*)nextp())) { | |
109 | process->Init(); | |
110 | process->SetMonitor(fNmax); | |
111 | } | |
112 | } | |
113 | ||
114 | void AliLHC::EvolveTime() | |
115 | { | |
116 | // | |
117 | // Simulate Time Evolution | |
118 | // | |
119 | while (fTime <= fTimeMax) { | |
120 | printf("\n Time: %f %f", fTime, fTimeStep); | |
121 | // | |
122 | // Processes | |
123 | // | |
124 | TIter next(fProcesses); | |
125 | AliLhcProcess *process; | |
126 | // | |
127 | // Evolve for each process | |
128 | while((process = (AliLhcProcess*)next())) { | |
129 | process->Evolve(fTimeStep); | |
130 | process->Record(); | |
131 | } | |
132 | // | |
133 | // Update and Monitoring | |
134 | // | |
135 | TIter nextregion(fIRegions); | |
136 | AliLhcIRegion *region; | |
137 | // | |
138 | while((region = (AliLhcIRegion*)nextregion())) { | |
139 | printf("\n Region: %s, Luminosity %10.3e", | |
140 | region->GetName(), region->Luminosity()); | |
141 | region->Update(); | |
142 | region->Record(); | |
143 | } | |
144 | Beam(0)->Record(); | |
145 | fTimeA[fNt] = fTime/3600.; | |
146 | fTime+=fTimeStep; | |
147 | fNt++; | |
148 | } | |
149 | } | |
150 | ||
151 | void AliLHC::Evaluate() | |
152 | { | |
153 | // Evaluation of the results | |
154 | TIter nextregion(fIRegions); | |
155 | AliLhcIRegion *region; | |
156 | // | |
157 | // Loop over generators and initialize | |
158 | while((region = (AliLhcIRegion*)nextregion())) { | |
cfe4cfcc | 159 | region->DrawPlots(); |
11141716 | 160 | } |
161 | ||
162 | TIter next(fProcesses); | |
163 | AliLhcProcess *process; | |
164 | // | |
165 | // Evolve for each process | |
166 | while((process = (AliLhcProcess*)next())) { | |
cfe4cfcc | 167 | process->DrawPlots(); |
11141716 | 168 | } |
169 | ||
cfe4cfcc | 170 | Beam(0)->DrawPlots(); |
11141716 | 171 | } |
172 | ||
e76f229f | 173 | AliLHC& AliLHC::operator=(const AliLHC & /*rhs*/) |
11141716 | 174 | { |
175 | // Assignment operator | |
176 | return *this; | |
177 | } | |
178 | ||
179 |