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