]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALTriggerData.cxx
Updated drift gas. It's Ne-CO2 90/10 now.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTriggerData.cxx
CommitLineData
916f1e76 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 purpeateose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17
18
19EMCal trigger data container
de39a0ff 20for data (both raw & rec) persistency
916f1e76 21Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
22*/
23
24#include "AliEMCALTriggerData.h"
25#include "AliEMCALTriggerPatch.h"
de39a0ff 26#include "AliLog.h"
a61738e1 27#include "TIterator.h"
de39a0ff 28#include "Riostream.h"
916f1e76 29
30ClassImp(AliEMCALTriggerData)
31
32//_____________
33AliEMCALTriggerData::AliEMCALTriggerData() : TObject(),
de39a0ff 34fMode(0),
35fL0Patches(),
36fL0Region(),
37fL1GammaPatches(),
38fL1JetPatches(),
39fL1Region(),
40fL1GammaThreshold(0),
da6062af 41fL1JetThreshold(0),
42fL1V0(),
43fL1FrameMask(0),
44fL1TriggerType()
916f1e76 45{
de39a0ff 46 //
47 for (Int_t i = 0; i < 2; i++)
48 {
49 fL0Patches[i] = new TClonesArray("AliEMCALTriggerPatch");
50 fL1GammaPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
51 fL1JetPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
52 }
916f1e76 53
de39a0ff 54 for (Int_t i = 0; i < 32; i++) for (Int_t j = 0; j < 24; j++) for (Int_t k = 0; k < 4; k++) fL0Region[i][j][k] = 0;
55 for (Int_t i = 0; i < 2; i++) for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = 0;
da6062af 56
57 fL1V0[0] = fL1V0[1] = 0;
58 for (Int_t i = 0; i < 8; i++) fL1TriggerType[i] = 0;
916f1e76 59}
60
61//_____________
62AliEMCALTriggerData::~AliEMCALTriggerData()
63{
de39a0ff 64 //
65 for (Int_t i = 0; i < 2; i++)
66 {
67 if ( fL0Patches[i]) fL0Patches[i]->Delete();
68 if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
69 if ( fL1JetPatches[i]) fL1JetPatches[i]->Delete();
70 }
916f1e76 71}
72
73//_____________
de39a0ff 74void AliEMCALTriggerData::SetL0Region(Int_t i, const Int_t**& region)
916f1e76 75{
de39a0ff 76 //
77 if (i < 0 || i > 31)
916f1e76 78 {
de39a0ff 79 AliError("Bad index!");
80 return;
916f1e76 81 }
de39a0ff 82
83 for (Int_t j=0;j<24;j++)
84 for (Int_t k=0;k<4;k++) fL0Region[i][j][k] = region[j][k];
916f1e76 85}
86
87//_____________
de39a0ff 88void AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i, TClonesArray& patches) const
916f1e76 89{
de39a0ff 90 //
91 if (i < 0 || i > 1)
916f1e76 92 {
de39a0ff 93 AliError("Bad index!");
94 return;
95 }
96
97 switch (type)
98 {
99 case kL0:
100 patches = *fL0Patches[i];
101 break;
102 case kL1Gamma:
103 patches = *fL1GammaPatches[i];
104 break;
105 case kL1Jet:
106 patches = *fL1JetPatches[i];
107 break;
108 default:
109 AliError("Unknown trigger type!");
110 break;
916f1e76 111 }
112}
113
114//_____________
de39a0ff 115TClonesArray* AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i) const
916f1e76 116{
de39a0ff 117 //
118 if (i < 0 || i > 1)
119 {
120 AliError("Bad index!");
121 return 0x0;
122 }
916f1e76 123
de39a0ff 124 switch (type)
916f1e76 125 {
de39a0ff 126 case kL0:
127 return fL0Patches[i];
128 break;
129 case kL1Gamma:
130 return fL1GammaPatches[i];
131 break;
132 case kL1Jet:
133 return fL1JetPatches[i];
134 break;
135 default:
136 AliError("Unknown trigger type!");
137 break;
916f1e76 138 }
de39a0ff 139
140 return 0x0;
916f1e76 141}
142
143//_____________
de39a0ff 144void AliEMCALTriggerData::SetPatches(TriggerType_t type, Int_t i, const TClonesArray& patches)
916f1e76 145{
146 //
de39a0ff 147 if (i < 0 || i > 1)
148 {
149 AliError("Bad index!");
150 return;
151 }
152
153 if (patches.GetEntriesFast())
154 {
155 TClonesArray* arr = 0x0;
156
157 switch (type)
916f1e76 158 {
de39a0ff 159 case kL0:
160 arr = fL0Patches[i];
161 break;
162 case kL1Gamma:
163 arr = fL1GammaPatches[i];
164 break;
165 case kL1Jet:
166 arr = fL1JetPatches[i];
167 break;
168 default:
169 AliError("Unknown trigger type!");
170 return;
916f1e76 171 }
de39a0ff 172
173 if (arr)
174 {
175 Int_t size = arr->GetSize() + patches.GetSize();
176
177 arr->Expand(size);
178
179 for (Int_t k = 0; k < patches.GetEntriesFast(); k++)
180 {
181 AliEMCALTriggerPatch* p = static_cast<AliEMCALTriggerPatch*>(patches.At(k));
182 new((*arr)[arr->GetEntriesFast()]) AliEMCALTriggerPatch(*p);
183 }
184 }
185 else
186 {
187 AliError("TClonesArray is NULL!");
188 }
189 }
916f1e76 190}
191
192//_____________
de39a0ff 193void AliEMCALTriggerData::SetL1Region(Int_t i, Int_t**& region)
916f1e76 194{
de39a0ff 195 //
196 if (i < 0 || i > 1)
197 {
198 AliError("Bad index!");
199 return;
200 }
201
202 for (Int_t j = 0; j < 48; j++)
203 for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = region[j][k];
916f1e76 204}
205
de39a0ff 206//_____________
207void AliEMCALTriggerData::GetL1Region(Int_t i, Int_t arr[][64]) const
208{
209 //
210 if (i < 0 || i > 1)
211 {
212 AliError("Bad index!");
213 return;
214 }
215
216 for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) { arr[j][k] = fL1Region[i][j][k]; }
217}
218
219
916f1e76 220//_____________
221void AliEMCALTriggerData::Scan() const
222{
223 //
a61738e1 224 TIterator* nP;
225
916f1e76 226 printf("L0:\n");
a61738e1 227 printf("\tFound (%2d,%2d) patches\n", fL0Patches[1]->GetEntriesFast(), fL0Patches[0]->GetEntriesFast());
228 printf("\tRAW:\n");
229 nP = fL0Patches[1]->MakeIterator();
230 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
231 printf("\tREC:\n");
232 nP = fL0Patches[0]->MakeIterator();
233 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
916f1e76 234 printf("L1:\n");
a61738e1 235 printf("\tFound (%4d,%4d) gamma patches\n",fL1GammaPatches[1]->GetEntriesFast(), fL1GammaPatches[0]->GetEntriesFast());
236 printf("\tRAW:\n");
237 nP = fL1GammaPatches[1]->MakeIterator();
238 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
239 printf("\tREC:\n");
240 nP = fL1GammaPatches[0]->MakeIterator();
241 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
242 printf("\tFound (%4d,%4d) jet patches\n",fL1JetPatches[1]->GetEntriesFast(), fL1JetPatches[0]->GetEntriesFast());
243 printf("\tRAW:\n");
244 nP = fL1JetPatches[1]->MakeIterator();
245 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
246 printf("\tREC:\n");
247 nP = fL1JetPatches[0]->MakeIterator();
248 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
916f1e76 249}
250
251//_____________
252void AliEMCALTriggerData::Reset()
253{
254 //
de39a0ff 255 for (Int_t i = 0; i < 2; i++)
256 {
257 if ( fL0Patches[i]) fL0Patches[i]->Delete();
258 if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
259 if ( fL1JetPatches[i]) fL1JetPatches[i]->Delete();
260 }
261
262 for (Int_t i = 0; i < 2; i++) for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = 0;
916f1e76 263}
264
265
266