+ Int_t detElemId;
+ Int_t nBoard;
+ Int_t iCath = -1;
+ Int_t iChamber = 0;
+ Int_t xyPattern = 0;
+
+ // loop over x1-4 and y1-4
+ for (Int_t icase = 0; icase < 8; icase++) {
+
+ // get chamber, cathode and associated trigger response pattern
+ GetTriggerChamber(localStruct, xyPattern, iChamber, iCath, icase);
+
+ if (!xyPattern) continue;
+
+ // get detElemId
+ AliMUONTriggerCircuitNew triggerCircuit;
+ detElemId = triggerCircuit.DetElemId(iChamber, localBoard->GetName());
+ nBoard = localBoard->GetNumber();
+
+ const AliMpVSegmentation* seg
+ = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, iCath);
+
+ // loop over the 16 bits of pattern
+ for (Int_t ibitxy = 0; ibitxy < 16; ibitxy++) {
+
+ if ((xyPattern >> ibitxy) & 0x1) {
+
+ // not quite sure about this
+ Int_t offset = 0;
+ if (iCath && localBoard->GetSwitch(6)) offset = -8;
+
+ AliMpPad pad = seg->PadByLocation(AliMpIntPair(nBoard,ibitxy+offset),kTRUE);
+
+ AliMUONDigit* digit = new AliMUONDigit();
+ if (!pad.IsValid()) {
+ AliWarning(Form("No pad for detElemId: %d, nboard %d, ibitxy: %d\n",
+ detElemId, nBoard, ibitxy));
+ continue;
+ } //
+
+ Int_t padX = pad.GetIndices().GetFirst();
+ Int_t padY = pad.GetIndices().GetSecond();
+
+ // file digit
+ digit->SetPadX(padX);
+ digit->SetPadY(padY);
+ digit->SetCathode(iCath);
+ digit->SetDetElemId(detElemId);
+ digit->SetElectronics(nBoard, ibitxy);
+ digitList.Add(digit);
+
+ }// xyPattern
+ }// ibitxy
+ }// case
+
+ return kTRUE;
+}