+ AliEMCALTriggerTRU* iTRU = static_cast<AliEMCALTriggerTRU*>(fTRU->At(i));
+
+ TIter next(&iTRU->Patches());
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)next())
+ {
+ p->Position(px, py);
+
+ // Local 2 Global
+ if (geom->GetAbsFastORIndexFromPositionInTRU(i, px, py, id) &&
+ geom->GetPositionInEMCALFromAbsFastORIndex(id, px, py)) p->SetPosition(px, py);
+
+ Int_t peaks = p->Peaks();
+
+ Int_t sizeX = (Int_t) ((iTRU->PatchSize())->X() * (iTRU->SubRegionSize())->X());
+ Int_t sizeY = (Int_t) ((iTRU->PatchSize())->Y() * (iTRU->SubRegionSize())->Y());
+
+ for (Int_t j = 0; j < sizeX * sizeY; j++)
+ {
+ if (peaks & (1 << j))
+ {
+ pos = posMap[px + j % sizeX][py + j / sizeX];
+
+ if (pos == -1)
+ {
+ // Add a new digit
+ new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
+
+ dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
+ }
+ else
+ {
+ dig = (AliEMCALTriggerRawDigit*)digits->At(pos);
+ }
+
+ dig->SetL0Time(timeL0min);
+ }
+ }
+
+ pos = posMap[px][py];
+
+ if (pos == -1)
+ {
+ // Add a new digit
+ new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
+
+ dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
+ }
+ else
+ {
+ dig = (AliEMCALTriggerRawDigit*)digits->At(pos);
+ }
+
+ dig->SetTriggerBit(kL0, 0);
+ }
+ }
+ }
+
+ //
+ // Prepare STU for L1 calculation
+
+ for (int i = 0; i < (fSTU->RegionSize())->X(); i++)
+ {
+ for (int j = 0; j < (fSTU->RegionSize())->Y(); j++)
+ {
+ pos = posMap[i][j];
+
+ if (pos >= 0)
+ {
+ AliEMCALTriggerRawDigit *digit = (AliEMCALTriggerRawDigit*)digits->At(pos);