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