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 "AliEMCALParton.h"
35 ClassImp(AliEMCALJetFinderInput)
37 AliEMCALJetFinderInput::AliEMCALJetFinderInput()
39 // Default constructor
40 // Defines all TClonesArrays
41 // Creates full array of Digits - all other arrays will have objects created as necessary
43 if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning Constructor");
45 fInitialised = kFALSE;
46 fNDigits = 96*144; // This is the number of digits
47 fNMaxDigits = fNDigits;
49 fNMaxParticles = 2000;
57 void AliEMCALJetFinderInput::InitArrays()
59 if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning InitArrays");
60 fNDigits = 96*144; // This is the number of digits
61 fNMaxDigits = fNDigits;
63 fNMaxParticles = 2000;
65 for (Int_t i = 0; i < 96*144; i++)
67 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
69 // AliEMCALDigit(0,0,i+1,0,1.0,-1)
70 new(&fDigitsArray[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
79 AliEMCALJetFinderInput::~AliEMCALJetFinderInput()
83 if (fDebug>0) Info("~AliEMCALJetFinderInput","Beginning Destructor");
86 void AliEMCALJetFinderInput::Reset(AliEMCALJetFinderResetType_t resettype)
88 // Clears the contents of all the arrays and returns to the state we were in
89 // after the constructor
90 if (fDebug>1) Info("Reset","Beginning Reset");
92 if (!fInitialised) InitArrays();
94 if ( resettype == kResetData ||
95 resettype == kResetDigits ||
96 resettype == kResetAll ){
97 for (Int_t i = 0; i < 96*144; i++)
99 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
101 new(&fDigitsArray[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
104 if ( resettype == kResetData ||
105 resettype == kResetTracks ||
106 resettype == kResetAll ){
109 if ( resettype == kResetData ||
110 resettype == kResetPartons ||
111 resettype == kResetAll ){
114 if ( resettype == kResetData ||
115 resettype == kResetParticles ||
116 resettype == kResetAll ){
121 void AliEMCALJetFinderInput::AddEnergyToDigit(Int_t digitID,Int_t denergy)
123 // Adds energy to the digit specified - Note these are tower IDs and
126 if (fDebug>15) Info("AddEnergyToDigit","Beginning AddEnergyToDigit");
127 if (!fInitialised) InitArrays();
130 AliEMCALDigit *mydigit = &fDigitsArray[digitID];
131 amp = mydigit->GetAmp();
132 mydigit->SetAmp(amp+denergy);
135 void AliEMCALJetFinderInput::AddTrack(TParticle track)
137 // Adds a TParticle to the track array
139 if (fDebug>5) Info("AddTrack","Beginning AddTrack");
141 if (!fInitialised) InitArrays();
142 if (fNTracks < fNMaxTracks){
143 new(&fTracksArray[fNTracks]) TParticle(track);
145 if (fDebug>5) Info("AddTracks","Added Tracks %i",fNTracks);
148 Error("AddTracks","Cannot AddTrack - maximum exceeded");
152 void AliEMCALJetFinderInput::AddParton(AliEMCALParton *parton)
154 // Adds an AliEMCALParton to the parton array
156 if (fDebug>5) Info("AddParton","Beginning AddParton");
158 if (!fInitialised) InitArrays();
159 if (fNPartons < fNMaxPartons){
160 new(&fPartonsArray[fNPartons]) AliEMCALParton(*parton);
162 if (fDebug>5) Info("AddParton","Added Parton %i",fNPartons);
165 Error("AddParton","Cannot AddParton - maximum exceeded");
169 void AliEMCALJetFinderInput::AddParticle(TParticle *particle)
171 // Adds a TParticle to the particle array
173 if (fDebug>5) Info("AddParticle","Beginning AddParticle");
175 if (!fInitialised) InitArrays();
176 if (fNParticles < fNMaxParticles){
177 new(&fParticlesArray[fNParticles]) TParticle(*particle);
179 if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles);
182 Error("AddParticle","Cannot AddParticle - maximum exceeded");
188 AliEMCALDigit* AliEMCALJetFinderInput::GetDigit(Int_t digitID)
190 // Returns a pointer to an AliEMCALDigit with the given ID
192 if (fDebug>15) Info("GetDigit","Beginning GetDigit");
194 if (digitID >= fNDigits) return 0;
195 return (AliEMCALDigit*)(&fDigitsArray[digitID]);
198 TParticle* AliEMCALJetFinderInput::GetTrack(Int_t trackID)
200 // Returns a pointer to a TParticle specified by the ID
202 if (fDebug>15) Info("GetTrack","Beginning GetTrack with trackID %i",trackID);
204 if (trackID >= fNTracks) return 0;
205 return (TParticle*)(&fTracksArray[trackID]);
208 AliEMCALParton* AliEMCALJetFinderInput::GetParton(Int_t partonID)
210 // Returns a pointer to an AliEMCALParton specified by the ID
212 if (fDebug>15) Info("GetParton","Beginning GetParton");
214 if (partonID >= fNPartons) return 0;
215 return (AliEMCALParton*)(&fPartonsArray[partonID]);
218 TParticle* AliEMCALJetFinderInput::GetParticle(Int_t particleID)
220 // Returns a pointer to a TParticle specified by the ID
222 if (fDebug>15) Info("GetParticle","Beginning GetParticle");
224 if (particleID >= fNParticles) return 0;
225 return (TParticle*)(&fParticlesArray[particleID]);