Process an MBS sub-event.
78{
79 LOG(DEBUG) << "RPCUnpack : Unpacking frame... size/bytes = " << size;
80
82 switch (
df->header.frameTime) {
83 case SoS: LOG(INFO) <<
"RPCUnpack: SoS frame.";
return kTRUE;
84 case EoS: LOG(INFO) <<
"RPCUnpack: EoS frame.";
return kTRUE;
85 default: break;
86 }
87 assert(
df->header.size == size);
89 static_assert(
sizeof(
RawHit) == 12,
"Padding is off");
90 int skipped = 0;
91 auto hits =
reinterpret_cast<unsigned char *
>(
df->hits);
92 const int BYTES_PER_HITPATTERN = 8;
93 const int BYTES_PER_RECORD = 12;
94 for (
int i = 0;
i <
nhits;
i++) {
95 auto hit = hits +
i * BYTES_PER_RECORD;
96 auto crate = (
unsigned int)hit[0];
98 for (
int k = 1;
k <= BYTES_PER_HITPATTERN;
k++) {
100
101 auto bitMask = 0x1;
102 for (
int j = 0;
j < 8;
j++) {
103 if (hit[index] & bitMask) {
104 auto channel = (BYTES_PER_HITPATTERN -
k) * 8 + j;
105 if ((crate == 16 && (board == 5 || board == 10) &&
channel >= 48 &&
channel <= 53) ||
106 (crate == 16 && (board == 3 || board == 8) &&
channel >= 60 &&
channel <= 63) ||
107 (crate == 16 && (board == 4 || board == 9) &&
channel >= 10 &&
channel <= 15) ||
108 (crate == 16 && (board == 1 || board == 6) &&
channel >= 0 &&
channel <= 3) ||
109 (crate == 18 && (board == 5 || board == 10 || board == 15) &&
channel >= 48 &&
channel <= 53) ||
110 (crate == 18 && (board == 3 || board == 8 || board == 13) &&
channel >= 60 &&
channel <= 63) ||
111 (crate == 18 && (board == 4 || board == 9 || board == 14) &&
channel >= 10 &&
channel <= 15) ||
112 (crate == 18 && (board == 1 || board == 6 || board == 11) &&
channel >= 0 &&
channel <= 3)) {
113 skipped++;
114 continue;
115 }
117 MuonTaggerHit(
GetId(crate, board, channel), Float_t(
df->header.frameTime) * 25);
119 }
120 bitMask <<= 1;
121 }
122 }
123 }
124
125 if (skipped) {
126 LOG(WARNING) << "Skipped " << skipped << " hits on unconnected channels (probably noise).";
127 }
129 return kTRUE;
130}
int GetId(int ncrate, int nboard, int channel)
integer(mpi) nhits
number of hits