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