]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALJetFinderInput.cxx
Zero suppression added. Sigmas of noise generated randomly.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALJetFinderInput.cxx
CommitLineData
f7d5860b 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
ee6b678f 16/* $Id$ */
f7d5860b 17
ece5da38 18
f7d5860b 19//________________________________________________________________________
20// Initial JetFinder input object
21//
22//*-- Author: Mark Horner (LBL/UCT)
23
24#include "AliEMCALJetFinderInput.h"
25#include "AliEMCALDigit.h"
26#include "AliEMCALParton.h"
27#include "TClonesArray.h"
28
29
30ClassImp(AliEMCALJetFinderInput)
31
32AliEMCALJetFinderInput::AliEMCALJetFinderInput()
33{
34// Default constructor
35// Defines all TClonesArrays
36// Creates full array of Digits - all other arrays will have objects created as necessary
37
38if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning Constructor");
39
40fInitialised = kFALSE;
ece5da38 41fNDigits = 96*144; // This is the number of digits
42fNMaxDigits = fNDigits;
43fNMaxTracks = 3000;
44fNMaxParticles = 2000;
45fNMaxPartons = 4;
46fNTracks = 0;
47fNPartons = 0;
48fNParticles = 0;
f7d5860b 49
50}
51
52void AliEMCALJetFinderInput::InitArrays()
53{
54if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning InitArrays");
55fNDigits = 96*144; // This is the number of digits
56fNMaxDigits = fNDigits;
57fNMaxTracks = 3000;
58fNMaxParticles = 2000;
59fNMaxPartons = 4;
f7d5860b 60for (Int_t i = 0; i < 96*144; i++)
61{
ece5da38 62 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
63 tempdigit.SetAmp(0);
64// AliEMCALDigit(0,0,i+1,0,1.0,-1)
65 new(&fDigitsArray[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
f7d5860b 66}
f7d5860b 67fNTracks = 0;
f7d5860b 68fNPartons = 0;
f7d5860b 69fNParticles = 0;
70fInitialised = kTRUE;
71}
72
73
74AliEMCALJetFinderInput::~AliEMCALJetFinderInput()
75{
76// Destructor -
f7d5860b 77
78if (fDebug>0) Info("~AliEMCALJetFinderInput","Beginning Destructor");
f7d5860b 79}
80
81void AliEMCALJetFinderInput::Reset(AliEMCALJetFinderResetType_t resettype)
82{
83// Clears the contents of all the arrays and returns to the state we were in
84// after the constructor
85if (fDebug>1) Info("Reset","Beginning Reset");
86
87 if (!fInitialised) InitArrays();
88
89 if ( resettype == kResetData ||
90 resettype == kResetDigits ||
91 resettype == kResetAll ){
f7d5860b 92 for (Int_t i = 0; i < 96*144; i++)
93 {
ece5da38 94 AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1);
95 tempdigit.SetAmp(0);
96 new(&fDigitsArray[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero
f7d5860b 97 }
98 }
99 if ( resettype == kResetData ||
100 resettype == kResetTracks ||
101 resettype == kResetAll ){
f7d5860b 102 fNTracks = 0;
103 }
104 if ( resettype == kResetData ||
105 resettype == kResetPartons ||
106 resettype == kResetAll ){
f7d5860b 107 fNPartons=0;
108 }
109 if ( resettype == kResetData ||
110 resettype == kResetParticles ||
111 resettype == kResetAll ){
f7d5860b 112 fNParticles = 0;
113 }
114
115}
116void AliEMCALJetFinderInput::AddEnergyToDigit(Int_t digitID,Int_t denergy)
117{
118// Adds energy to the digit specified - Note these are tower IDs and
119// so start at 1!
120
ece5da38 121if (fDebug>15) Info("AddEnergyToDigit","Beginning AddEnergyToDigit");
f7d5860b 122 if (!fInitialised) InitArrays();
123
124 Int_t amp = 0;
ece5da38 125 AliEMCALDigit *mydigit = &fDigitsArray[digitID];
f7d5860b 126 amp = mydigit->GetAmp();
127 mydigit->SetAmp(amp+denergy);
128}
129
130void AliEMCALJetFinderInput::AddTrack(TParticle track)
131{
132// Adds a TParticle to the track array
133
134if (fDebug>5) Info("AddTrack","Beginning AddTrack");
135
136 if (!fInitialised) InitArrays();
137 if (fNTracks < fNMaxTracks){
ece5da38 138 new(&fTracksArray[fNTracks]) TParticle(track);
f7d5860b 139 fNTracks++;
ece5da38 140 if (fDebug>5) Info("AddTracks","Added Tracks %i",fNTracks);
f7d5860b 141 }else
142 {
143 Error("AddTracks","Cannot AddTrack - maximum exceeded");
144 }
145
146}
147void AliEMCALJetFinderInput::AddParton(AliEMCALParton *parton)
148{
149// Adds an AliEMCALParton to the parton array
150
151if (fDebug>5) Info("AddParton","Beginning AddParton");
152
153 if (!fInitialised) InitArrays();
154 if (fNPartons < fNMaxPartons){
ece5da38 155 new(&fPartonsArray[fNPartons]) AliEMCALParton(*parton);
f7d5860b 156 fNPartons++;
ece5da38 157 if (fDebug>5) Info("AddParton","Added Parton %i",fNPartons);
f7d5860b 158 }else
159 {
160 Error("AddParton","Cannot AddParton - maximum exceeded");
161 }
162}
163
164void AliEMCALJetFinderInput::AddParticle(TParticle *particle)
165{
166// Adds a TParticle to the particle array
167
168if (fDebug>5) Info("AddParticle","Beginning AddParticle");
169
170 if (!fInitialised) InitArrays();
171 if (fNParticles < fNMaxParticles){
ece5da38 172 new(&fParticlesArray[fNParticles]) TParticle(*particle);
f7d5860b 173 fNParticles++;
ece5da38 174 if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles);
f7d5860b 175 }else
176 {
177 Error("AddParticle","Cannot AddParticle - maximum exceeded");
178 }
179
180}
181
182
183AliEMCALDigit* AliEMCALJetFinderInput::GetDigit(Int_t digitID)
184{
185// Returns a pointer to an AliEMCALDigit with the given ID
186
ece5da38 187if (fDebug>15) Info("GetDigit","Beginning GetDigit");
f7d5860b 188
189 if (digitID >= fNDigits) return 0;
ece5da38 190 return (AliEMCALDigit*)(&fDigitsArray[digitID]);
f7d5860b 191}
192
193TParticle* AliEMCALJetFinderInput::GetTrack(Int_t trackID)
194{
195// Returns a pointer to a TParticle specified by the ID
196
ece5da38 197if (fDebug>15) Info("GetTrack","Beginning GetTrack with trackID %i",trackID);
f7d5860b 198
199 if (trackID >= fNTracks) return 0;
ece5da38 200 return (TParticle*)(&fTracksArray[trackID]);
f7d5860b 201}
202
203AliEMCALParton* AliEMCALJetFinderInput::GetParton(Int_t partonID)
204{
205// Returns a pointer to an AliEMCALParton specified by the ID
206
ece5da38 207if (fDebug>15) Info("GetParton","Beginning GetParton");
f7d5860b 208
209 if (partonID >= fNPartons) return 0;
ece5da38 210 return (AliEMCALParton*)(&fPartonsArray[partonID]);
f7d5860b 211}
212
213TParticle* AliEMCALJetFinderInput::GetParticle(Int_t particleID)
214{
215// Returns a pointer to a TParticle specified by the ID
216
ece5da38 217if (fDebug>15) Info("GetParticle","Beginning GetParticle");
f7d5860b 218
219 if (particleID >= fNParticles) return 0;
ece5da38 220 return (TParticle*)(&fParticlesArray[particleID]);
f7d5860b 221}
222
223
224