]>
Commit | Line | Data |
---|---|---|
de39a0ff | 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 purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | ||
18 | ||
19 | ||
20 | ||
21 | Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3 | |
22 | */ | |
23 | ||
24 | #include "AliEMCALTriggerRawDigitMaker.h" | |
25 | #include "AliEMCALTriggerSTURawStream.h" | |
26 | #include "AliCaloRawAnalyzerFakeALTRO.h" | |
27 | #include "AliEMCALTriggerRawDigit.h" | |
28 | #include "AliCaloRawStreamV3.h" | |
29 | #include "AliRun.h" | |
30 | #include "AliRunLoader.h" | |
31 | #include "AliEMCAL.h" | |
32 | #include "AliCaloBunchInfo.h" | |
33 | #include "AliRawReader.h" | |
34 | #include "AliEMCALTriggerDCSConfigDB.h" | |
804b828a | 35 | #include "AliEMCALTriggerDCSConfig.h" |
36 | #include "AliEMCALTriggerTRUDCSConfig.h" | |
37 | #include "AliEMCALTriggerSTUDCSConfig.h" | |
de39a0ff | 38 | #include "AliEMCALTriggerData.h" |
39 | #include "AliEMCALTriggerPatch.h" | |
40 | #include "AliLog.h" | |
41 | ||
de39a0ff | 42 | #include "AliRawVEvent.h" |
43 | #include "AliRawEventHeaderBase.h" | |
44 | #include "AliRawEvent.h" | |
45 | #include "AliRawVEquipment.h" | |
46 | #include "AliRawEquipmentHeader.h" | |
47 | ||
7965f885 | 48 | #include "Riostream.h" |
49 | ||
92d9f317 | 50 | #include "AliCaloRawAnalyzerFactory.h" |
51 | ||
de39a0ff | 52 | namespace |
53 | { | |
54 | const Int_t kSTUEqId = 4652; | |
55 | } | |
56 | ||
57 | ClassImp(AliEMCALTriggerRawDigitMaker) | |
58 | ||
59 | //_______________ | |
60 | AliEMCALTriggerRawDigitMaker::AliEMCALTriggerRawDigitMaker() : TObject(), | |
61 | fGeometry(0x0), | |
62 | fRawReader(0x0), | |
63 | fCaloRawStream(0x0), | |
64 | fSTURawStream(0x0), | |
65 | fRawDigits(0x0), | |
66 | fRawAnalyzer(0x0), | |
67 | fDCSConfig(0x0), | |
68 | fTriggerData(0x0) | |
69 | { | |
a51e676d | 70 | // def ctor |
71 | ||
72 | AliRunLoader* rl = AliRunLoader::Instance(); | |
73 | if (rl && rl->GetAliRun()){ | |
74 | AliEMCAL * emcal = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL")); | |
75 | if(emcal) fGeometry = emcal->GetGeometry(); | |
76 | } | |
77 | ||
78 | if(!fGeometry) | |
79 | { | |
80 | AliDebug(1, Form("Using default geometry")); | |
81 | fGeometry = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName()); | |
82 | } | |
83 | ||
92d9f317 | 84 | // fRawAnalyzer = new AliCaloRawAnalyzerFakeALTRO (); |
a51e676d | 85 | |
92d9f317 | 86 | fRawAnalyzer = (AliCaloRawAnalyzerFakeALTRO*)AliCaloRawAnalyzerFactory::CreateAnalyzer(kFakeAltro); |
87 | ||
a51e676d | 88 | fDCSConfig = AliEMCALTriggerDCSConfigDB::Instance(); |
8cc543cb | 89 | |
90 | Int_t nRawDigits = fGeometry->GetNTotalTRU() * 96; | |
91 | for (Int_t i=0; i<nRawDigits; i++) fRawDigitIndex[i] = -1; | |
de39a0ff | 92 | } |
93 | ||
94 | //_______________ | |
95 | AliEMCALTriggerRawDigitMaker::~AliEMCALTriggerRawDigitMaker() | |
96 | { | |
97 | // dtor | |
98 | } | |
99 | ||
100 | //_______________ | |
101 | void AliEMCALTriggerRawDigitMaker::SetIO(AliRawReader* reader, AliCaloRawStreamV3& in, AliEMCALTriggerSTURawStream& inSTU, TClonesArray* digits, AliEMCALTriggerData* data) | |
102 | { | |
79b05051 | 103 | // Connect I/O |
104 | ||
de39a0ff | 105 | fRawReader = reader; |
106 | fCaloRawStream = ∈ | |
107 | fRawDigits = digits; | |
108 | fSTURawStream = &inSTU; | |
109 | fTriggerData = data; | |
110 | } | |
111 | ||
112 | //_______________ | |
113 | void AliEMCALTriggerRawDigitMaker::Add(const std::vector<AliCaloBunchInfo> &bunchlist) | |
114 | { | |
79b05051 | 115 | // Add bunch list |
116 | ||
de39a0ff | 117 | Int_t hwAdd = fCaloRawStream->GetHWAddress(); |
118 | UShort_t iRCU = fCaloRawStream->GetDDLNumber() % 2; // 0/1 | |
119 | UShort_t iBranch = ( hwAdd >> 11 ) & 0x1; // 0/1 | |
120 | ||
121 | // TRU id | |
122 | Int_t iTRU = ( (iRCU << 1) | iBranch ) - 1; // 0..2 | |
123 | ||
124 | iTRU = (fCaloRawStream->GetModule() % 2) ? 2 * (2 - iTRU) + 1 : 2 * iTRU; | |
125 | ||
126 | iTRU += 6 * int(fCaloRawStream->GetModule()/2); | |
127 | ||
128 | if (AliDebugLevel()) | |
129 | { | |
130 | printf("===\n"); | |
131 | printf("| Hw Adress: 0x%x => SM# %2d / RCU# %d / Branch# %d / TRU# %2d / ADC# %2d\n", | |
132 | hwAdd, fCaloRawStream->GetModule(), iRCU, iBranch, iTRU, fCaloRawStream->GetColumn()); | |
133 | } | |
134 | ||
135 | Int_t idx; | |
136 | ||
137 | AliEMCALTriggerRawDigit* dig = 0x0; | |
138 | ||
139 | Int_t timeSamples[256]; for (Int_t j=0; j<256; j++) timeSamples[j] = 0; | |
140 | Int_t nSamples = 0; | |
141 | ||
142 | UInt_t iBin = bunchlist.at(0).GetStartBin(); | |
143 | Int_t iBunch = 0; | |
144 | ||
145 | for (UInt_t i = 0; i < bunchlist.size(); i++) | |
146 | { | |
147 | AliCaloBunchInfo bunch = bunchlist.at(i); | |
148 | ||
149 | if (iBin > bunch.GetStartBin()) | |
150 | { | |
151 | iBin = bunch.GetStartBin(); | |
152 | iBunch = i; | |
153 | } | |
154 | ||
155 | if (fCaloRawStream->GetColumn() < 96) | |
156 | { | |
157 | const UShort_t* sig = bunch.GetData(); | |
158 | Int_t startBin = bunch.GetStartBin(); | |
159 | ||
160 | for (Int_t iS = 0; iS < bunch.GetLength(); iS++) | |
161 | { | |
162 | Int_t time = startBin--; | |
163 | Int_t amp = sig[iS]; | |
164 | ||
165 | if (amp) timeSamples[nSamples++] = ((time << 12) & 0xFF000) | (amp & 0xFFF); | |
166 | ||
167 | if (AliDebugLevel()) | |
168 | { | |
169 | printf("ADC# %2d / time: %2d amplitude: %d\n", fCaloRawStream->GetColumn(), time, amp); | |
170 | } | |
171 | } | |
172 | } | |
173 | } | |
174 | ||
175 | if (fCaloRawStream->GetColumn() > 95 && fCaloRawStream->GetColumn() < 106) | |
176 | { | |
177 | Int_t nBits = (fCaloRawStream->GetColumn() == 105) ? 6 : 10; | |
178 | ||
179 | const UShort_t* sig = bunchlist.at(iBunch).GetData(); | |
180 | ||
181 | if (AliDebugLevel()) printf("| L0 id in F-ALTRO => bunch length is: %d\n", bunchlist.at(iBunch).GetLength()); | |
182 | ||
183 | for (Int_t i = 0; i < bunchlist.at(iBunch).GetLength(); i++) | |
184 | { | |
185 | if (AliDebugLevel()) printf("| sig[%3d]: %x\n",i,sig[i]); | |
186 | ||
187 | for (Int_t j = 0; j < nBits; j++) | |
188 | { | |
189 | if (sig[i] & ( 1 << j )) | |
190 | { | |
191 | if (AliDebugLevel()) | |
192 | { | |
193 | printf("| Add L0 patch index in TRU# %2d position %2d\n",iTRU,(fCaloRawStream->GetColumn() - 96) * 10 + j); | |
194 | } | |
195 | ||
196 | if (fGeometry->GetAbsFastORIndexFromTRU(iTRU, (fCaloRawStream->GetColumn() - 96) * 10 + j, idx)) | |
197 | { | |
198 | if (fRawDigitIndex[idx] >= 0) | |
199 | { | |
200 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
201 | } | |
202 | else | |
203 | { | |
54ad9360 | 204 | AliDebug(100,"L0: Trying to update trigger info of a non-existent digit!"); |
de39a0ff | 205 | |
206 | fRawDigitIndex[idx] = fRawDigits->GetEntriesFast(); | |
207 | new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0); | |
208 | ||
209 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
210 | } | |
211 | ||
de39a0ff | 212 | dig->SetL0Time(iBin); |
213 | } | |
214 | } | |
215 | } | |
216 | ||
217 | if (fCaloRawStream->GetColumn() == 105 && (sig[i] & (1 << 6))) | |
218 | { | |
219 | fTriggerData->SetL0Trigger(1, iTRU, 1); | |
220 | ||
221 | if (AliDebugLevel()) printf("=======TRU# %2d has issued a L0\n",iTRU); | |
222 | } | |
223 | ||
224 | iBin--; | |
225 | } | |
226 | } | |
227 | else | |
228 | { | |
229 | if (nSamples && fGeometry->GetAbsFastORIndexFromTRU(iTRU, fCaloRawStream->GetColumn(), idx)) | |
230 | { | |
231 | if (fRawDigitIndex[idx] < 0) | |
232 | { | |
233 | fRawDigitIndex[idx] = fRawDigits->GetEntriesFast(); | |
234 | new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, timeSamples, nSamples); | |
235 | } | |
236 | else | |
237 | { | |
238 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
239 | dig->SetTimeSamples(timeSamples, nSamples); | |
240 | } | |
241 | ||
242 | if (AliDebugLevel()) | |
243 | { | |
244 | printf("| Add TRG digit of id# %4d from TRU# %2d ADC# %2d\n", idx, iTRU, fCaloRawStream->GetColumn()); | |
245 | ||
246 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
247 | dig->Print(""); | |
248 | ||
249 | Int_t iSm, iTru, iEta, iPhi, iD[4], iFor; | |
250 | if (fGeometry->GetPositionInTRUFromAbsFastORIndex(idx, iTru, iEta, iPhi)) | |
251 | { | |
252 | printf("| Position => TRU: %2d Eta: %2d Phi: %2d\n", iTru, iEta, iPhi); | |
253 | } | |
254 | ||
255 | if (fGeometry->GetPositionInSMFromAbsFastORIndex(idx, iSm, iEta, iPhi)) | |
256 | { | |
257 | printf("| Position => SM: %2d Eta: %2d Phi: %2d\n", iSm, iEta, iPhi); | |
258 | } | |
259 | ||
260 | if (fGeometry->GetCellIndexFromFastORIndex(idx, iD)) | |
261 | { | |
262 | printf("| tower iDs: "); | |
263 | for (Int_t i = 0; i < 4; i++) | |
264 | { | |
265 | printf("%5d ",iD[i]); | |
266 | } | |
267 | printf("\n"); | |
268 | ||
269 | for (Int_t i = 0; i < 4; i++) | |
270 | { | |
271 | if (fGeometry->GetFastORIndexFromCellIndex(iD[i], iFor)) | |
272 | { | |
273 | printf("| tower %d to F-OR %d\n",iD[i],iFor); | |
274 | } | |
275 | } | |
276 | } | |
277 | } | |
278 | } | |
279 | } | |
280 | } | |
281 | ||
282 | //_______________ | |
283 | void AliEMCALTriggerRawDigitMaker::PostProcess() | |
284 | { | |
79b05051 | 285 | // Post process digits |
286 | ||
f20a8dd5 | 287 | AliDebug(2,"Start post processing the raw digit maker"); |
de39a0ff | 288 | Int_t idx; |
289 | ||
290 | AliEMCALTriggerRawDigit* dig = 0x0; | |
291 | ||
804b828a | 292 | TVector2 sizeL1gsubr, sizeL1gpatch, sizeL1jsubr, sizeL1jpatch; |
de39a0ff | 293 | |
804b828a | 294 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->GetSegmentation(sizeL1gsubr, sizeL1gpatch, sizeL1jsubr, sizeL1jpatch); |
de39a0ff | 295 | |
296 | fRawReader->Reset(); | |
297 | fRawReader->Select("EMCAL",44); | |
298 | ||
79b05051 | 299 | Bool_t isSTUin = kFALSE; |
de39a0ff | 300 | |
301 | Int_t nSubEv = fRawReader->GetEvent()->GetNSubEvents(); | |
302 | ||
303 | for ( Int_t iSubEv=0; iSubEv<nSubEv; iSubEv++) | |
304 | { | |
79b05051 | 305 | AliRawVEvent *subEv = ((AliRawEvent*)fRawReader->GetEvent())->GetSubEvent(iSubEv); |
306 | if ( !subEv ) continue; | |
de39a0ff | 307 | |
79b05051 | 308 | for (Int_t iEquip = 0; iEquip < subEv->GetNEquipments(); iEquip++) |
de39a0ff | 309 | { |
79b05051 | 310 | Int_t eqId = subEv->GetEquipment(iEquip)->GetEquipmentHeader()->GetId(); |
de39a0ff | 311 | |
79b05051 | 312 | if (eqId == kSTUEqId) isSTUin = kTRUE; |
de39a0ff | 313 | } |
314 | } | |
315 | ||
316 | fRawReader->Reset(); | |
317 | ||
79b05051 | 318 | if (isSTUin && fSTURawStream && fSTURawStream->ReadPayLoad()) |
de39a0ff | 319 | { |
521ea43e | 320 | fTriggerData->SetL1DataDecoded(1); |
321 | ||
63c22917 | 322 | for (int i = 0; i < 2; i++) { |
323 | fTriggerData->SetL1GammaThreshold(i, fSTURawStream->GetL1GammaThreshold(i)); | |
324 | fTriggerData->SetL1JetThreshold( i, fSTURawStream->GetL1JetThreshold(i) ); | |
325 | } | |
de39a0ff | 326 | |
2942f542 | 327 | Int_t v0[2] = { static_cast<Int_t>(fSTURawStream->GetV0A()), static_cast<Int_t>(fSTURawStream->GetV0C())}; |
da6062af | 328 | |
63c22917 | 329 | Int_t type[15] = |
da6062af | 330 | { |
2942f542 | 331 | static_cast<Int_t>(fSTURawStream->GetG(0, 0)), |
332 | static_cast<Int_t>(fSTURawStream->GetG(1, 0)), | |
333 | static_cast<Int_t>(fSTURawStream->GetG(2, 0)), | |
334 | static_cast<Int_t>(fSTURawStream->GetJ(0, 0)), | |
335 | static_cast<Int_t>(fSTURawStream->GetJ(1, 0)), | |
336 | static_cast<Int_t>(fSTURawStream->GetJ(2, 0)), | |
337 | static_cast<Int_t>(fSTURawStream->GetG(0, 1)), | |
338 | static_cast<Int_t>(fSTURawStream->GetG(1, 1)), | |
339 | static_cast<Int_t>(fSTURawStream->GetG(2, 1)), | |
340 | static_cast<Int_t>(fSTURawStream->GetJ(0, 1)), | |
341 | static_cast<Int_t>(fSTURawStream->GetJ(1, 1)), | |
342 | static_cast<Int_t>(fSTURawStream->GetJ(2, 1)), | |
343 | static_cast<Int_t>(fSTURawStream->GetRawData()), | |
344 | static_cast<Int_t>(fSTURawStream->GetRegionEnable()), | |
345 | static_cast<Int_t>(fSTURawStream->GetFwVersion()) | |
521ea43e | 346 | }; |
804b828a | 347 | |
348 | // Modify DCS config from STU payload content | |
63c22917 | 349 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(0, 0, type[0]); |
350 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(1, 0, type[1]); | |
351 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(2, 0, type[2]); | |
352 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(0, 0, type[3]); | |
353 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(1, 0, type[4]); | |
354 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(2, 0, type[5]); | |
355 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(0, 1, type[6]); | |
356 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(1, 1, type[7]); | |
357 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(2, 1, type[8]); | |
358 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(0, 1, type[9]); | |
359 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(1, 1, type[10]); | |
360 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(2, 1, type[11]); | |
361 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetRawData(type[12]); | |
362 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetRegion(type[13]); | |
363 | fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetFw(type[14]); | |
da6062af | 364 | |
365 | fTriggerData->SetL1FrameMask(fSTURawStream->GetFrameReceived()); | |
366 | fTriggerData->SetL1V0(v0); | |
367 | fTriggerData->SetL1TriggerType(type); | |
368 | ||
804b828a | 369 | fTriggerData->SetL1RawData(fSTURawStream->GetRawData()); |
370 | ||
de39a0ff | 371 | Int_t iTRU, x, y; |
372 | ||
373 | if (fSTURawStream->GetRawData()) | |
374 | { | |
375 | if (AliDebugLevel()) printf("| STU => TRU raw data are there!\n"); | |
376 | ||
8cc543cb | 377 | Int_t nTRU = fGeometry->GetNTotalTRU(); |
378 | for (Int_t i = 0; i < nTRU; i++) | |
de39a0ff | 379 | { |
380 | iTRU = fGeometry->GetTRUIndexFromSTUIndex(i); | |
381 | ||
382 | UInt_t adc[96]; for (Int_t j = 0; j < 96; j++) adc[j] = 0; | |
383 | ||
384 | fSTURawStream->GetADC(i, adc); | |
804b828a | 385 | |
de39a0ff | 386 | for (Int_t j = 0; j < 96; j++) |
387 | { | |
63c22917 | 388 | if (adc[j] <= 0) continue; |
389 | ||
390 | AliDebug(10,Form("| STU => TRU# %2d raw data: ADC# %2d: %d\n", iTRU, j, adc[j])); | |
de39a0ff | 391 | |
392 | fGeometry->GetAbsFastORIndexFromTRU(iTRU, j, idx); | |
393 | ||
394 | if (fRawDigitIndex[idx] >= 0) | |
395 | { | |
396 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
397 | ||
a61738e1 | 398 | if (!dig->GetNSamples()) AliDebug(10,Form("TRG digit of id: %4d found in STU but has no time sample in F-ALTRO!",idx)); |
de39a0ff | 399 | } |
400 | else | |
401 | { | |
54ad9360 | 402 | AliDebug(10,Form("TRG digit of id: %4d found in STU but not in F-ALTRO! Create a new digit!",idx)); |
de39a0ff | 403 | |
404 | fRawDigitIndex[idx] = fRawDigits->GetEntriesFast(); | |
405 | new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0); | |
406 | ||
407 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
de39a0ff | 408 | } |
a61738e1 | 409 | |
410 | dig->SetL1TimeSum(adc[j]); | |
de39a0ff | 411 | } |
412 | } | |
413 | } | |
414 | ||
415 | // List of patches in EMCal coordinate system | |
de39a0ff | 416 | |
417 | for (Int_t i = 0; i < fSTURawStream->GetNL0GammaPatch(); i++) | |
418 | { | |
419 | fSTURawStream->GetL0GammaPatch(i, iTRU, x); | |
804b828a | 420 | |
de39a0ff | 421 | iTRU = fGeometry->GetTRUIndexFromSTUIndex(iTRU); |
422 | ||
804b828a | 423 | const Int_t sizePatchL0 = |
424 | ((AliEMCALTriggerTRUDCSConfig*)fDCSConfig->GetTriggerDCSConfig()->GetTRUArr()->At(fGeometry->GetOnlineIndexFromTRUIndex(iTRU)))->GetSegmentation() | |
425 | * | |
426 | ((AliEMCALTriggerTRUDCSConfig*)fDCSConfig->GetTriggerDCSConfig()->GetTRUArr()->At(fGeometry->GetOnlineIndexFromTRUIndex(iTRU)))->GetSegmentation(); | |
de39a0ff | 427 | |
804b828a | 428 | if (AliDebugLevel()) printf("| STU => Found L0 patch id: %2d in TRU# %2d\n", x, iTRU); |
429 | ||
7965f885 | 430 | Int_t idFastOR[4]; |
431 | for (Int_t j = 0; j < 4; j++) idFastOR[j] = -1; | |
de39a0ff | 432 | |
433 | if (fGeometry->GetFastORIndexFromL0Index(iTRU, x, idFastOR, sizePatchL0)) | |
434 | { | |
a61738e1 | 435 | idx = idFastOR[1]; |
436 | ||
de39a0ff | 437 | Int_t px, py; |
a61738e1 | 438 | if (fGeometry->GetPositionInEMCALFromAbsFastORIndex(idx, px, py)) |
de39a0ff | 439 | { |
de39a0ff | 440 | if (AliDebugLevel()) printf("| STU => Add L0 patch at (%2d , %2d)\n", px, py); |
a61738e1 | 441 | |
442 | if (fRawDigitIndex[idx] >= 0) | |
443 | { | |
444 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
7965f885 | 445 | } |
a61738e1 | 446 | else |
447 | { | |
448 | fRawDigitIndex[idx] = fRawDigits->GetEntriesFast(); | |
449 | new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0); | |
de39a0ff | 450 | |
a61738e1 | 451 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); |
7965f885 | 452 | } |
de39a0ff | 453 | |
a61738e1 | 454 | dig->SetTriggerBit(kL0,1); |
455 | } | |
456 | } | |
a61738e1 | 457 | } |
de39a0ff | 458 | |
63c22917 | 459 | for (int ithr = 0; ithr < 2; ithr++) { |
de39a0ff | 460 | |
63c22917 | 461 | for (Int_t i = 0; i < fSTURawStream->GetNL1GammaPatch(ithr); i++) |
462 | { | |
463 | if (fSTURawStream->GetL1GammaPatch(i, ithr, iTRU, x, y)) // col (0..23), row (0..3) | |
de39a0ff | 464 | { |
63c22917 | 465 | iTRU = fGeometry->GetTRUIndexFromSTUIndex(iTRU); |
466 | ||
467 | if (AliDebugLevel()) printf("| STU => Found L1 gamma patch at (%2d , %2d) in TRU# %2d\n", x, y, iTRU); | |
468 | ||
469 | Int_t vx = 23 - x, vy = y + 4 * int(iTRU / 2); // Position in EMCal frame | |
470 | ||
471 | if (iTRU % 2) vx += 24; // C side | |
472 | ||
473 | vx = vx - int(sizeL1gsubr.X()) * int(sizeL1gpatch.X()) + 1; | |
474 | ||
475 | if (vx >= 0 && vy < 63) | |
a61738e1 | 476 | { |
63c22917 | 477 | if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(vx, vy, idx)) |
a61738e1 | 478 | { |
63c22917 | 479 | if (AliDebugLevel()) printf("| STU => Add L1 gamma [%d] patch at (%2d , %2d)\n", ithr, vx, vy); |
480 | ||
481 | if (fRawDigitIndex[idx] >= 0) | |
482 | { | |
483 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
484 | } | |
485 | else | |
486 | { | |
487 | fRawDigitIndex[idx] = fRawDigits->GetEntriesFast(); | |
488 | new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0); | |
489 | ||
490 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
491 | } | |
492 | ||
493 | dig->SetTriggerBit(kL1GammaHigh + ithr,1); | |
a61738e1 | 494 | } |
a61738e1 | 495 | } |
496 | } | |
497 | } | |
63c22917 | 498 | |
499 | for (Int_t i = 0; i < fSTURawStream->GetNL1JetPatch(ithr); i++) | |
de39a0ff | 500 | { |
63c22917 | 501 | if (fSTURawStream->GetL1JetPatch(i, ithr, x, y)) // col (0,15), row (0,11) |
502 | { | |
503 | AliDebug(1, Form("| STU => Found L1 jet [%d] patch at (%2d , %2d)\n", ithr, x, y)); | |
504 | ||
505 | Int_t ix = int(sizeL1jsubr.X()) * (11 - y - int(sizeL1jpatch.X()) + 1); | |
506 | ||
507 | Int_t iy = int(sizeL1jsubr.Y()) * (15 - x - int(sizeL1jpatch.Y()) + 1); | |
508 | ||
509 | if (ix >= 0 && iy >= 0) | |
510 | { | |
511 | if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(ix, iy, idx)) | |
a61738e1 | 512 | { |
63c22917 | 513 | if (AliDebugLevel()) printf("| STU => Add L1 jet patch at (%2d , %2d)\n", ix, iy); |
514 | ||
515 | if (fRawDigitIndex[idx] >= 0) | |
516 | { | |
517 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
518 | } | |
519 | else | |
520 | { | |
521 | fRawDigitIndex[idx] = fRawDigits->GetEntriesFast(); | |
522 | new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0); | |
523 | ||
524 | dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]); | |
525 | } | |
526 | ||
527 | dig->SetTriggerBit(kL1JetHigh + ithr,1); | |
a61738e1 | 528 | } |
a61738e1 | 529 | } |
530 | } | |
63c22917 | 531 | } |
532 | } | |
de39a0ff | 533 | } |
534 | } | |
535 | ||
536 | //_______________ | |
537 | void AliEMCALTriggerRawDigitMaker::Reset() | |
538 | { | |
79b05051 | 539 | // Reset |
540 | ||
8cc543cb | 541 | Int_t nRawDigits = fGeometry->GetNTotalTRU() * 96; |
542 | for (Int_t i = 0; i < nRawDigits; i++) fRawDigitIndex[i] = -1; | |
de39a0ff | 543 | } |
544 | ||
545 |