1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 //________________________________________________________________________
20 // Initial JetFinder input object
22 //*-- Author: Mark Horner (LBL/UCT)
29 #include "AliEMCALJetFinderInput.h"
30 #include "AliEMCALDigit.h"
31 #include "AliEMCALGeometry.h"
32 #include "AliEMCALParton.h"
36 ClassImp(AliEMCALJetFinderInput)
38 AliEMCALJetFinderInput::AliEMCALJetFinderInput():
44 // Default constructor
45 // Defines all TClonesArrays
46 // Creates full array of Digits - all other arrays will have objects created as necessary
48 //if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning Constructor");
50 fInitialised = kFALSE;
51 fNDigits = 19152; // This is the number of digits
52 fNMaxDigits = fNDigits;
54 fNMaxParticles = 2000;
62 void AliEMCALJetFinderInput::InitArrays()
64 if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning InitArrays");
65 fNDigits = 19152; // This is the number of digits
66 fNMaxDigits = fNDigits;
68 fNMaxParticles = 2000;
71 fDigitsArray = new TClonesArray ("AliEMCALDigit",fNDigits); // This is the digits array for the EMCAL
72 fTracksArray = new TClonesArray("TParticle",fNMaxTracks);
73 fPartonsArray = new TClonesArray("AliEMCALParton",fNMaxPartons);
74 fParticlesArray = new TClonesArray ("TParticle",fNMaxParticles);
76 for (Int_t i = 0; i < 19152; i++)
78 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
80 // AliEMCALDigit(0,0,i+1,0,1.0,-1)
81 new((*fDigitsArray)[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
90 AliEMCALJetFinderInput::~AliEMCALJetFinderInput()
94 if (fDebug>0) Info("~AliEMCALJetFinderInput","Beginning Destructor");
97 fDigitsArray->Delete();
98 fTracksArray->Delete();
99 fPartonsArray->Delete();
100 fParticlesArray->Delete();
103 delete fPartonsArray;
104 delete fParticlesArray;
109 void AliEMCALJetFinderInput::Reset(AliEMCALJetFinderResetType_t resettype)
111 // Clears the contents of all the arrays and returns to the state we were in
112 // after the constructor
113 if (fDebug>1) Info("Reset","Beginning Reset");
115 if (!fInitialised) InitArrays();
117 if ( resettype == kResetData ||
118 resettype == kResetDigits ||
119 resettype == kResetAll ){
122 fDigitsArray->Delete();
123 fTracksArray->Delete();
124 fPartonsArray->Delete();
125 fParticlesArray->Delete();
127 for (Int_t i = 0; i < 19152; i++)
129 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
131 new((*fDigitsArray)[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
134 if ( resettype == kResetData ||
135 resettype == kResetTracks ||
136 resettype == kResetAll ){
139 if ( resettype == kResetData ||
140 resettype == kResetPartons ||
141 resettype == kResetAll ){
144 if ( resettype == kResetData ||
145 resettype == kResetParticles ||
146 resettype == kResetAll ){
151 void AliEMCALJetFinderInput::AddEnergyToDigit(Int_t digitID,Int_t denergy)
153 // Adds energy to the digit specified - Note these are tower IDs and
156 if (fDebug>15) Info("AddEnergyToDigit","Beginning AddEnergyToDigit");
157 if (!fInitialised) InitArrays();
160 AliEMCALDigit *mydigit = (AliEMCALDigit*)(*fDigitsArray)[digitID];
161 amp = mydigit->GetAmp();
162 mydigit->SetAmp(amp+denergy);
165 void AliEMCALJetFinderInput::AddTrack(TParticle track)
167 // Adds a TParticle to the track array
169 if (fDebug>5) Info("AddTrack","Beginning AddTrack");
171 if (!fInitialised) InitArrays();
172 if (fNTracks < fNMaxTracks){
173 new((*fTracksArray)[fNTracks]) TParticle(track);
175 if (fDebug>5) Info("AddTracks","Added Tracks %i",fNTracks);
178 Error("AddTracks","Cannot AddTrack - maximum exceeded");
183 void AliEMCALJetFinderInput::AddTrack(TMCParticle *track)
185 // Adds a TParticle to the particle array
187 if (fDebug>5) Info("AddTrack","Beginning AddTrack");
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(),
196 track->GetVx(), track->GetVy(), track->GetVz(),
199 if (fDebug>5) Info("AddTrack","Added Track %i",fNTracks);
201 Error("AddTrack","Cannot AddTrack - maximum exceeded");
206 void AliEMCALJetFinderInput::AddParton(AliEMCALParton *parton)
208 // Adds an AliEMCALParton to the parton array
210 if (fDebug>5) Info("AddParton","Beginning AddParton");
212 if (!fInitialised) InitArrays();
213 if (fNPartons < fNMaxPartons){
214 new((*fPartonsArray)[fNPartons]) AliEMCALParton(*parton);
216 if (fDebug>5) Info("AddParton","Added Parton %i",fNPartons);
219 Error("AddParton","Cannot AddParton - maximum exceeded");
223 void AliEMCALJetFinderInput::AddParticle(TParticle *particle)
225 // Adds a TParticle to the particle array
227 if (fDebug>5) Info("AddParticle","Beginning AddParticle");
229 if (!fInitialised) InitArrays();
230 if (fNParticles < fNMaxParticles){
231 new((*fParticlesArray)[fNParticles]) TParticle(*particle);
233 if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles);
236 Error("AddParticle","Cannot AddParticle - maximum exceeded");
241 void AliEMCALJetFinderInput::AddParticle(TMCParticle *particle)
243 // Adds a TParticle to the particle array
245 if (fDebug>5) Info("AddParticle","Beginning AddParticle");
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());
257 if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles);
259 Error("AddParticle","Cannot AddParticle - maximum exceeded");
264 AliEMCALDigit* AliEMCALJetFinderInput::GetDigit(Int_t digitID)
266 // Returns a pointer to an AliEMCALDigit with the given ID
268 if (fDebug>15) Info("GetDigit","Beginning GetDigit");
270 if (digitID >= fNDigits) return 0;
271 return (AliEMCALDigit*)((*fDigitsArray)[digitID]);
274 TParticle* AliEMCALJetFinderInput::GetTrack(Int_t trackID)
276 // Returns a pointer to a TParticle specified by the ID
278 if (fDebug>15) Info("GetTrack","Beginning GetTrack with trackID %i",trackID);
280 if (trackID >= fNTracks) return 0;
281 return (TParticle*)((*fTracksArray)[trackID]);
284 AliEMCALParton* AliEMCALJetFinderInput::GetParton(Int_t partonID)
286 // Returns a pointer to an AliEMCALParton specified by the ID
288 if (fDebug>15) Info("GetParton","Beginning GetParton");
290 if (partonID >= fNPartons) return 0;
291 return (AliEMCALParton*)((*fPartonsArray)[partonID]);
294 TParticle* AliEMCALJetFinderInput::GetParticle(Int_t particleID)
296 // Returns a pointer to a TParticle specified by the ID
298 if (fDebug>15) Info("GetParticle","Beginning GetParticle");
300 if (particleID >= fNParticles) return 0;
301 return (TParticle*)((*fParticlesArray)[particleID]);