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 "AliESDCaloTrigger.h"
28 #include "Riostream.h"
31 ClassImp(AliESDCaloTrigger)
34 AliESDCaloTrigger::AliESDCaloTrigger() : TNamed(),
42 fL0Times(new TArrayI()),
50 AliESDCaloTrigger::AliESDCaloTrigger(const AliESDCaloTrigger& src) : TNamed(src),
58 fL0Times(new TArrayI()),
67 AliESDCaloTrigger::~AliESDCaloTrigger()
70 if (fNEntries) DeAllocate();
72 delete fL0Times; fL0Times = 0x0;
76 void AliESDCaloTrigger::DeAllocate()
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;
94 AliESDCaloTrigger& AliESDCaloTrigger::operator=(const AliESDCaloTrigger& src)
97 if (this != &src) src.Copy(*this);
103 void AliESDCaloTrigger::Copy(TObject &obj) const
108 AliESDCaloTrigger& dest = static_cast<AliESDCaloTrigger&>(obj);
110 if (dest.fNEntries) dest.DeAllocate();
112 dest.Allocate(fNEntries);
114 for (Int_t i = 0; i < fNEntries; i++)
117 for (Int_t j = 0; j < 10; j++) times[j] = fL0Times->At(10 * i + j);
119 dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i], fL1TimeSum[i], fTriggerBits[i]);
124 void AliESDCaloTrigger::Allocate(Int_t size)
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];
136 fL1TimeSum = new Int_t[fNEntries];
137 fTriggerBits = new Int_t[fNEntries];
139 for (Int_t i = 0; i < fNEntries; i++)
150 fL0Times->Set(fNEntries * 10);
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)
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;
169 AliError("Should not have more than 10 L0 times");
173 for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) fL0Times->AddAt(trgtimes[i], 10 * fCurrent + i);
180 void AliESDCaloTrigger::SetTriggerBits(Int_t col, Int_t row, Int_t i, Int_t j)
183 if (col < 0 || col > 47 || row < 0 || row > 63)
185 AliError("Bad position!");
189 fTriggerBits[col][row] = (fTriggerBits[col][row] | (1 << (i + 3 * j))); // L0 L1g L1j
194 Bool_t AliESDCaloTrigger::Next()
197 if (fCurrent >= fNEntries - 1 || !fNEntries) return kFALSE;
205 void AliESDCaloTrigger::GetPosition(Int_t& col, Int_t& row) const
208 if (fCurrent == -1) return;
210 col = fColumn[fCurrent];
211 row = fRow[fCurrent];
215 void AliESDCaloTrigger::GetAmplitude(Float_t& amp) const
218 if (fCurrent == -1) return;
220 amp = fAmplitude[fCurrent];
224 void AliESDCaloTrigger::GetTime(Float_t& time) const
227 if (fCurrent == -1) return;
229 time = fTime[fCurrent];
233 void AliESDCaloTrigger::GetL1TimeSum(Int_t& amp) const
236 if (fCurrent == -1) return;
238 amp = fL1TimeSum[fCurrent];
242 void AliESDCaloTrigger::GetNL0Times(Int_t& ntimes) const
245 if (fCurrent == -1) return;
247 ntimes = fNL0Times[fCurrent];
251 void AliESDCaloTrigger::GetTriggerBits(Int_t& bits) const
254 if (fCurrent == -1) return;
256 bits = fTriggerBits[fCurrent];
260 void AliESDCaloTrigger::GetL0Times(Int_t times[]) const
263 if (fCurrent == -1) return;
265 for (Int_t i = 0; i < fNL0Times[fCurrent]; i++) times[i] = fL0Times->At(10 * fCurrent + i);
269 void AliESDCaloTrigger::Print(const Option_t* /*opt*/) const
272 if (fCurrent == -1) return;
274 printf("============\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));
282 printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]);
283 printf("\tTHRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
284 printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fCurrent]);