Emulation of input to DSM-0 , miniDaq run2003 taken on March 22.
I started with the masks:

CRATE3  BD1     BD2     BD3     BD4     BD5
JP1     0x0000  0x0000  0xf8f8  0x0000  0x0000
JP2     0x0000  0x0000  0x0707  0xff00  0x0000
JP3     0x0000  0xf8f8  0x0000  0x00ff  0x0000
JP4     0x0000  0x0707  0x0000  0x0000  0x0000
CRATE4  BD1     BD2     BD3     BD4     BD5
JP1     0xf8f8  0xf8f8  0xf8f8  0x00ff  0x0000
JP2     0x0707  0x0707  0x0707  0xff00  0x0000
JP3     0xf8f8  0xf8f8  0x00ff  0x00ff  0x0000
JP4     0x0707  0x0707  0xff00  0x0000  0x0000
CRATE5  BD1     BD2     BD3     BD4     BD5
JP1     0xf8f8  0xf8f8  0x0000  0x00ff  0x0000
JP2     0x0707  0x0707  0x0000  0xff00  0x0000
JP3     0xf8f8  0xf8f8  0x00ff  0x0000  0x0000
JP4     0x0707  0x0707  0xff00  0x0000  0x0000

For a given crate, we have a 4x4 array, mapping 128 ADC channels
to 16 trigger patches in the unique way.

Three lookup tables converting 
 chan--> trigger patch ID
 were created base on this masks.
The dump of this lookup tables is in the note:#257.
The patches name are just {Crate# xJP# X BD# }. There is 48 patches.

Now I emulate FEE operation:
A set of 48 histograms is created for every trigger patch.

For every event :
1) an array  sum[48] integers is cleared.
2) there is a loop over all adc channels in all crates:
   - for every channel the patch ID is found
   - ADC value is shifted by 4 bits (i.e. divided by 16)
   - an element of array corresponding to the patch ID gets incremented by 'X'

3) the accumulated content of sum[] is added to 48 histograms
I did not applied 12-->6 bit reduction done by LUT.
So my results differ from  input to DSM-0 and
 histograms have also entries above 64.

4) the plots below show 8 histograms per panel, stepping each time 
  2 lines of the table with mask.   

My idea was to find the pedestals for each trigger patch,
so we can add proper offset to 48 LUTs.
It could be also done by adding pedestals from individual ADC channels,
but this method may is simpler, also takes care of any correlated
change of pedestals (if exist and of any significance).

In reality some of the spectra are empty other have different shape then
just pedestal, so perhaps after this fix of cables made by Jim 
we should have another look at it.


  Loop over crates, channels:
       int val=adc>>4;
       FeeMask *fom=&feeMask[crateID-3];
       int k=fom->patch[chan] +16*(crateID-3);
       sum[k]+=val;  // <<--- accumulate sum
  } end of loop

    hDsm0[k]->Fill(sum[k]);  <<---  fill histo

Crate 3 JP1 & 2

Crate 3 JP3 & 4

Crate 4 JP1 & 2

Crate 4 JP3 & 4

Crate 5 JP1 & 2

Crate 5 JP3 & 4