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