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