]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALTriggerData.cxx
Solve RuleChecker violations
[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),
521ea43e 44fL1TriggerType(),
45fL1DataDecoded(0)
916f1e76 46{
79b05051 47 // Ctor
48
de39a0ff 49 for (Int_t i = 0; i < 2; i++)
50 {
51 fL0Patches[i] = new TClonesArray("AliEMCALTriggerPatch");
52 fL1GammaPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
53 fL1JetPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
54 }
916f1e76 55
de39a0ff 56 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;
57 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 58
59 fL1V0[0] = fL1V0[1] = 0;
60 for (Int_t i = 0; i < 8; i++) fL1TriggerType[i] = 0;
916f1e76 61}
62
63//_____________
64AliEMCALTriggerData::~AliEMCALTriggerData()
65{
79b05051 66 // Dtor
67
de39a0ff 68 for (Int_t i = 0; i < 2; i++)
69 {
70 if ( fL0Patches[i]) fL0Patches[i]->Delete();
71 if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
72 if ( fL1JetPatches[i]) fL1JetPatches[i]->Delete();
73 }
916f1e76 74}
75
76//_____________
de39a0ff 77void AliEMCALTriggerData::SetL0Region(Int_t i, const Int_t**& region)
916f1e76 78{
79b05051 79 // L0 region
80
de39a0ff 81 if (i < 0 || i > 31)
916f1e76 82 {
de39a0ff 83 AliError("Bad index!");
84 return;
916f1e76 85 }
de39a0ff 86
87 for (Int_t j=0;j<24;j++)
88 for (Int_t k=0;k<4;k++) fL0Region[i][j][k] = region[j][k];
916f1e76 89}
90
91//_____________
de39a0ff 92void AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i, TClonesArray& patches) const
916f1e76 93{
79b05051 94 // List of patches
95
de39a0ff 96 if (i < 0 || i > 1)
916f1e76 97 {
de39a0ff 98 AliError("Bad index!");
99 return;
100 }
101
102 switch (type)
103 {
104 case kL0:
105 patches = *fL0Patches[i];
106 break;
107 case kL1Gamma:
108 patches = *fL1GammaPatches[i];
109 break;
110 case kL1Jet:
111 patches = *fL1JetPatches[i];
112 break;
113 default:
114 AliError("Unknown trigger type!");
115 break;
916f1e76 116 }
117}
118
119//_____________
de39a0ff 120TClonesArray* AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i) const
916f1e76 121{
79b05051 122 // List of patches
123
de39a0ff 124 if (i < 0 || i > 1)
125 {
126 AliError("Bad index!");
127 return 0x0;
128 }
916f1e76 129
de39a0ff 130 switch (type)
916f1e76 131 {
de39a0ff 132 case kL0:
133 return fL0Patches[i];
134 break;
135 case kL1Gamma:
136 return fL1GammaPatches[i];
137 break;
138 case kL1Jet:
139 return fL1JetPatches[i];
140 break;
141 default:
142 AliError("Unknown trigger type!");
143 break;
916f1e76 144 }
de39a0ff 145
146 return 0x0;
916f1e76 147}
148
149//_____________
de39a0ff 150void AliEMCALTriggerData::SetPatches(TriggerType_t type, Int_t i, const TClonesArray& patches)
916f1e76 151{
79b05051 152 // Set list of patches
153
de39a0ff 154 if (i < 0 || i > 1)
155 {
156 AliError("Bad index!");
157 return;
158 }
159
160 if (patches.GetEntriesFast())
161 {
162 TClonesArray* arr = 0x0;
163
164 switch (type)
916f1e76 165 {
de39a0ff 166 case kL0:
167 arr = fL0Patches[i];
168 break;
169 case kL1Gamma:
170 arr = fL1GammaPatches[i];
171 break;
172 case kL1Jet:
173 arr = fL1JetPatches[i];
174 break;
175 default:
176 AliError("Unknown trigger type!");
177 return;
916f1e76 178 }
de39a0ff 179
180 if (arr)
181 {
182 Int_t size = arr->GetSize() + patches.GetSize();
183
184 arr->Expand(size);
185
186 for (Int_t k = 0; k < patches.GetEntriesFast(); k++)
187 {
188 AliEMCALTriggerPatch* p = static_cast<AliEMCALTriggerPatch*>(patches.At(k));
189 new((*arr)[arr->GetEntriesFast()]) AliEMCALTriggerPatch(*p);
190 }
191 }
192 else
193 {
194 AliError("TClonesArray is NULL!");
195 }
196 }
916f1e76 197}
198
199//_____________
de39a0ff 200void AliEMCALTriggerData::SetL1Region(Int_t i, Int_t**& region)
916f1e76 201{
79b05051 202 // Set L1 region
203
de39a0ff 204 if (i < 0 || i > 1)
205 {
206 AliError("Bad index!");
207 return;
208 }
209
210 for (Int_t j = 0; j < 48; j++)
211 for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = region[j][k];
916f1e76 212}
213
de39a0ff 214//_____________
215void AliEMCALTriggerData::GetL1Region(Int_t i, Int_t arr[][64]) const
216{
79b05051 217 // Get L1 region
218
de39a0ff 219 if (i < 0 || i > 1)
220 {
221 AliError("Bad index!");
222 return;
223 }
224
225 for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) { arr[j][k] = fL1Region[i][j][k]; }
226}
227
228
916f1e76 229//_____________
230void AliEMCALTriggerData::Scan() const
231{
79b05051 232 // Dump
233
a61738e1 234 TIterator* nP;
235
916f1e76 236 printf("L0:\n");
a61738e1 237 printf("\tFound (%2d,%2d) patches\n", fL0Patches[1]->GetEntriesFast(), fL0Patches[0]->GetEntriesFast());
238 printf("\tRAW:\n");
239 nP = fL0Patches[1]->MakeIterator();
240 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
241 printf("\tREC:\n");
242 nP = fL0Patches[0]->MakeIterator();
243 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
916f1e76 244 printf("L1:\n");
a61738e1 245 printf("\tFound (%4d,%4d) gamma patches\n",fL1GammaPatches[1]->GetEntriesFast(), fL1GammaPatches[0]->GetEntriesFast());
246 printf("\tRAW:\n");
247 nP = fL1GammaPatches[1]->MakeIterator();
248 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
249 printf("\tREC:\n");
250 nP = fL1GammaPatches[0]->MakeIterator();
251 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
252 printf("\tFound (%4d,%4d) jet patches\n",fL1JetPatches[1]->GetEntriesFast(), fL1JetPatches[0]->GetEntriesFast());
253 printf("\tRAW:\n");
254 nP = fL1JetPatches[1]->MakeIterator();
255 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
256 printf("\tREC:\n");
257 nP = fL1JetPatches[0]->MakeIterator();
258 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
916f1e76 259}
260
261//_____________
262void AliEMCALTriggerData::Reset()
263{
79b05051 264 // Reset
265
de39a0ff 266 for (Int_t i = 0; i < 2; i++)
267 {
268 if ( fL0Patches[i]) fL0Patches[i]->Delete();
269 if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
270 if ( fL1JetPatches[i]) fL1JetPatches[i]->Delete();
271 }
272
273 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;
521ea43e 274
275 fL1DataDecoded = 0;
916f1e76 276}
277
278
279