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