]>
Commit | Line | Data |
---|---|---|
45a58699 | 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 | /* $Id$ */ | |
17 | ||
18 | ||
19 | //________________________________________________________________________ | |
20 | // Initial JetFinder input object | |
21 | // -- | |
22 | //*-- Author: Mark Horner (LBL/UCT) | |
23 | // -- | |
24 | // -- | |
25 | // -- | |
26 | ||
27 | ||
28 | ||
29 | #include "AliEMCALJetFinderInput.h" | |
30 | #include "AliEMCALDigit.h" | |
31 | #include "AliEMCALGeometry.h" | |
32 | #include "AliEMCALParton.h" | |
33 | class TClonesArray; | |
34 | ||
35 | ||
36 | ClassImp(AliEMCALJetFinderInput) | |
37 | ||
38 | AliEMCALJetFinderInput::AliEMCALJetFinderInput(): | |
18a21c7c | 39 | fDigitsArray(0),fNDigits(0),fNMaxDigits(0),fTracksArray(0),fNTracks(0),fNMaxTracks(0), |
40 | fPartonsArray(0),fNPartons(0),fNMaxPartons(0),fParticlesArray(0), | |
41 | fNParticles(0),fNMaxParticles(0),fDebug(0),fInitialised(0) | |
45a58699 | 42 | { |
43 | // Default constructor | |
44 | // Defines all TClonesArrays | |
45 | // Creates full array of Digits - all other arrays will have objects created as necessary | |
46 | ||
47 | //if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning Constructor"); | |
48 | fDebug=0; | |
49 | fInitialised = kFALSE; | |
50 | fNDigits = 19152; // This is the number of digits | |
51 | fNMaxDigits = fNDigits; | |
52 | fNMaxTracks = 3000; | |
53 | fNMaxParticles = 2000; | |
54 | fNMaxPartons = 4; | |
55 | fNTracks = 0; | |
56 | fNPartons = 0; | |
57 | fNParticles = 0; | |
58 | ||
59 | } | |
60 | ||
18a21c7c | 61 | |
62 | AliEMCALJetFinderInput::AliEMCALJetFinderInput(const AliEMCALJetFinderInput& ji) | |
63 | : TObject(ji), fDigitsArray(ji.fDigitsArray),fNDigits(ji.fNDigits),fNMaxDigits(ji.fNMaxDigits), | |
64 | fTracksArray(ji.fTracksArray),fNTracks(ji.fNTracks),fNMaxTracks(ji.fNMaxTracks), | |
65 | fPartonsArray(ji.fPartonsArray),fNPartons(ji.fNPartons),fNMaxPartons(ji.fNMaxPartons), | |
66 | fParticlesArray(ji.fParticlesArray),fNParticles(ji.fNParticles),fNMaxParticles(ji.fNMaxParticles), | |
67 | fDebug(ji.fDebug),fInitialised(ji.fInitialised) | |
68 | { | |
69 | //copy ctor | |
70 | } | |
71 | ||
45a58699 | 72 | void AliEMCALJetFinderInput::InitArrays() |
73 | { | |
74 | if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning InitArrays"); | |
75 | fNDigits = 19152; // This is the number of digits | |
76 | fNMaxDigits = fNDigits; | |
77 | fNMaxTracks = 3000; | |
78 | fNMaxParticles = 2000; | |
79 | fNMaxPartons = 4; | |
80 | ||
81 | fDigitsArray = new TClonesArray ("AliEMCALDigit",fNDigits); // This is the digits array for the EMCAL | |
82 | fTracksArray = new TClonesArray("TParticle",fNMaxTracks); | |
83 | fPartonsArray = new TClonesArray("AliEMCALParton",fNMaxPartons); | |
84 | fParticlesArray = new TClonesArray ("TParticle",fNMaxParticles); | |
85 | ||
86 | for (Int_t i = 0; i < 19152; i++) | |
87 | { | |
88 | AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1); | |
89 | tempdigit.SetAmp(0); | |
90 | // AliEMCALDigit(0,0,i+1,0,1.0,-1) | |
91 | new((*fDigitsArray)[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero | |
92 | } | |
93 | fNTracks = 0; | |
94 | fNPartons = 0; | |
95 | fNParticles = 0; | |
96 | fInitialised = kTRUE; | |
97 | } | |
98 | ||
99 | ||
100 | AliEMCALJetFinderInput::~AliEMCALJetFinderInput() | |
101 | { | |
102 | // Destructor - | |
103 | ||
104 | if (fDebug>0) Info("~AliEMCALJetFinderInput","Beginning Destructor"); | |
105 | if (fInitialised) | |
106 | { | |
107 | fDigitsArray->Delete(); | |
108 | fTracksArray->Delete(); | |
109 | fPartonsArray->Delete(); | |
110 | fParticlesArray->Delete(); | |
111 | delete fDigitsArray; | |
112 | delete fTracksArray; | |
113 | delete fPartonsArray; | |
114 | delete fParticlesArray; | |
115 | } | |
116 | ||
117 | } | |
118 | ||
119 | void AliEMCALJetFinderInput::Reset(AliEMCALJetFinderResetType_t resettype) | |
120 | { | |
121 | // Clears the contents of all the arrays and returns to the state we were in | |
122 | // after the constructor | |
123 | if (fDebug>1) Info("Reset","Beginning Reset"); | |
124 | ||
125 | if (!fInitialised) InitArrays(); | |
126 | ||
127 | if ( resettype == kResetData || | |
128 | resettype == kResetDigits || | |
129 | resettype == kResetAll ){ | |
130 | if (fInitialised) | |
131 | { | |
132 | fDigitsArray->Delete(); | |
133 | fTracksArray->Delete(); | |
134 | fPartonsArray->Delete(); | |
135 | fParticlesArray->Delete(); | |
136 | } | |
137 | for (Int_t i = 0; i < 19152; i++) | |
138 | { | |
139 | AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1); | |
140 | tempdigit.SetAmp(0); | |
141 | new((*fDigitsArray)[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero | |
142 | } | |
143 | } | |
144 | if ( resettype == kResetData || | |
145 | resettype == kResetTracks || | |
146 | resettype == kResetAll ){ | |
147 | fNTracks = 0; | |
148 | } | |
149 | if ( resettype == kResetData || | |
150 | resettype == kResetPartons || | |
151 | resettype == kResetAll ){ | |
152 | fNPartons=0; | |
153 | } | |
154 | if ( resettype == kResetData || | |
155 | resettype == kResetParticles || | |
156 | resettype == kResetAll ){ | |
157 | fNParticles = 0; | |
158 | } | |
159 | ||
160 | } | |
161 | void AliEMCALJetFinderInput::AddEnergyToDigit(Int_t digitID,Int_t denergy) | |
162 | { | |
163 | // Adds energy to the digit specified - Note these are tower IDs and | |
164 | // so start at 1! | |
165 | ||
166 | if (fDebug>15) Info("AddEnergyToDigit","Beginning AddEnergyToDigit"); | |
167 | if (!fInitialised) InitArrays(); | |
168 | ||
169 | Int_t amp = 0; | |
170 | AliEMCALDigit *mydigit = (AliEMCALDigit*)(*fDigitsArray)[digitID]; | |
171 | amp = mydigit->GetAmp(); | |
172 | mydigit->SetAmp(amp+denergy); | |
173 | } | |
174 | ||
175 | void AliEMCALJetFinderInput::AddTrack(TParticle track) | |
176 | { | |
177 | // Adds a TParticle to the track array | |
178 | ||
179 | if (fDebug>5) Info("AddTrack","Beginning AddTrack"); | |
180 | ||
181 | if (!fInitialised) InitArrays(); | |
182 | if (fNTracks < fNMaxTracks){ | |
183 | new((*fTracksArray)[fNTracks]) TParticle(track); | |
184 | fNTracks++; | |
185 | if (fDebug>5) Info("AddTracks","Added Tracks %i",fNTracks); | |
186 | }else | |
187 | { | |
188 | Error("AddTracks","Cannot AddTrack - maximum exceeded"); | |
189 | } | |
190 | ||
191 | } | |
192 | ||
193 | void AliEMCALJetFinderInput::AddTrack(TMCParticle *track) | |
194 | { | |
195 | // Adds a TParticle to the particle array | |
196 | ||
197 | if (fDebug>5) Info("AddTrack","Beginning AddTrack"); | |
198 | ||
199 | if (!fInitialised) InitArrays(); | |
200 | if (fNTracks < fNMaxTracks){ | |
201 | new((*fTracksArray)[fNTracks]) | |
202 | TParticle(track->GetKF(), track->GetKS(), track->GetParent(), 0, | |
203 | track->GetFirstChild(), track->GetLastChild(), | |
204 | track->GetPx(), track->GetPy(), track->GetPz(), | |
205 | track->GetEnergy(), | |
206 | track->GetVx(), track->GetVy(), track->GetVz(), | |
207 | track->GetTime()); | |
208 | fNTracks++; | |
209 | if (fDebug>5) Info("AddTrack","Added Track %i",fNTracks); | |
210 | } else { | |
211 | Error("AddTrack","Cannot AddTrack - maximum exceeded"); | |
212 | } | |
213 | } | |
214 | ||
215 | ||
216 | void AliEMCALJetFinderInput::AddParton(AliEMCALParton *parton) | |
217 | { | |
218 | // Adds an AliEMCALParton to the parton array | |
219 | ||
220 | if (fDebug>5) Info("AddParton","Beginning AddParton"); | |
221 | ||
222 | if (!fInitialised) InitArrays(); | |
223 | if (fNPartons < fNMaxPartons){ | |
224 | new((*fPartonsArray)[fNPartons]) AliEMCALParton(*parton); | |
225 | fNPartons++; | |
226 | if (fDebug>5) Info("AddParton","Added Parton %i",fNPartons); | |
227 | }else | |
228 | { | |
229 | Error("AddParton","Cannot AddParton - maximum exceeded"); | |
230 | } | |
231 | } | |
232 | ||
233 | void AliEMCALJetFinderInput::AddParticle(TParticle *particle) | |
234 | { | |
235 | // Adds a TParticle to the particle array | |
236 | ||
237 | if (fDebug>5) Info("AddParticle","Beginning AddParticle"); | |
238 | ||
239 | if (!fInitialised) InitArrays(); | |
240 | if (fNParticles < fNMaxParticles){ | |
241 | new((*fParticlesArray)[fNParticles]) TParticle(*particle); | |
242 | fNParticles++; | |
243 | if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles); | |
244 | }else | |
245 | { | |
246 | Error("AddParticle","Cannot AddParticle - maximum exceeded"); | |
247 | } | |
248 | ||
249 | } | |
250 | ||
251 | void AliEMCALJetFinderInput::AddParticle(TMCParticle *particle) | |
252 | { | |
253 | // Adds a TParticle to the particle array | |
254 | ||
255 | if (fDebug>5) Info("AddParticle","Beginning AddParticle"); | |
256 | ||
257 | if (!fInitialised) InitArrays(); | |
258 | if (fNParticles < fNMaxParticles){ | |
259 | new((*fParticlesArray)[fNParticles]) | |
260 | TParticle(particle->GetKF(), particle->GetKS(), particle->GetParent(), 0, | |
261 | particle->GetFirstChild(), particle->GetLastChild(), | |
262 | particle->GetPx(), particle->GetPy(), particle->GetPz(), | |
263 | particle->GetEnergy(), | |
264 | particle->GetVx(), particle->GetVy(), particle->GetVz(), | |
265 | particle->GetTime()); | |
266 | fNParticles++; | |
267 | if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles); | |
268 | } else { | |
269 | Error("AddParticle","Cannot AddParticle - maximum exceeded"); | |
270 | } | |
271 | } | |
272 | ||
273 | ||
274 | AliEMCALDigit* AliEMCALJetFinderInput::GetDigit(Int_t digitID) | |
275 | { | |
276 | // Returns a pointer to an AliEMCALDigit with the given ID | |
277 | ||
278 | if (fDebug>15) Info("GetDigit","Beginning GetDigit"); | |
279 | ||
280 | if (digitID >= fNDigits) return 0; | |
281 | return (AliEMCALDigit*)((*fDigitsArray)[digitID]); | |
282 | } | |
283 | ||
284 | TParticle* AliEMCALJetFinderInput::GetTrack(Int_t trackID) | |
285 | { | |
286 | // Returns a pointer to a TParticle specified by the ID | |
287 | ||
288 | if (fDebug>15) Info("GetTrack","Beginning GetTrack with trackID %i",trackID); | |
289 | ||
290 | if (trackID >= fNTracks) return 0; | |
291 | return (TParticle*)((*fTracksArray)[trackID]); | |
292 | } | |
293 | ||
294 | AliEMCALParton* AliEMCALJetFinderInput::GetParton(Int_t partonID) | |
295 | { | |
296 | // Returns a pointer to an AliEMCALParton specified by the ID | |
297 | ||
298 | if (fDebug>15) Info("GetParton","Beginning GetParton"); | |
299 | ||
300 | if (partonID >= fNPartons) return 0; | |
301 | return (AliEMCALParton*)((*fPartonsArray)[partonID]); | |
302 | } | |
303 | ||
304 | TParticle* AliEMCALJetFinderInput::GetParticle(Int_t particleID) | |
305 | { | |
306 | // Returns a pointer to a TParticle specified by the ID | |
307 | ||
308 | if (fDebug>15) Info("GetParticle","Beginning GetParticle"); | |
309 | ||
310 | if (particleID >= fNParticles) return 0; | |
311 | return (TParticle*)((*fParticlesArray)[particleID]); | |
312 | } | |
313 | ||
314 | ||
315 |