AliRoot Core  3dc7879 (3dc7879)
AliAODCaloTrigger.cxx
Go to the documentation of this file.
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 
16 /*
17 
18 
19 
20 
21 Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
22 */
23 
24 #include "AliAODCaloTrigger.h"
25 #include "AliLog.h"
26 
27 #include "TArrayI.h"
28 #include "Riostream.h"
29 #include <cstdlib>
30 
32 ClassImp(AliAODCaloTrigger)
34 
35 //_______________
37 fNEntries(0),
38 fCurrent(-1),
39 fColumn(0x0),
40 fRow(0x0),
41 fAmplitude(0x0),
42 fTime(0x0),
43 fNL0Times(0x0),
44 fL0Times(new TArrayI()),
45 fL1TimeSum(0x0),
46 fTriggerBits(0x0),
47 fL1Threshold(),
48 fL1V0(),
49 fL1FrameMask(0),
50 fL1DCALThreshold(),
51 fL1SubRegion(0x0),
52 fL1DCALFrameMask(0),
53 fMedian(),
54 fTriggerBitWord(0),
55 fL1DCALV0()
56 {
57  //
58  for (int i = 0; i < 4; i++) {fL1Threshold[i] = fL1DCALThreshold[i] = 0;}
59  fL1V0[0] = fL1V0[1] = 0;
60  fL1DCALV0[0] = fL1DCALV0[1] = 0;
61  fMedian[0] = fMedian[1] = 0;
62 }
63 
64 //_______________
65 AliAODCaloTrigger::AliAODCaloTrigger(const char* name, const char* title) : AliVCaloTrigger(name, title),
66  fNEntries(0),
67  fCurrent(-1),
68  fColumn(0x0),
69  fRow(0x0),
70  fAmplitude(0x0),
71  fTime(0x0),
72  fNL0Times(0x0),
73  fL0Times(new TArrayI()),
74  fL1TimeSum(0x0),
75  fTriggerBits(0x0),
76  fL1Threshold(),
77  fL1V0(),
78  fL1FrameMask(0),
79  fL1DCALV0()
80 {
81  //
82  fL1Threshold[0] = fL1Threshold[1] = 0;
83  fL1V0[0] = fL1V0[1] = 0;
84  fL1DCALV0[0] = fL1DCALV0[1] = 0;
85  fMedian[0] = fMedian[1] = 0;
86 }
87 
88 //_______________
90 fNEntries(0),
91 fCurrent(-1),
92 fColumn(0x0),
93 fRow(0x0),
94 fAmplitude(0x0),
95 fTime(0x0),
96 fNL0Times(0x0),
97 fL0Times(new TArrayI()),
98 fL1TimeSum(0x0),
99 fTriggerBits(0x0),
100 fL1Threshold(),
101 fL1V0(),
102 fL1FrameMask(0),
103 fL1DCALV0()
104 {
105  //
106  src.Copy(*this);
107 }
108 
109 //_______________
111 {
112  //
113  if (fNEntries) DeAllocate();
114 
115  delete fL0Times; fL0Times = 0x0;
116 }
117 
118 //_______________
120 {
121  //
122  delete [] fColumn; fColumn = 0x0;
123  delete [] fRow; fRow = 0x0;
124  delete [] fAmplitude; fAmplitude = 0x0;
125  delete [] fTime; fTime = 0x0;
126  delete [] fNL0Times; fNL0Times = 0x0;
127  delete [] fL1TimeSum; fL1TimeSum = 0x0;
128  delete [] fL1SubRegion; fL1SubRegion = 0x0;
129  delete [] fTriggerBits; fTriggerBits = 0x0;
130 
131  fNEntries = 0;
132  fCurrent = -1;
133 
134  fL0Times->Reset();
135 }
136 
137 //_______________
139 {
140  //
141  if (this != &src) src.Copy(*this);
142 
143  return *this;
144 }
145 
146 //_______________
147 void AliAODCaloTrigger::Copy(TObject &obj) const
148 {
150 
151  AliAODCaloTrigger& dest = static_cast<AliAODCaloTrigger&>(obj);
152 
153  if (dest.fNEntries) dest.DeAllocate();
154 
155  dest.Allocate(fNEntries);
156 
157  for (Int_t i = 0; i < fNEntries; i++) {
158  Int_t times[10];
159  for (Int_t j = 0; j < 10; j++) {
160  times[j] = fL0Times->At(10 * i + j);
161  }
162  dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i],
164  }
165 
166  for (int i = 0; i < 4; i++) dest.SetL1Threshold(i, fL1Threshold[i]);
167  for (int i = 0; i < 4; i++) dest.SetL1Threshold(1, i, fL1DCALThreshold[i]);
168 
169  dest.SetL1V0(fL1V0);
170  dest.SetL1V0(1, fL1DCALV0);
173 }
174 
175 //_______________
177 {
178  //
179  if (!size) return;
180 
181  fNEntries = size;
182 
183  fColumn = new Int_t[fNEntries];
184  fRow = new Int_t[fNEntries];
185  fAmplitude = new Float_t[fNEntries];
186  fTime = new Float_t[fNEntries];
187  fNL0Times = new Int_t[fNEntries];
188  fL1TimeSum = new Int_t[fNEntries];
189  fL1SubRegion = new Int_t[fNEntries];
190  fTriggerBits = new Int_t[fNEntries];
191 
192  for (Int_t i = 0; i < fNEntries; i++)
193  {
194  fColumn[i] = 0;
195  fRow[i] = 0;
196  fAmplitude[i] = 0;
197  fTime[i] = 0;
198  fNL0Times[i] = 0;
199  fL1TimeSum[i] = 0;
200  fL1SubRegion[i] = 0;
201  fTriggerBits[i] = 0;
202  }
203 
204  fL0Times->Set(fNEntries * 10);
205 }
206 
207 //_______________
208 Bool_t AliAODCaloTrigger::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)
209 {
210  //
211  fCurrent++;
212 
213  fColumn[fCurrent] = col;
214  fRow[fCurrent] = row;
215  fAmplitude[fCurrent] = amp;
216  fTime[fCurrent] = time;
217  fNL0Times[fCurrent] = ntrgtimes;
218  fL1TimeSum[fCurrent] = trgts;
219  fTriggerBits[fCurrent] = trgbits;
220 
221  if (ntrgtimes > 9)
222  {
223  AliError("Should not have more than 10 L0 times");
224  return kFALSE;
225  }
226 
227  for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) fL0Times->AddAt(trgtimes[i], 10 * fCurrent + i);
228 
229  return kTRUE;
230 }
231 
232 //_______________
233 Bool_t AliAODCaloTrigger::Add(Int_t col, Int_t row, Float_t amp, Float_t time, Int_t trgtimes[], Int_t ntrgtimes, Int_t trgts, Int_t subra, Int_t trgbits)
234 {
235  //
236  Add(col, row, amp, time, trgtimes, ntrgtimes, trgts, trgbits);
237  fL1SubRegion[fCurrent] = subra;
238 
239  return kTRUE;
240 }
241 
242 //_______________
244 {
245  //
246  if (fCurrent >= fNEntries - 1 || !fNEntries) return kFALSE;
247 
248  fCurrent++;
249 
250  return kTRUE;
251 }
252 
253 //_______________
254 void AliAODCaloTrigger::GetPosition(Int_t& col, Int_t& row) const
255 {
256  //
257  if (fCurrent == -1) return;
258 
259  col = fColumn[fCurrent];
260  row = fRow[fCurrent];
261 }
262 
263 //_______________
264 void AliAODCaloTrigger::GetAmplitude(Float_t& amp) const
265 {
266  //
267  if (fCurrent == -1) return;
268 
269  amp = fAmplitude[fCurrent];
270 }
271 
272 //_______________
273 void AliAODCaloTrigger::GetTime(Float_t& time) const
274 {
275  //
276  if (fCurrent == -1) return;
277 
278  time = fTime[fCurrent];
279 }
280 
281 //_______________
282 void AliAODCaloTrigger::GetL1TimeSum(Int_t& amp) const
283 {
284  //
285  if (fCurrent == -1) return;
286 
287  amp = fL1TimeSum[fCurrent];
288 }
289 
290 //_______________
292 {
293  //
294  if (fCurrent == -1) return -1;
295 
296  return ((fL1TimeSum)?fL1TimeSum[fCurrent]:0);
297 }
298 
299 //_______________
301 {
302  //
303  if (fCurrent == -1) return;
304 
306 }
307 
308 //_______________
310 {
311  //
312  if (fCurrent == -1) return -1;
313 
314  return ((fL1SubRegion)?fL1SubRegion[fCurrent]:0);
315 }
316 
317 //_______________
319 {
320  //
321  if (fCurrent == -1) return;
322 
323  ntimes = fNL0Times[fCurrent];
324 }
325 
326 //_______________
327 void AliAODCaloTrigger::GetTriggerBits(Int_t& bits) const
328 {
329  //
330  if (fCurrent == -1) return;
331 
332  bits = fTriggerBits[fCurrent];
333 }
334 
335 //_______________
336 void AliAODCaloTrigger::GetL0Times(Int_t times[]) const
337 {
338  //
339  if (fCurrent == -1) return;
340 
341  for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) times[i] = fL0Times->At(10 * fCurrent + i);
342 }
343 
344 //_______________
345 void AliAODCaloTrigger::Print(const Option_t* /*opt*/) const
346 {
347  //
348  if (fCurrent == -1) return;
349 
350  printf("============\n");
351  printf("--L0:\n");
352  printf("\tPOSITION (X: %2d Y: %2d) / FITTED F-ALTRO (AMP: %4f TIME: %3f)\n",
353  fColumn[fCurrent], fRow[fCurrent], fAmplitude[fCurrent], fTime[fCurrent]);
354  printf("\t%d L0 TIMES (", fNL0Times[fCurrent]);
355  for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) printf("%2d ",fL0Times->At(10 * fCurrent + i));
356  printf(")\n");
357  printf("--L1:\n");
358  printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]);
359  printf("\tHIGH THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
360  printf("\tLOW THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[2], fL1Threshold[3]);
361  printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fCurrent]);
362 }
void GetTriggerBits(Int_t &bits) const
Get the trigger bits for a given fastor position.
Int_t fNEntries
Number of entries in the trigger object (usually mapped to fastor channels)
void GetTime(Float_t &time) const
AliAODCaloTrigger & operator=(const AliAODCaloTrigger &ctrig)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
void SetL1FrameMask(Int_t m)
Int_t fCurrent
Index of the current entry.
void GetNL0Times(Int_t &ntimes) const
Get the number of L0 times for the current patch.
void GetPosition(Int_t &col, Int_t &row) const
Access to position of the current fastor channel.
Int_t fL1DCALV0[2]
L1 threshold components.
Int_t fL1DCALThreshold[4]
L1 thresholds from raw data.
virtual Bool_t Next()
Forward to next trigger entry (fastor / L0 patch)
Container with calorimeter trigger information in the AOD event.
Bool_t 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)
Int_t GetL1TimeSum() const
Get the L1 time sums (L1 ADC values) for the current fastor.
Int_t fL1DCALFrameMask
Validation flag for L1 data.
virtual void Print(const Option_t *opt="") const
Int_t fL1FrameMask
Validation flag for L1 data.
Virtual class to access calorimeter (EMCAL, PHOS, PMD, FMD) trigger data.
Int_t fL1Threshold[4]
L1 thresholds from raw data.
void SetL1V0(const Int_t *v)
void SetL1Threshold(Int_t i, Int_t thr)
void GetL0Times(Int_t times[]) const
Get level0 times for the current L0 patch.
Int_t GetL1SubRegion() const
void GetAmplitude(Float_t &amp) const
Access to L0-amplitude of the current fastor channel.
const int ntimes
Definition: kNNSpeed.C:14
Int_t fL1V0[2]
L1 threshold components.
#define AliError(message)
Definition: AliLog.h:591
Int_t fMedian[2]
Background median.
virtual void Copy(TObject &obj) const
void Allocate(Int_t size)
virtual void Copy(TObject &obj) const