]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/jetfinder/AliEMCALJetFinderInput.cxx
Removing a comma that gcc 3.4 does not like ;-)
[u/mrichter/AliRoot.git] / EMCAL / jetfinder / AliEMCALJetFinderInput.cxx
CommitLineData
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"
33class TClonesArray;
34
35
36ClassImp(AliEMCALJetFinderInput)
37
38AliEMCALJetFinderInput::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
62AliEMCALJetFinderInput::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 72void AliEMCALJetFinderInput::InitArrays()
73{
74if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning InitArrays");
75fNDigits = 19152; // This is the number of digits
76fNMaxDigits = fNDigits;
77fNMaxTracks = 3000;
78fNMaxParticles = 2000;
79fNMaxPartons = 4;
80
81fDigitsArray = new TClonesArray ("AliEMCALDigit",fNDigits); // This is the digits array for the EMCAL
82fTracksArray = new TClonesArray("TParticle",fNMaxTracks);
83fPartonsArray = new TClonesArray("AliEMCALParton",fNMaxPartons);
84fParticlesArray = new TClonesArray ("TParticle",fNMaxParticles);
85
86for (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}
93fNTracks = 0;
94fNPartons = 0;
95fNParticles = 0;
96fInitialised = kTRUE;
97}
98
99
100AliEMCALJetFinderInput::~AliEMCALJetFinderInput()
101{
102// Destructor -
103
104if (fDebug>0) Info("~AliEMCALJetFinderInput","Beginning Destructor");
105if (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
119void 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
123if (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}
161void 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
166if (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
175void AliEMCALJetFinderInput::AddTrack(TParticle track)
176{
177// Adds a TParticle to the track array
178
179if (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
45a58699 193
194void AliEMCALJetFinderInput::AddParton(AliEMCALParton *parton)
195{
196// Adds an AliEMCALParton to the parton array
197
198if (fDebug>5) Info("AddParton","Beginning AddParton");
199
200 if (!fInitialised) InitArrays();
201 if (fNPartons < fNMaxPartons){
202 new((*fPartonsArray)[fNPartons]) AliEMCALParton(*parton);
203 fNPartons++;
204 if (fDebug>5) Info("AddParton","Added Parton %i",fNPartons);
205 }else
206 {
207 Error("AddParton","Cannot AddParton - maximum exceeded");
208 }
209}
210
211void AliEMCALJetFinderInput::AddParticle(TParticle *particle)
212{
213// Adds a TParticle to the particle array
214
215if (fDebug>5) Info("AddParticle","Beginning AddParticle");
216
217 if (!fInitialised) InitArrays();
218 if (fNParticles < fNMaxParticles){
219 new((*fParticlesArray)[fNParticles]) TParticle(*particle);
220 fNParticles++;
221 if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles);
222 }else
223 {
224 Error("AddParticle","Cannot AddParticle - maximum exceeded");
225 }
226
227}
228
45a58699 229
230AliEMCALDigit* AliEMCALJetFinderInput::GetDigit(Int_t digitID)
231{
232// Returns a pointer to an AliEMCALDigit with the given ID
233
234if (fDebug>15) Info("GetDigit","Beginning GetDigit");
235
236 if (digitID >= fNDigits) return 0;
237 return (AliEMCALDigit*)((*fDigitsArray)[digitID]);
238}
239
240TParticle* AliEMCALJetFinderInput::GetTrack(Int_t trackID)
241{
242// Returns a pointer to a TParticle specified by the ID
243
244if (fDebug>15) Info("GetTrack","Beginning GetTrack with trackID %i",trackID);
245
246 if (trackID >= fNTracks) return 0;
247 return (TParticle*)((*fTracksArray)[trackID]);
248}
249
250AliEMCALParton* AliEMCALJetFinderInput::GetParton(Int_t partonID)
251{
252// Returns a pointer to an AliEMCALParton specified by the ID
253
254if (fDebug>15) Info("GetParton","Beginning GetParton");
255
256 if (partonID >= fNPartons) return 0;
257 return (AliEMCALParton*)((*fPartonsArray)[partonID]);
258}
259
260TParticle* AliEMCALJetFinderInput::GetParticle(Int_t particleID)
261{
262// Returns a pointer to a TParticle specified by the ID
263
264if (fDebug>15) Info("GetParticle","Beginning GetParticle");
265
266 if (particleID >= fNParticles) return 0;
267 return (TParticle*)((*fParticlesArray)[particleID]);
268}
269
270
271