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