- AliDebug(1,Form("===========< TRU %2d >============\n",i));
-
- AliEMCALTriggerTRU *iTRU = static_cast<AliEMCALTriggerTRU*>(fTRU->At(i));
+ for (Int_t i = 0; i < kNTRU; i++)
+ {
+ AliEMCALTriggerTRU *iTRU = static_cast<AliEMCALTriggerTRU*>(fTRU->At(i));
+ if (!iTRU) continue;
+
+ AliDebug(999, Form("=== TRU# %2d found %d patches", i, (iTRU->Patches()).GetEntriesFast()));
+
+ TIter next(&iTRU->Patches());
+ while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)next())
+ {
+ p->Position(px, py);
+
+ // Local 2 Global
+ if (fGeometry->GetAbsFastORIndexFromPositionInTRU(i, px, py, id)
+ &&
+ fGeometry->GetPositionInEMCALFromAbsFastORIndex(id, px, py)) p->SetPosition(px, py);
+
+ if (AliDebugLevel()) p->Print("");
+
+ 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
+ posMap[px + j % sizeX][py + j / sizeX] = digits->GetEntriesFast();