1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
21 Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
24 #include "AliAODCaloTrigger.h"
28 #include "Riostream.h"
31 ClassImp(AliAODCaloTrigger)
34 AliAODCaloTrigger::AliAODCaloTrigger() : AliVCaloTrigger(),
42 fL0Times(new TArrayI()),
50 for (int i = 0; i < 4; i++) fL1Threshold[i] = 0;
51 fL1V0[0] = fL1V0[1] = 0;
55 AliAODCaloTrigger::AliAODCaloTrigger(const char* name, const char* title) : AliVCaloTrigger(name, title),
63 fL0Times(new TArrayI()),
71 fL1Threshold[0] = fL1Threshold[1] = 0;
72 fL1V0[0] = fL1V0[1] = 0;
76 AliAODCaloTrigger::AliAODCaloTrigger(const AliAODCaloTrigger& src) : AliVCaloTrigger(src),
84 fL0Times(new TArrayI()),
96 AliAODCaloTrigger::~AliAODCaloTrigger()
99 if (fNEntries) DeAllocate();
101 delete fL0Times; fL0Times = 0x0;
105 void AliAODCaloTrigger::DeAllocate()
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;
123 AliAODCaloTrigger& AliAODCaloTrigger::operator=(const AliAODCaloTrigger& src)
126 if (this != &src) src.Copy(*this);
132 void AliAODCaloTrigger::Copy(TObject &obj) const
135 AliVCaloTrigger::Copy(obj);
137 AliAODCaloTrigger& dest = static_cast<AliAODCaloTrigger&>(obj);
139 if (dest.fNEntries) dest.DeAllocate();
141 dest.Allocate(fNEntries);
143 for (Int_t i = 0; i < fNEntries; i++)
146 for (Int_t j = 0; j < 10; j++) times[j] = fL0Times->At(10 * i + j);
148 dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i], fL1TimeSum[i], fTriggerBits[i]);
151 dest.SetL1Threshold(0, fL1Threshold[0]);
152 dest.SetL1Threshold(1, fL1Threshold[1]);
154 dest.SetL1FrameMask(fL1FrameMask);
158 void AliAODCaloTrigger::Allocate(Int_t size)
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];
173 for (Int_t i = 0; i < fNEntries; i++)
184 fL0Times->Set(fNEntries * 10);
188 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)
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;
203 AliError("Should not have more than 10 L0 times");
207 for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) fL0Times->AddAt(trgtimes[i], 10 * fCurrent + i);
213 Bool_t AliAODCaloTrigger::Next()
216 if (fCurrent >= fNEntries - 1 || !fNEntries) return kFALSE;
224 void AliAODCaloTrigger::GetPosition(Int_t& col, Int_t& row) const
227 if (fCurrent == -1) return;
229 col = fColumn[fCurrent];
230 row = fRow[fCurrent];
234 void AliAODCaloTrigger::GetAmplitude(Float_t& amp) const
237 if (fCurrent == -1) return;
239 amp = fAmplitude[fCurrent];
243 void AliAODCaloTrigger::GetTime(Float_t& time) const
246 if (fCurrent == -1) return;
248 time = fTime[fCurrent];
252 void AliAODCaloTrigger::GetL1TimeSum(Int_t& amp) const
255 if (fCurrent == -1) return;
257 amp = fL1TimeSum[fCurrent];
261 void AliAODCaloTrigger::GetNL0Times(Int_t& ntimes) const
264 if (fCurrent == -1) return;
266 ntimes = fNL0Times[fCurrent];
270 void AliAODCaloTrigger::GetTriggerBits(Int_t& bits) const
273 if (fCurrent == -1) return;
275 bits = fTriggerBits[fCurrent];
279 void AliAODCaloTrigger::GetL0Times(Int_t times[]) const
282 if (fCurrent == -1) return;
284 for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) times[i] = fL0Times->At(10 * fCurrent + i);
288 void AliAODCaloTrigger::Print(const Option_t* /*opt*/) const
291 if (fCurrent == -1) return;
293 printf("============\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));
301 printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]);
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]);
304 printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fCurrent]);