+ //
+ // Returns the number of filled cells of the TOF digit map
+ //
+
+ Int_t counter = 0;
+
+ for (Int_t index = 0; index < fMaxIndex; ++index)
+ {
+ for (Int_t label = 0; label < kMaxDigitsPerPad; ++label)
+ {
+ if (fDigitMap[index][label] > 0)
+ {
+ ++counter;
+ break;
+ }
+ }
+ }
+
+ return counter;
+}
+
+////////////////////////////////////////////////////////////////////////
+Bool_t AliTOFDigitMap::StripDigitCheck(Int_t iSector, Int_t iPlate, Int_t iStrip) const
+{
+ //
+ // Returns:
+ // kFALSE if the strip doesn't contain digits
+ // kTRUE if the strip contains at least one digit
+ //
+
+ Int_t volume[5] = {iSector, iPlate, iStrip, -1, -1};
+ Bool_t counter = kFALSE;
+
+ for (Int_t iPadX=0; iPadX<fNpx; iPadX++)
+ for (Int_t iPadZ=0; iPadZ<fNpz; iPadZ++)
+ {
+ volume[3] = iPadX;
+ volume[4] = iPadZ;
+ for (Int_t label=0; label<kMaxDigitsPerPad; label++) {
+ if (GetDigitIndex(volume, label)>=0) {
+ counter = kTRUE;
+ break;
+ }
+ }
+ }
+
+ return counter;
+
+}
+
+////////////////////////////////////////////////////////////////////////
+Int_t AliTOFDigitMap::DigitInStrip(Int_t iSector, Int_t iPlate, Int_t iStrip) const
+{
+ //
+ // Returns number of digits in the strip iStrip,
+ // in the plate iPlate of the sector iSector
+ //
+
+ Int_t volume[5] = {iSector, iPlate, iStrip, -1, -1};
+ Int_t counter = 0;
+
+ for (Int_t iPadX=0; iPadX<fNpx; iPadX++)
+ for (Int_t iPadZ=0; iPadZ<fNpz; iPadZ++)
+ for (Int_t label=0; label<kMaxDigitsPerPad; label++) {
+ volume[3] = iPadX;
+ volume[4] = iPadZ;
+ if (GetDigitIndex(volume, label)>=0)
+ counter++;
+ }
+
+ return counter;
+
+}
+
+////////////////////////////////////////////////////////////////////////
+void AliTOFDigitMap::ResetDigitNumber(Int_t *vol, Int_t dig)
+{
+ //
+ // Reset digit into pad vol
+ //
+
+ for (Int_t slot=0; slot<kMaxDigitsPerPad; slot++) {
+ if (fDigitMap[CheckedIndex(vol)][slot]-1==dig) {
+ fDigitMap[CheckedIndex(vol)][slot] = 0;
+ }
+ }
+
+}
+
+////////////////////////////////////////////////////////////////////////
+void AliTOFDigitMap::ResetDigit(Int_t *vol, Int_t dig)
+{
+ //
+ // Reset digit into pad vol
+ //
+ // 0 means empty pad, we need to shift indeces by 1
+
+ fDigitMap[CheckedIndex(vol)][dig] = 0;
+
+}
+
+////////////////////////////////////////////////////////////////////////
+void AliTOFDigitMap::ResetDigit(Int_t *vol)
+{
+ //
+ // Reset digit into pad vol
+ //
+ // 0 means empty pad, we need to shift indices by 1
+
+ for (Int_t slot=0; slot<kMaxDigitsPerPad; slot++)
+ fDigitMap[CheckedIndex(vol)][slot] = 0;
+
+}
+
+////////////////////////////////////////////////////////////////////////
+Int_t AliTOFDigitMap::GetNumberOfDigits(Int_t *vol)
+{
+ //
+ // Returns the number of digit
+ // into pad volume vol
+ //
+ // 0 means empty pad
+ //
+
+ Int_t counter = 0;
+
+ for (Int_t slot=0; slot<kMaxDigitsPerPad; slot++)
+ if (GetDigitIndex(vol, slot)>=0) counter++;
+
+ return counter;
+