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():
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)
43 // Default constructor
44 // Defines all TClonesArrays
45 // Creates full array of Digits - all other arrays will have objects created as necessary
47 //if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning Constructor");
49 fInitialised = kFALSE;
50 fNDigits = 19152; // This is the number of digits
51 fNMaxDigits = fNDigits;
53 fNMaxParticles = 2000;
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)
72 void AliEMCALJetFinderInput::InitArrays()
74 if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning InitArrays");
75 fNDigits = 19152; // This is the number of digits
76 fNMaxDigits = fNDigits;
78 fNMaxParticles = 2000;
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);
86 for (Int_t i = 0; i < 19152; i++)
88 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
90 // AliEMCALDigit(0,0,i+1,0,1.0,-1)
91 new((*fDigitsArray)[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
100 AliEMCALJetFinderInput::~AliEMCALJetFinderInput()
104 if (fDebug>0) Info("~AliEMCALJetFinderInput","Beginning Destructor");
107 fDigitsArray->Delete();
108 fTracksArray->Delete();
109 fPartonsArray->Delete();
110 fParticlesArray->Delete();
113 delete fPartonsArray;
114 delete fParticlesArray;
119 void AliEMCALJetFinderInput::Reset(AliEMCALJetFinderResetType_t resettype)
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");
125 if (!fInitialised) InitArrays();
127 if ( resettype == kResetData ||
128 resettype == kResetDigits ||
129 resettype == kResetAll ){
132 fDigitsArray->Delete();
133 fTracksArray->Delete();
134 fPartonsArray->Delete();
135 fParticlesArray->Delete();
137 for (Int_t i = 0; i < 19152; i++)
139 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
141 new((*fDigitsArray)[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
144 if ( resettype == kResetData ||
145 resettype == kResetTracks ||
146 resettype == kResetAll ){
149 if ( resettype == kResetData ||
150 resettype == kResetPartons ||
151 resettype == kResetAll ){
154 if ( resettype == kResetData ||
155 resettype == kResetParticles ||
156 resettype == kResetAll ){
161 void AliEMCALJetFinderInput::AddEnergyToDigit(Int_t digitID,Int_t denergy)
163 // Adds energy to the digit specified - Note these are tower IDs and
166 if (fDebug>15) Info("AddEnergyToDigit","Beginning AddEnergyToDigit");
167 if (!fInitialised) InitArrays();
170 AliEMCALDigit *mydigit = (AliEMCALDigit*)(*fDigitsArray)[digitID];
171 amp = mydigit->GetAmp();
172 mydigit->SetAmp(amp+denergy);
175 void AliEMCALJetFinderInput::AddTrack(TParticle track)
177 // Adds a TParticle to the track array
179 if (fDebug>5) Info("AddTrack","Beginning AddTrack");
181 if (!fInitialised) InitArrays();
182 if (fNTracks < fNMaxTracks){
183 new((*fTracksArray)[fNTracks]) TParticle(track);
185 if (fDebug>5) Info("AddTracks","Added Tracks %i",fNTracks);
188 Error("AddTracks","Cannot AddTrack - maximum exceeded");
194 void AliEMCALJetFinderInput::AddParton(AliEMCALParton *parton)
196 // Adds an AliEMCALParton to the parton array
198 if (fDebug>5) Info("AddParton","Beginning AddParton");
200 if (!fInitialised) InitArrays();
201 if (fNPartons < fNMaxPartons){
202 new((*fPartonsArray)[fNPartons]) AliEMCALParton(*parton);
204 if (fDebug>5) Info("AddParton","Added Parton %i",fNPartons);
207 Error("AddParton","Cannot AddParton - maximum exceeded");
211 void AliEMCALJetFinderInput::AddParticle(TParticle *particle)
213 // Adds a TParticle to the particle array
215 if (fDebug>5) Info("AddParticle","Beginning AddParticle");
217 if (!fInitialised) InitArrays();
218 if (fNParticles < fNMaxParticles){
219 new((*fParticlesArray)[fNParticles]) TParticle(*particle);
221 if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles);
224 Error("AddParticle","Cannot AddParticle - maximum exceeded");
230 AliEMCALDigit* AliEMCALJetFinderInput::GetDigit(Int_t digitID)
232 // Returns a pointer to an AliEMCALDigit with the given ID
234 if (fDebug>15) Info("GetDigit","Beginning GetDigit");
236 if (digitID >= fNDigits) return 0;
237 return (AliEMCALDigit*)((*fDigitsArray)[digitID]);
240 TParticle* AliEMCALJetFinderInput::GetTrack(Int_t trackID)
242 // Returns a pointer to a TParticle specified by the ID
244 if (fDebug>15) Info("GetTrack","Beginning GetTrack with trackID %i",trackID);
246 if (trackID >= fNTracks) return 0;
247 return (TParticle*)((*fTracksArray)[trackID]);
250 AliEMCALParton* AliEMCALJetFinderInput::GetParton(Int_t partonID)
252 // Returns a pointer to an AliEMCALParton specified by the ID
254 if (fDebug>15) Info("GetParton","Beginning GetParton");
256 if (partonID >= fNPartons) return 0;
257 return (AliEMCALParton*)((*fPartonsArray)[partonID]);
260 TParticle* AliEMCALJetFinderInput::GetParticle(Int_t particleID)
262 // Returns a pointer to a TParticle specified by the ID
264 if (fDebug>15) Info("GetParticle","Beginning GetParticle");
266 if (particleID >= fNParticles) return 0;
267 return (TParticle*)((*fParticlesArray)[particleID]);