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