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