+ // loop over x1-4 and y1-4
+ for (Int_t iChamber = 0; iChamber < 4; ++iChamber)
+ {
+ for (Int_t iCath = 0; iCath < 2; ++iCath)
+ {
+ Int_t pattern = (Int_t)xyPattern[iCath].At(iChamber);
+ if (!pattern) continue;
+
+ // get detElemId
+ detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(nBoard, iChamber);
+
+ const AliMpVSegmentation* seg
+ = AliMpSegmentation::Instance()
+ ->GetMpSegmentation(detElemId, AliMp::GetCathodType(iCath));
+
+ // loop over the 16 bits of pattern
+ for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy)
+ {
+ if ((pattern >> ibitxy) & 0x1)
+ {
+ // not quite sure about this
+ Int_t offset = 0;
+ if (iCath && localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB)) offset = -8;
+
+ AliMpPad pad = seg->PadByLocation(nBoard,ibitxy+offset,warn);
+
+ if (!pad.IsValid())
+ {
+ fLogger->Log(Form("No pad for detElemId: %d, nboard %d, ibitxy: %d\n",
+ detElemId, nBoard, ibitxy));
+ continue;
+ }
+
+ n = pad.GetLocalBoardId(0); // always take first location so that digits are not inserted several times
+ b = pad.GetLocalBoardChannel(0);
+
+ AliDebug(1,Form("Using localBoard %d ixy %d instead of %d,%d",
+ n,b,nBoard,ibitxy));
+
+ AliMUONVDigit* digit = digitStore.Add(detElemId,n,b,iCath,AliMUONVDigitStore::kDeny);
+
+ if (!digit)
+ {
+ AliDebug(1, Form("Digit DE %04d LocalBoard %03d ibitxy %02d cath %d already in store",
+ detElemId,nBoard,ibitxy,iCath));
+ continue;
+ }
+
+ Int_t padX = pad.GetIx();
+ Int_t padY = pad.GetIy();
+
+ // fill digit
+ digit->SetPadXY(padX,padY);
+ digit->SetCharge(1.);
+ }// xyPattern
+ }// ibitxy
+ }// cath
+ } // ichamber
+