140 {
141 if(datasize%window != 0) cerr<<"ERROR: The data size is not completed in time windows"<<endl;
142 uint32_t periods = datasize/window;
143 std::map<uint32_t, std::vector<uint32_t> >::iterator
iter=m_datamap.begin();
144 for(;
iter != m_datamap.end();
iter++){
145 if(
iter->first != boardId)
continue;
146 std::vector<uint32_t>::iterator iter1 =
iter->second.begin();
147 for(; iter1 !=
iter->second.end(); iter1+=5){
148 uint32_t byteId = *(iter1+0) -1;
149 uint32_t bitId = *(iter1+1);
150 int layerId = *(iter1+2) -1;
151 int wireId = *(iter1+3) -1;
152 uint32_t data_type = *(iter1+4);
153 int seriesOne = -100;
154 bool firstSOne = true;
155 bool flag_firstone(true), flag_lastone(true);
156 for(uint32_t i=0; i<window; i++){
157 if(layerId < 0 || wireId < 0) continue;
158 if((
iter->first) >= 226 && (
iter->first) <= 233){
159 if(data_type == 1){
160 if((
data[byteId + i*periods] >> bitId) & 1){
161 if(layerId >= 36 && layerId <= 39 ){
162 if(flag_firstone && (i-seriesOne!=1) && (i!=0)){ m_mdchit_pre[layerId-16][wireId] = i+1; flag_firstone = false;}
163 if( ((i-seriesOne)!=1) && (m_mdchit_aft[layerId-16][wireId]!=0) ) flag_lastone = false;
164 if( (flag_firstone==false) && ((i-seriesOne)==1) && flag_lastone) m_mdchit_aft[layerId-16][wireId]=i+1;
165 if(((i-seriesOne)==1) && firstSOne) m_mdchit_sone[layerId-16][wireId] += 1;
166 if(m_mdchit_sone[layerId-16][wireId] != 0 && (i-seriesOne) != 1) firstSOne = false;
167 seriesOne = i;
168 m_mdchit_one[layerId-16][wireId] += 1;
169 m_mdchit_win[layerId-16][wireId] += 1<<i;
170 }
171 else {
172 if(flag_firstone && (i-seriesOne!=1) && (i!=0)){ m_mdchit_pre[layerId][wireId] = i+1; flag_firstone = false;}
173 if( ((i-seriesOne)!=1) && (m_mdchit_aft[layerId][wireId]!=0) ) flag_lastone = false;
174 if( (flag_firstone==false) && ((i-seriesOne)==1) && flag_lastone) m_mdchit_aft[layerId][wireId]=i+1;
175 if(((i-seriesOne) == 1) && firstSOne) m_mdchit_sone[layerId][wireId] += 1;
176 if(m_mdchit_sone[layerId][wireId] != 0 && (i-seriesOne) != 1) firstSOne = false;
177 seriesOne = i;
178 m_mdchit_one[layerId][wireId] += 1;
179 m_mdchit_win[layerId][wireId] += 1<<i;
180 }
181 }
182 }
183 if(data_type == 0) {
184 if((
data[byteId + i*periods] >> bitId) & 1) {
185 if(layerId == 10) {
186 if(flag_firstone && (i-seriesOne!=1) && (i!=0)){ m_mdctsf_pre[2][wireId] = i+1; flag_firstone = false;}
187 if( ((i-seriesOne)!=1) && (m_mdctsf_aft[2][wireId]!=0) ) flag_lastone = false;
188 if( (flag_firstone==false) && ((i-seriesOne)==1) && flag_lastone) m_mdctsf_aft[2][wireId]=i+1;
189
190 if((i-seriesOne) == 1 && firstSOne) m_mdctsf_sone[2][wireId] += 1;
191 if(m_mdctsf_sone[2][wireId] != 0 && (i-seriesOne) != 1) firstSOne = false;
192 seriesOne = i;
193 m_mdctsf_one[2][wireId] += 1;
194 m_mdctsf_win[2][wireId] += 1<<i;
195 }
196 if(layerId == 14) {
197 if(flag_firstone && (i-seriesOne!=1) && (i!=0)){ m_mdctsf_pre[3][wireId] = i+1; flag_firstone = false;}
198 if( ((i-seriesOne)!=1) && (m_mdctsf_aft[3][wireId]!=0) ) flag_lastone = false;
199 if( (flag_firstone==false) && ((i-seriesOne)==1) && flag_lastone) m_mdctsf_aft[3][wireId]=i+1;
200
201 if((i-seriesOne) == 1 && firstSOne) m_mdctsf_sone[3][wireId] += 1;
202 if(m_mdctsf_sone[3][wireId] != 0 && (i-seriesOne) != 1) firstSOne = false;
203 seriesOne = i;
204 m_mdctsf_one[3][wireId] += 1;
205 m_mdctsf_win[3][wireId] += 1<<i;
206 }
207 if(layerId == 17) {
208 if(flag_firstone && (i-seriesOne!=1) && (i!=0)){ m_mdctsf_pre[4][wireId] = i+1; flag_firstone = false;}
209 if( ((i-seriesOne)!=1) && (m_mdctsf_aft[4][wireId]!=0) ) flag_lastone = false;
210 if( (flag_firstone==false) && ((i-seriesOne)==1) && flag_lastone) m_mdctsf_aft[4][wireId]=i+1;
211
212 if((i-seriesOne) == 1 && firstSOne) m_mdctsf_sone[4][wireId] += 1;
213 if(m_mdctsf_sone[4][wireId] != 0 && (i-seriesOne) != 1) firstSOne = false;
214 seriesOne = i;
215 m_mdctsf_one[4][wireId] += 1;
216 m_mdctsf_win[4][wireId] += 1<<i;
217 }
218 if(layerId == 37) {
219 if(flag_firstone && (i-seriesOne!=1) && (i!=0)){ m_mdctsf_pre[5][wireId] = i+1; flag_firstone = false;}
220 if( ((i-seriesOne)!=1) && (m_mdctsf_aft[5][wireId]!=0) ) flag_lastone = false;
221 if( (flag_firstone==false) && ((i-seriesOne)==1) && flag_lastone) m_mdctsf_aft[5][wireId]=i+1;
222
223 if((i-seriesOne) == 1 && firstSOne) m_mdctsf_sone[5][wireId] += 1;
224 if(m_mdctsf_sone[5][wireId] != 0 && (i-seriesOne) != 1) firstSOne = false;
225 seriesOne = i;
226 m_mdctsf_one[5][wireId] += 1;
227 m_mdctsf_win[5][wireId] += 1<<i;
228 }
229 }
230 }
231 if(data_type == 2) {
232 if((
data[byteId + i*periods] >> bitId) & 1) {
233 if(flag_firstone && (i-seriesOne!=1) && (i!=0)){ m_mdcltrk_pre[wireId] = i+1; flag_firstone = false;}
234 if( ((i-seriesOne)!=1) && (m_mdcltrk_aft[wireId]!=0) ) flag_lastone = false;
235 if( (flag_firstone==false) && ((i-seriesOne)==1) && flag_lastone) m_mdcltrk_aft[wireId]=i+1;
236
237 if((i-seriesOne) == 1 && firstSOne) m_mdcltrk_sone[wireId] += 1;
238 if(m_mdcltrk_sone[wireId] != 0 && (i-seriesOne) != 1) firstSOne = false;
239 seriesOne = i;
240 m_mdcltrk_one[wireId] += 1;
241 m_mdcltrk_win[wireId] += 1<<i;
242 }
243 }
244 if(data_type == 3) {
245 if((
data[byteId + i*periods] >> bitId) & 1) {
246 if(flag_firstone && (i-seriesOne!=1) && (i!=0)){ m_mdcstrk_pre[wireId] = i+1; flag_firstone = false;}
247 if( ((i-seriesOne)!=1) && (m_mdcstrk_aft[wireId]!=0) ) flag_lastone = false;
248 if( (flag_firstone==false) && ((i-seriesOne)==1) && flag_lastone) m_mdcstrk_aft[wireId]=i+1;
249
250 if((i-seriesOne) == 1 && firstSOne) m_mdcstrk_sone[wireId] += 1;
251 if(m_mdcstrk_sone[wireId] != 0 && (i-seriesOne) != 1) firstSOne = false;
252 seriesOne = i;
253 m_mdcstrk_one[wireId] += 1;
254 m_mdcstrk_win[wireId] += 1<<i;
255 }
256 }
257 }
258
259 if((
iter->first) == 234) {
260 if(data_type == 0) {
261 if((
data[byteId + i*periods] >> bitId) & 1) {
262 if(layerId == 2) {
263 if((i - seriesOne) == 1 && firstSOne) m_mdctsf_sone[0][wireId] += 1;
264 if(m_mdctsf_sone[0][wireId] != 0 && (i - seriesOne) != 1) firstSOne = false;
265 seriesOne = i;
266 m_mdctsf_one[0][wireId] += 1;
267 }
268 if(layerId == 6) {
269 if((i - seriesOne) == 1 && firstSOne) m_mdctsf_sone[1][wireId] += 1;
270 if(m_mdctsf_sone[1][wireId] != 0 && (i - seriesOne) != 1) firstSOne = false;
271 seriesOne = i;
272 m_mdctsf_one[1][wireId] += 1;
273 }
274 }
275 }
276 if(data_type == 1) {
277 if((
data[byteId + i*periods] >> bitId) & 1) {
278 if((i - seriesOne) == 1 && firstSOne) m_mdchit_sone[layerId][wireId] += 1;
279 if(m_mdchit_sone[layerId][wireId] != 0 && (i - seriesOne) != 1) firstSOne = false;
280 seriesOne = i;
281 m_mdchit_one[layerId][wireId] += 1;
282 }
283 }
284 if(data_type == 4) {
285 if((
data[byteId + i*periods] >> bitId) & 1) {
286 m_mdcTrigCondi[wireId] = 1;
287 }
288 }
289 }
290
291 if((
iter->first) == 235 || (
iter->first) == 236) {
292 if(data_type == 2) {
293 if((
data[byteId + i*periods] >> bitId) & 1) {
294 if((i - seriesOne) == 1 && firstSOne) m_mdcltrkc_sone[wireId] += 1;
295 if(m_mdcltrkc_sone[wireId] != 0 && (i - seriesOne) != 1) firstSOne = false;
296 seriesOne = i;
297 m_mdcltrkc_one[wireId] += 1;
298 if(wireId >= 128) m_mdcTrigCondi[wireId - 126] = 1;
299 }
300 }
301 if(data_type == 3) {
302 if((
data[byteId + i*periods] >> bitId) & 1) {
303 if((i - seriesOne) == 1 && firstSOne) m_mdcstrkc_sone[wireId] += 1;
304 if(m_mdcstrkc_sone[wireId] != 0 && (i - seriesOne) != 1) firstSOne = false;
305 seriesOne = i;
306 m_mdcstrkc_one[wireId] += 1;
307 if(wireId >= 128) m_mdcTrigCondi[wireId - 122] = 1;
308 }
309 }
310 }
311
312 }
313
314 }
315 }
316}