]>
Commit | Line | Data |
---|---|---|
d5ebf00e | 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 | ||
042d5330 | 16 | /* |
17 | ||
d5ebf00e | 18 | |
042d5330 | 19 | |
20 | ||
21 | Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3 | |
22 | */ | |
d5ebf00e | 23 | |
24 | #include "AliESDCaloTrigger.h" | |
042d5330 | 25 | #include "AliLog.h" |
26 | ||
27 | #include "TArrayI.h" | |
28 | #include "Riostream.h" | |
29 | #include <cstdlib> | |
d5ebf00e | 30 | |
31 | ClassImp(AliESDCaloTrigger) | |
32 | ||
042d5330 | 33 | //_______________ |
34 | AliESDCaloTrigger::AliESDCaloTrigger() : TNamed(), | |
35 | fNEntries(0), | |
36 | fCurrent(-1), | |
37 | fColumn(0x0), | |
38 | fRow(0x0), | |
39 | fAmplitude(0x0), | |
40 | fTime(0x0), | |
41 | fNL0Times(0x0), | |
42 | fL0Times(new TArrayI()), | |
43 | fL1TimeSum(0x0) | |
d5ebf00e | 44 | { |
042d5330 | 45 | // |
46 | for (Int_t i = 0; i < 48; i++) for (Int_t j = 0; j < 64; j++) fTriggerBits[i][j] = 0; | |
d5ebf00e | 47 | } |
48 | ||
042d5330 | 49 | //_______________ |
50 | AliESDCaloTrigger::AliESDCaloTrigger(const AliESDCaloTrigger& src) : TNamed(src), | |
51 | fNEntries(0), | |
52 | fCurrent(-1), | |
53 | fColumn(0x0), | |
54 | fRow(0x0), | |
55 | fAmplitude(0x0), | |
56 | fTime(0x0), | |
57 | fNL0Times(0x0), | |
58 | fL0Times(new TArrayI()), | |
59 | fL1TimeSum(0x0) | |
d5ebf00e | 60 | { |
042d5330 | 61 | // |
62 | src.Copy(*this); | |
d5ebf00e | 63 | } |
64 | ||
042d5330 | 65 | //_______________ |
d5ebf00e | 66 | AliESDCaloTrigger::~AliESDCaloTrigger() |
67 | { | |
042d5330 | 68 | // |
69 | if (fNEntries) DeAllocate(); | |
70 | ||
71 | delete fL0Times; fL0Times = 0x0; | |
d5ebf00e | 72 | } |
73 | ||
042d5330 | 74 | //_______________ |
75 | void AliESDCaloTrigger::DeAllocate() | |
d5ebf00e | 76 | { |
042d5330 | 77 | // |
78 | delete [] fColumn; fColumn = 0x0; | |
79 | delete [] fRow; fRow = 0x0; | |
80 | delete [] fAmplitude; fAmplitude = 0x0; | |
81 | delete [] fTime; fTime = 0x0; | |
82 | delete [] fNL0Times; fNL0Times = 0x0; | |
83 | delete [] fL1TimeSum; fL1TimeSum = 0x0; | |
84 | // delete [] fL0Times; fL0Times = 0x0; | |
85 | ||
86 | fNEntries = 0; | |
87 | fCurrent = -1; | |
88 | ||
89 | for (Int_t i = 0; i < 48; i++) for (Int_t j = 0; j < 64; j++) fTriggerBits[i][j] = 0; | |
732a24fe | 90 | |
042d5330 | 91 | fL0Times->Reset(); |
d5ebf00e | 92 | } |
93 | ||
042d5330 | 94 | //_______________ |
95 | AliESDCaloTrigger& AliESDCaloTrigger::operator=(const AliESDCaloTrigger& src) | |
96 | { | |
97 | // | |
98 | if (this != &src) src.Copy(*this); | |
99 | ||
100 | return *this; | |
101 | } | |
732a24fe | 102 | |
042d5330 | 103 | //_______________ |
104 | void AliESDCaloTrigger::Copy(TObject &obj) const | |
105 | { | |
106 | // | |
107 | TNamed::Copy(obj); | |
108 | ||
109 | AliESDCaloTrigger& dest = static_cast<AliESDCaloTrigger&>(obj); | |
732a24fe | 110 | |
042d5330 | 111 | if (dest.fNEntries) dest.DeAllocate(); |
112 | ||
113 | dest.Allocate(fNEntries); | |
114 | ||
115 | for (Int_t i = 0; i < fNEntries; i++) | |
116 | { | |
117 | Int_t times[10]; | |
118 | for (Int_t j = 0; j < 10; j++) times[j] = fL0Times->At(10 * i + j); | |
119 | ||
120 | dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i], fL1TimeSum[i]); | |
121 | } | |
122 | ||
123 | for (Int_t i = 0; i < 48; i++) for (Int_t j = 0; j < 64; j++) dest.fTriggerBits[i][j] = fTriggerBits[i][j]; | |
732a24fe | 124 | } |
125 | ||
042d5330 | 126 | //_______________ |
127 | void AliESDCaloTrigger::Allocate(Int_t size) | |
128 | { | |
129 | // | |
130 | if (!size) return; | |
131 | ||
132 | fNEntries = size; | |
133 | ||
134 | fColumn = new Int_t[fNEntries]; | |
135 | fRow = new Int_t[fNEntries]; | |
136 | fAmplitude = new Float_t[fNEntries]; | |
137 | fTime = new Float_t[fNEntries]; | |
138 | fNL0Times = new Int_t[fNEntries]; | |
139 | // fL0Times = new Int_t[fNEntries * 10]; | |
140 | fL1TimeSum = new Int_t[fNEntries]; | |
141 | ||
142 | for (Int_t i = 0; i < fNEntries; i++) | |
143 | { | |
144 | fColumn[i] = 0; | |
145 | fRow[i] = 0; | |
146 | fAmplitude[i] = 0; | |
147 | fTime[i] = 0; | |
148 | fNL0Times[i] = 0; | |
149 | fL1TimeSum[i] = 0; | |
150 | } | |
151 | ||
152 | fL0Times->Set(fNEntries * 10); | |
153 | } | |
732a24fe | 154 | |
042d5330 | 155 | //_______________ |
156 | Bool_t AliESDCaloTrigger::Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts) | |
d5ebf00e | 157 | { |
042d5330 | 158 | // |
159 | fCurrent++; | |
160 | ||
161 | fColumn[fCurrent] = col; | |
162 | fRow[fCurrent] = row; | |
163 | fAmplitude[fCurrent] = amp; | |
164 | fTime[fCurrent] = time; | |
165 | fNL0Times[fCurrent] = ntrgtimes; | |
166 | fL1TimeSum[fCurrent] = trgts; | |
167 | ||
168 | if (ntrgtimes > 9) | |
169 | { | |
170 | AliError("Should not have more than 10 L0 times"); | |
171 | return kFALSE; | |
172 | } | |
173 | ||
174 | for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) fL0Times->AddAt(trgtimes[i], 10 * fCurrent + i); | |
175 | ||
176 | return kTRUE; | |
d5ebf00e | 177 | } |
178 | ||
042d5330 | 179 | //_______________ |
180 | void AliESDCaloTrigger::SetTriggerBits(Int_t col, Int_t row, Int_t i, Int_t j) | |
181 | { | |
182 | // | |
183 | if (col < 0 || col > 47 || row < 0 || row > 63) | |
184 | { | |
185 | AliError("Bad position!"); | |
186 | return; | |
187 | } | |
188 | ||
189 | fTriggerBits[col][row] = (fTriggerBits[col][row] | (1 << (i + 3 * j))); // L0 L1g L1j | |
190 | } | |
191 | ||
192 | //_______________ | |
193 | Bool_t AliESDCaloTrigger::Next() | |
194 | { | |
195 | // | |
196 | if (fCurrent >= fNEntries - 1 || !fNEntries) return kFALSE; | |
197 | ||
198 | fCurrent++; | |
199 | ||
200 | return kTRUE; | |
201 | } | |
202 | ||
203 | //_______________ | |
204 | void AliESDCaloTrigger::GetPosition(Int_t& col, Int_t& row) const | |
205 | { | |
206 | // | |
207 | if (fCurrent == -1) return; | |
208 | ||
209 | col = fColumn[fCurrent]; | |
210 | row = fRow[fCurrent]; | |
211 | } | |
212 | ||
213 | //_______________ | |
214 | void AliESDCaloTrigger::GetAmplitude(Float_t& amp) const | |
215 | { | |
216 | // | |
217 | if (fCurrent == -1) return; | |
218 | ||
219 | amp = fAmplitude[fCurrent]; | |
220 | } | |
221 | ||
222 | //_______________ | |
223 | void AliESDCaloTrigger::GetTime(Float_t& time) const | |
224 | { | |
225 | // | |
226 | if (fCurrent == -1) return; | |
227 | ||
228 | time = fTime[fCurrent]; | |
229 | } | |
230 | ||
231 | //_______________ | |
232 | void AliESDCaloTrigger::GetL1TimeSum(Int_t& amp) const | |
233 | { | |
234 | // | |
235 | if (fCurrent == -1) return; | |
236 | ||
237 | amp = fL1TimeSum[fCurrent]; | |
238 | } | |
239 | ||
240 | //_______________ | |
241 | void AliESDCaloTrigger::GetNL0Times(Int_t& ntimes) const | |
242 | { | |
243 | // | |
244 | if (fCurrent == -1) return; | |
245 | ||
246 | ntimes = fNL0Times[fCurrent]; | |
247 | } | |
248 | ||
249 | //_______________ | |
250 | void AliESDCaloTrigger::GetTriggerBits(Char_t& bits) const | |
251 | { | |
252 | // | |
253 | if (fCurrent == -1) return; | |
254 | ||
255 | bits = fTriggerBits[fColumn[fCurrent]][fRow[fCurrent]]; | |
256 | } | |
257 | ||
258 | //_______________ | |
259 | void AliESDCaloTrigger::GetL0Times(Int_t times[]) const | |
260 | { | |
261 | // | |
262 | if (fCurrent == -1) return; | |
263 | ||
264 | for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) times[i] = fL0Times->At(10 * fCurrent + i); | |
265 | } | |
266 | ||
267 | //_______________ | |
268 | void AliESDCaloTrigger::Print(const Option_t* /*opt*/) const | |
269 | { | |
270 | // | |
271 | if (fCurrent == -1) return; | |
d5ebf00e | 272 | |
042d5330 | 273 | printf("============\n"); |
274 | printf("--L0:\n"); | |
275 | printf("\tPOSITION (X: %2d Y: %2d) / FITTED F-ALTRO (AMP: %4f TIME: %3f)\n", | |
276 | fColumn[fCurrent], fRow[fCurrent], fAmplitude[fCurrent], fTime[fCurrent]); | |
277 | printf("\t%d L0 TIMES (", fNL0Times[fCurrent]); | |
278 | for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) printf("%2d ",fL0Times->At(10 * fCurrent + i)); | |
279 | printf(")\n"); | |
280 | printf("--L1:\n"); | |
281 | printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]); | |
282 | printf("\tTHRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]); | |
283 | printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fColumn[fCurrent]][fRow[fCurrent]]); | |
284 | } |