]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALTriggerRawDigitMaker.cxx
bad channels up to LHC12d added, Marcel
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTriggerRawDigitMaker.cxx
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"
35 #include "AliEMCALTriggerDCSConfig.h"
36 #include "AliEMCALTriggerTRUDCSConfig.h"
37 #include "AliEMCALTriggerSTUDCSConfig.h"
38 #include "AliEMCALTriggerData.h"
39 #include "AliEMCALTriggerPatch.h"
40 #include "AliLog.h"
41
42 #include "AliRawDataHeader.h"
43 #include "AliRawVEvent.h"
44 #include "AliRawEventHeaderBase.h"
45 #include "AliRawEvent.h"
46 #include "AliRawVEquipment.h"
47 #include "AliRawEquipmentHeader.h"
48
49 #include "Riostream.h"
50
51 #include "AliCaloRawAnalyzerFactory.h"
52
53 namespace
54 {
55         const Int_t kSTUEqId = 4652;
56 }
57
58 ClassImp(AliEMCALTriggerRawDigitMaker)
59
60 //_______________
61 AliEMCALTriggerRawDigitMaker::AliEMCALTriggerRawDigitMaker() : TObject(),
62 fGeometry(0x0),
63 fRawReader(0x0),
64 fCaloRawStream(0x0),
65 fSTURawStream(0x0),
66 fRawDigits(0x0),
67 fRawAnalyzer(0x0),
68 fDCSConfig(0x0),
69 fTriggerData(0x0)
70 {
71   // def ctor
72   
73   AliRunLoader* rl = AliRunLoader::Instance();
74   if (rl && rl->GetAliRun()){
75     AliEMCAL * emcal = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"));
76     if(emcal) fGeometry = emcal->GetGeometry();
77   }
78   
79   if(!fGeometry)
80     {
81       AliDebug(1, Form("Using default geometry"));
82       fGeometry =  AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName());
83     }
84   
85   //  fRawAnalyzer = new AliCaloRawAnalyzerFakeALTRO ();
86   
87   fRawAnalyzer =  (AliCaloRawAnalyzerFakeALTRO*)AliCaloRawAnalyzerFactory::CreateAnalyzer(kFakeAltro);
88
89   fDCSConfig = AliEMCALTriggerDCSConfigDB::Instance();
90   
91   for (Int_t i=0; i<3072; i++) fRawDigitIndex[i] = -1;
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 {
103         // Connect I/O
104         
105         fRawReader     = reader;
106         fCaloRawStream = &in;
107         fRawDigits     = digits;
108         fSTURawStream  = &inSTU;
109         fTriggerData   = data;
110 }
111
112 //_______________
113 void AliEMCALTriggerRawDigitMaker::Add(const std::vector<AliCaloBunchInfo> &bunchlist)
114 {
115         // Add bunch list
116         
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                                                 {
204                                                         AliDebug(100,"L0: Trying to update trigger info of a non-existent digit!");
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                                                 
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 {       
285         // Post process digits
286         
287         AliDebug(2,"Start post processing the raw digit maker");
288         Int_t idx;
289         
290         AliEMCALTriggerRawDigit* dig = 0x0;
291         
292         TVector2 sizeL1gsubr, sizeL1gpatch, sizeL1jsubr, sizeL1jpatch;
293         
294         fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->GetSegmentation(sizeL1gsubr, sizeL1gpatch, sizeL1jsubr, sizeL1jpatch);
295         
296         fRawReader->Reset();
297         fRawReader->Select("EMCAL",44); 
298
299         Bool_t isSTUin = kFALSE;
300         
301         Int_t nSubEv = fRawReader->GetEvent()->GetNSubEvents();
302         
303         for ( Int_t iSubEv=0; iSubEv<nSubEv; iSubEv++)
304         {
305                 AliRawVEvent *subEv = ((AliRawEvent*)fRawReader->GetEvent())->GetSubEvent(iSubEv);
306                 if ( !subEv ) continue;
307                 
308                 for (Int_t iEquip = 0; iEquip < subEv->GetNEquipments(); iEquip++)
309                 {
310                         Int_t eqId = subEv->GetEquipment(iEquip)->GetEquipmentHeader()->GetId();
311                         
312                         if (eqId == kSTUEqId) isSTUin = kTRUE;
313                 }
314         }
315         
316         fRawReader->Reset();
317         
318         if (isSTUin && fSTURawStream && fSTURawStream->ReadPayLoad())
319         {
320                 fTriggerData->SetL1DataDecoded(1);
321                 
322                 for (int i = 0; i < 2; i++) {
323                         fTriggerData->SetL1GammaThreshold(i, fSTURawStream->GetL1GammaThreshold(i));
324                         fTriggerData->SetL1JetThreshold(  i, fSTURawStream->GetL1JetThreshold(i)  );
325                 }
326                 
327                 Int_t v0[2] = {fSTURawStream->GetV0A(), fSTURawStream->GetV0C()};
328                 
329                 Int_t type[15] = 
330                 {
331                         fSTURawStream->GetG(0, 0),
332                         fSTURawStream->GetG(1, 0),
333                         fSTURawStream->GetG(2, 0),
334                         fSTURawStream->GetJ(0, 0),
335                         fSTURawStream->GetJ(1, 0),
336                         fSTURawStream->GetJ(2, 0),
337                         fSTURawStream->GetG(0, 1),
338                         fSTURawStream->GetG(1, 1),
339                         fSTURawStream->GetG(2, 1),
340                         fSTURawStream->GetJ(0, 1),
341                         fSTURawStream->GetJ(1, 1),
342                         fSTURawStream->GetJ(2, 1),
343                         fSTURawStream->GetRawData(), 
344                         fSTURawStream->GetRegionEnable(), 
345                         fSTURawStream->GetFwVersion()
346                 };              
347
348                 // Modify DCS config from STU payload content
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]);
364                 
365                 fTriggerData->SetL1FrameMask(fSTURawStream->GetFrameReceived());
366                 fTriggerData->SetL1V0(v0);
367                 fTriggerData->SetL1TriggerType(type);
368                 
369                 fTriggerData->SetL1RawData(fSTURawStream->GetRawData());
370                 
371                 Int_t iTRU, x, y;
372
373                 if (fSTURawStream->GetRawData())
374                 {
375                         if (AliDebugLevel()) printf("| STU => TRU raw data are there!\n");
376                         
377                         for (Int_t i = 0; i < 32; i++)
378                         {
379                                 iTRU = fGeometry->GetTRUIndexFromSTUIndex(i);
380                                 
381                                 UInt_t adc[96]; for (Int_t j = 0; j < 96; j++) adc[j] = 0;
382                                 
383                                 fSTURawStream->GetADC(i, adc);
384
385                                 for (Int_t j = 0; j < 96; j++)
386                                 {
387                                         if (adc[j] <= 0) continue;
388                                         
389                                         AliDebug(10,Form("| STU => TRU# %2d raw data: ADC# %2d: %d\n", iTRU, j, adc[j]));
390                                         
391                                         fGeometry->GetAbsFastORIndexFromTRU(iTRU, j, idx);
392                                         
393                                         if (fRawDigitIndex[idx] >= 0)
394                                         {
395                                                 dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
396                                                 
397                                                 if (!dig->GetNSamples()) AliDebug(10,Form("TRG digit of id: %4d found in STU but has no time sample in F-ALTRO!",idx));
398                                         }
399                                         else
400                                         {
401                                                 AliDebug(10,Form("TRG digit of id: %4d found in STU but not in F-ALTRO! Create a new digit!",idx));
402                                                 
403                                                 fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
404                                                 new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
405                                                 
406                                                 dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
407                                         }
408                                         
409                                         dig->SetL1TimeSum(adc[j]);
410                                 }
411                         }
412                 }
413                 
414                 // List of patches in EMCal coordinate system
415                 
416                 for (Int_t i = 0; i < fSTURawStream->GetNL0GammaPatch(); i++)
417                 {
418                         fSTURawStream->GetL0GammaPatch(i, iTRU, x);
419
420                         iTRU = fGeometry->GetTRUIndexFromSTUIndex(iTRU);
421                         
422                         const Int_t sizePatchL0 = 
423                         ((AliEMCALTriggerTRUDCSConfig*)fDCSConfig->GetTriggerDCSConfig()->GetTRUArr()->At(fGeometry->GetOnlineIndexFromTRUIndex(iTRU)))->GetSegmentation() 
424                         * 
425                         ((AliEMCALTriggerTRUDCSConfig*)fDCSConfig->GetTriggerDCSConfig()->GetTRUArr()->At(fGeometry->GetOnlineIndexFromTRUIndex(iTRU)))->GetSegmentation();
426                         
427                         if (AliDebugLevel()) printf("| STU => Found L0 patch id: %2d in TRU# %2d\n", x, iTRU);
428                                                 
429                         Int_t idFastOR[4];
430                         for (Int_t j = 0; j < 4; j++) idFastOR[j] = -1;
431                         
432                         if (fGeometry->GetFastORIndexFromL0Index(iTRU, x, idFastOR, sizePatchL0))
433                         {
434                                 idx = idFastOR[1];
435                                 
436                                 Int_t px, py;
437                                 if (fGeometry->GetPositionInEMCALFromAbsFastORIndex(idx, px, py))
438                                 {
439                                         if (AliDebugLevel()) printf("| STU => Add L0 patch at (%2d , %2d)\n", px, py);
440                                                                                 
441                                         if (fRawDigitIndex[idx] >= 0)
442                                         {
443                                                 dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
444                                         }
445                                         else
446                                         {
447                                                 fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
448                                                 new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
449                         
450                                                 dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
451                                         }
452                 
453                                         dig->SetTriggerBit(kL0,1);
454                                 }
455                         }
456                 }
457                 
458                 for (int ithr = 0; ithr < 2; ithr++) {
459                         
460                         for (Int_t i = 0; i < fSTURawStream->GetNL1GammaPatch(ithr); i++)
461                         {
462                                 if (fSTURawStream->GetL1GammaPatch(i, ithr, iTRU, x, y)) // col (0..23), row (0..3)
463                                 {
464                                         iTRU = fGeometry->GetTRUIndexFromSTUIndex(iTRU);
465                                         
466                                         if (AliDebugLevel()) printf("| STU => Found L1 gamma patch at (%2d , %2d) in TRU# %2d\n", x, y, iTRU);
467                                         
468                                         Int_t vx = 23 - x, vy = y + 4 * int(iTRU / 2); // Position in EMCal frame
469                                         
470                                         if (iTRU % 2) vx += 24; // C side
471                                         
472                                         vx = vx - int(sizeL1gsubr.X()) * int(sizeL1gpatch.X()) + 1;
473                                         
474                                         if (vx >= 0 && vy < 63) 
475                                         {
476                                                 if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(vx, vy, idx))
477                                                 {
478                                                         if (AliDebugLevel()) printf("| STU => Add L1 gamma [%d] patch at (%2d , %2d)\n", ithr, vx, vy);
479                                                         
480                                                         if (fRawDigitIndex[idx] >= 0)
481                                                         {
482                                                                 dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
483                                                         }
484                                                         else
485                                                         {
486                                                                 fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
487                                                                 new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
488                                                                 
489                                                                 dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
490                                                         }
491                                                         
492                                                         dig->SetTriggerBit(kL1GammaHigh + ithr,1);
493                                                 }
494                                         }
495                                 }
496                         }
497                         
498                         for (Int_t i = 0; i < fSTURawStream->GetNL1JetPatch(ithr); i++)
499                         {
500                                 if (fSTURawStream->GetL1JetPatch(i, ithr, x, y)) // col (0,15), row (0,11)
501                                 {
502                                         AliDebug(1, Form("| STU => Found L1 jet [%d] patch at (%2d , %2d)\n", ithr, x, y));
503                                         
504                                         Int_t ix = int(sizeL1jsubr.X()) * (11 - y - int(sizeL1jpatch.X()) + 1);
505                                         
506                                         Int_t iy = int(sizeL1jsubr.Y()) * (15 - x - int(sizeL1jpatch.Y()) + 1);
507                                         
508                                         if (ix >= 0 && iy >= 0)
509                                         {       
510                                                 if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(ix, iy, idx))
511                                                 {
512                                                         if (AliDebugLevel()) printf("| STU => Add L1 jet patch at (%2d , %2d)\n", ix, iy);
513                                                         
514                                                         if (fRawDigitIndex[idx] >= 0)
515                                                         {
516                                                                 dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
517                                                         }
518                                                         else
519                                                         {
520                                                                 fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
521                                                                 new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
522                                                                 
523                                                                 dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
524                                                         }
525                                                         
526                                                         dig->SetTriggerBit(kL1JetHigh + ithr,1);
527                                                 }
528                                         }
529                                 }
530                         }               
531                 }
532         }
533 }
534
535 //_______________
536 void AliEMCALTriggerRawDigitMaker::Reset()
537 {
538         // Reset
539         
540         for (Int_t i = 0; i < 3072; i++) fRawDigitIndex[i] = -1;
541 }
542
543