]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AOD/AliAODCaloTrigger.cxx
Changes for #93916 EMCAL commit attached patch and port to the release
[u/mrichter/AliRoot.git] / STEER / AOD / AliAODCaloTrigger.cxx
CommitLineData
720f7306 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
21Author: 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
31ClassImp(AliAODCaloTrigger)
32
33//_______________
34AliAODCaloTrigger::AliAODCaloTrigger() : TNamed(),
35fNEntries(0),
36fCurrent(-1),
37fColumn(0x0),
38fRow(0x0),
39fAmplitude(0x0),
40fTime(0x0),
41fNL0Times(0x0),
42fL0Times(new TArrayI()),
43fL1TimeSum(0x0),
44fTriggerBits(0x0),
45fL1Threshold(),
46fL1V0(),
47fL1FrameMask(0)
48{
49 //
63c22917 50 for (int i = 0; i < 4; i++) fL1Threshold[i] = 0;
720f7306 51 fL1V0[0] = fL1V0[1] = 0;
52}
53
54//_______________
55AliAODCaloTrigger::AliAODCaloTrigger(const char* name, const char* title) : TNamed(name, title),
56 fNEntries(0),
57 fCurrent(-1),
58 fColumn(0x0),
59 fRow(0x0),
60 fAmplitude(0x0),
61 fTime(0x0),
62 fNL0Times(0x0),
63 fL0Times(new TArrayI()),
64 fL1TimeSum(0x0),
65 fTriggerBits(0x0),
66 fL1Threshold(),
67 fL1V0(),
68 fL1FrameMask(0)
69{
70 //
71 fL1Threshold[0] = fL1Threshold[1] = 0;
72 fL1V0[0] = fL1V0[1] = 0;
73}
74
75//_______________
76AliAODCaloTrigger::AliAODCaloTrigger(const AliAODCaloTrigger& src) : TNamed(src),
77fNEntries(0),
78fCurrent(-1),
79fColumn(0x0),
80fRow(0x0),
81fAmplitude(0x0),
82fTime(0x0),
83fNL0Times(0x0),
84fL0Times(new TArrayI()),
85fL1TimeSum(0x0),
86fTriggerBits(0x0),
87fL1Threshold(),
88fL1V0(),
89fL1FrameMask(0)
90{
91 //
92 src.Copy(*this);
93}
94
95//_______________
96AliAODCaloTrigger::~AliAODCaloTrigger()
97{
98 //
99 if (fNEntries) DeAllocate();
100
101 delete fL0Times; fL0Times = 0x0;
102}
103
104//_______________
105void AliAODCaloTrigger::DeAllocate()
106{
107 //
108 delete [] fColumn; fColumn = 0x0;
109 delete [] fRow; fRow = 0x0;
110 delete [] fAmplitude; fAmplitude = 0x0;
111 delete [] fTime; fTime = 0x0;
112 delete [] fNL0Times; fNL0Times = 0x0;
113 delete [] fL1TimeSum; fL1TimeSum = 0x0;
114 delete [] fTriggerBits; fTriggerBits = 0x0;
115
116 fNEntries = 0;
117 fCurrent = -1;
118
119 fL0Times->Reset();
120}
121
122//_______________
123AliAODCaloTrigger& AliAODCaloTrigger::operator=(const AliAODCaloTrigger& src)
124{
125 //
126 if (this != &src) src.Copy(*this);
127
128 return *this;
129}
130
131//_______________
132void AliAODCaloTrigger::Copy(TObject &obj) const
133{
134 //
135 TNamed::Copy(obj);
136
137 AliAODCaloTrigger& dest = static_cast<AliAODCaloTrigger&>(obj);
138
139 if (dest.fNEntries) dest.DeAllocate();
140
141 dest.Allocate(fNEntries);
142
143 for (Int_t i = 0; i < fNEntries; i++)
144 {
145 Int_t times[10];
146 for (Int_t j = 0; j < 10; j++) times[j] = fL0Times->At(10 * i + j);
147
148 dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i], fL1TimeSum[i], fTriggerBits[i]);
149 }
150
151 dest.SetL1Threshold(0, fL1Threshold[0]);
152 dest.SetL1Threshold(1, fL1Threshold[1]);
153 dest.SetL1V0(fL1V0);
154 dest.SetL1FrameMask(fL1FrameMask);
155}
156
157//_______________
158void AliAODCaloTrigger::Allocate(Int_t size)
159{
160 //
161 if (!size) return;
162
163 fNEntries = size;
164
165 fColumn = new Int_t[fNEntries];
166 fRow = new Int_t[fNEntries];
167 fAmplitude = new Float_t[fNEntries];
168 fTime = new Float_t[fNEntries];
169 fNL0Times = new Int_t[fNEntries];
170 fL1TimeSum = new Int_t[fNEntries];
171 fTriggerBits = new Int_t[fNEntries];
172
173 for (Int_t i = 0; i < fNEntries; i++)
174 {
175 fColumn[i] = 0;
176 fRow[i] = 0;
177 fAmplitude[i] = 0;
178 fTime[i] = 0;
179 fNL0Times[i] = 0;
180 fL1TimeSum[i] = 0;
181 fTriggerBits[i] = 0;
182 }
183
184 fL0Times->Set(fNEntries * 10);
185}
186
187//_______________
188Bool_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)
189{
190 //
191 fCurrent++;
192
193 fColumn[fCurrent] = col;
194 fRow[fCurrent] = row;
195 fAmplitude[fCurrent] = amp;
196 fTime[fCurrent] = time;
197 fNL0Times[fCurrent] = ntrgtimes;
198 fL1TimeSum[fCurrent] = trgts;
199 fTriggerBits[fCurrent] = trgbits;
200
201 if (ntrgtimes > 9)
202 {
203 AliError("Should not have more than 10 L0 times");
204 return kFALSE;
205 }
206
207 for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) fL0Times->AddAt(trgtimes[i], 10 * fCurrent + i);
208
209 return kTRUE;
210}
211
212//_______________
213Bool_t AliAODCaloTrigger::Next()
214{
215 //
216 if (fCurrent >= fNEntries - 1 || !fNEntries) return kFALSE;
217
218 fCurrent++;
219
220 return kTRUE;
221}
222
223//_______________
224void AliAODCaloTrigger::GetPosition(Int_t& col, Int_t& row) const
225{
226 //
227 if (fCurrent == -1) return;
228
229 col = fColumn[fCurrent];
230 row = fRow[fCurrent];
231}
232
233//_______________
234void AliAODCaloTrigger::GetAmplitude(Float_t& amp) const
235{
236 //
237 if (fCurrent == -1) return;
238
239 amp = fAmplitude[fCurrent];
240}
241
242//_______________
243void AliAODCaloTrigger::GetTime(Float_t& time) const
244{
245 //
246 if (fCurrent == -1) return;
247
248 time = fTime[fCurrent];
249}
250
251//_______________
252void AliAODCaloTrigger::GetL1TimeSum(Int_t& amp) const
253{
254 //
255 if (fCurrent == -1) return;
256
257 amp = fL1TimeSum[fCurrent];
258}
259
260//_______________
261void AliAODCaloTrigger::GetNL0Times(Int_t& ntimes) const
262{
263 //
264 if (fCurrent == -1) return;
265
266 ntimes = fNL0Times[fCurrent];
267}
268
269//_______________
270void AliAODCaloTrigger::GetTriggerBits(Int_t& bits) const
271{
272 //
273 if (fCurrent == -1) return;
274
275 bits = fTriggerBits[fCurrent];
276}
277
278//_______________
279void AliAODCaloTrigger::GetL0Times(Int_t times[]) const
280{
281 //
282 if (fCurrent == -1) return;
283
284 for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) times[i] = fL0Times->At(10 * fCurrent + i);
285}
286
287//_______________
288void AliAODCaloTrigger::Print(const Option_t* /*opt*/) const
289{
290 //
291 if (fCurrent == -1) return;
292
293 printf("============\n");
294 printf("--L0:\n");
295 printf("\tPOSITION (X: %2d Y: %2d) / FITTED F-ALTRO (AMP: %4f TIME: %3f)\n",
296 fColumn[fCurrent], fRow[fCurrent], fAmplitude[fCurrent], fTime[fCurrent]);
297 printf("\t%d L0 TIMES (", fNL0Times[fCurrent]);
298 for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) printf("%2d ",fL0Times->At(10 * fCurrent + i));
299 printf(")\n");
300 printf("--L1:\n");
301 printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]);
63c22917 302 printf("\tHIGH THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
303 printf("\tLOW THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[2], fL1Threshold[3]);
720f7306 304 printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fCurrent]);
305}