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)
24 #include "AliEMCALJetFinderInput.h"
25 #include "AliEMCALDigit.h"
26 #include "AliEMCALParton.h"
27 #include "TClonesArray.h"
30 ClassImp(AliEMCALJetFinderInput)
32 AliEMCALJetFinderInput::AliEMCALJetFinderInput()
34 // Default constructor
35 // Defines all TClonesArrays
36 // Creates full array of Digits - all other arrays will have objects created as necessary
38 if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning Constructor");
40 fInitialised = kFALSE;
41 fNDigits = 96*144; // This is the number of digits
42 fNMaxDigits = fNDigits;
44 fNMaxParticles = 2000;
52 void AliEMCALJetFinderInput::InitArrays()
54 if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning InitArrays");
55 fNDigits = 96*144; // This is the number of digits
56 fNMaxDigits = fNDigits;
58 fNMaxParticles = 2000;
60 for (Int_t i = 0; i < 96*144; i++)
62 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
64 // AliEMCALDigit(0,0,i+1,0,1.0,-1)
65 new(&fDigitsArray[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
74 AliEMCALJetFinderInput::~AliEMCALJetFinderInput()
78 if (fDebug>0) Info("~AliEMCALJetFinderInput","Beginning Destructor");
81 void AliEMCALJetFinderInput::Reset(AliEMCALJetFinderResetType_t resettype)
83 // Clears the contents of all the arrays and returns to the state we were in
84 // after the constructor
85 if (fDebug>1) Info("Reset","Beginning Reset");
87 if (!fInitialised) InitArrays();
89 if ( resettype == kResetData ||
90 resettype == kResetDigits ||
91 resettype == kResetAll ){
92 for (Int_t i = 0; i < 96*144; i++)
94 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
96 new(&fDigitsArray[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
99 if ( resettype == kResetData ||
100 resettype == kResetTracks ||
101 resettype == kResetAll ){
104 if ( resettype == kResetData ||
105 resettype == kResetPartons ||
106 resettype == kResetAll ){
109 if ( resettype == kResetData ||
110 resettype == kResetParticles ||
111 resettype == kResetAll ){
116 void AliEMCALJetFinderInput::AddEnergyToDigit(Int_t digitID,Int_t denergy)
118 // Adds energy to the digit specified - Note these are tower IDs and
121 if (fDebug>15) Info("AddEnergyToDigit","Beginning AddEnergyToDigit");
122 if (!fInitialised) InitArrays();
125 AliEMCALDigit *mydigit = &fDigitsArray[digitID];
126 amp = mydigit->GetAmp();
127 mydigit->SetAmp(amp+denergy);
130 void AliEMCALJetFinderInput::AddTrack(TParticle track)
132 // Adds a TParticle to the track array
134 if (fDebug>5) Info("AddTrack","Beginning AddTrack");
136 if (!fInitialised) InitArrays();
137 if (fNTracks < fNMaxTracks){
138 new(&fTracksArray[fNTracks]) TParticle(track);
140 if (fDebug>5) Info("AddTracks","Added Tracks %i",fNTracks);
143 Error("AddTracks","Cannot AddTrack - maximum exceeded");
147 void AliEMCALJetFinderInput::AddParton(AliEMCALParton *parton)
149 // Adds an AliEMCALParton to the parton array
151 if (fDebug>5) Info("AddParton","Beginning AddParton");
153 if (!fInitialised) InitArrays();
154 if (fNPartons < fNMaxPartons){
155 new(&fPartonsArray[fNPartons]) AliEMCALParton(*parton);
157 if (fDebug>5) Info("AddParton","Added Parton %i",fNPartons);
160 Error("AddParton","Cannot AddParton - maximum exceeded");
164 void AliEMCALJetFinderInput::AddParticle(TParticle *particle)
166 // Adds a TParticle to the particle array
168 if (fDebug>5) Info("AddParticle","Beginning AddParticle");
170 if (!fInitialised) InitArrays();
171 if (fNParticles < fNMaxParticles){
172 new(&fParticlesArray[fNParticles]) TParticle(*particle);
174 if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles);
177 Error("AddParticle","Cannot AddParticle - maximum exceeded");
183 AliEMCALDigit* AliEMCALJetFinderInput::GetDigit(Int_t digitID)
185 // Returns a pointer to an AliEMCALDigit with the given ID
187 if (fDebug>15) Info("GetDigit","Beginning GetDigit");
189 if (digitID >= fNDigits) return 0;
190 return (AliEMCALDigit*)(&fDigitsArray[digitID]);
193 TParticle* AliEMCALJetFinderInput::GetTrack(Int_t trackID)
195 // Returns a pointer to a TParticle specified by the ID
197 if (fDebug>15) Info("GetTrack","Beginning GetTrack with trackID %i",trackID);
199 if (trackID >= fNTracks) return 0;
200 return (TParticle*)(&fTracksArray[trackID]);
203 AliEMCALParton* AliEMCALJetFinderInput::GetParton(Int_t partonID)
205 // Returns a pointer to an AliEMCALParton specified by the ID
207 if (fDebug>15) Info("GetParton","Beginning GetParton");
209 if (partonID >= fNPartons) return 0;
210 return (AliEMCALParton*)(&fPartonsArray[partonID]);
213 TParticle* AliEMCALJetFinderInput::GetParticle(Int_t particleID)
215 // Returns a pointer to a TParticle specified by the ID
217 if (fDebug>15) Info("GetParticle","Beginning GetParticle");
219 if (particleID >= fNParticles) return 0;
220 return (TParticle*)(&fParticlesArray[particleID]);