Subversion Repositories f9daq

Rev

Rev 109 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 109 Rev 110
Line 302... Line 302...
302
    //int tout=100; /* 1/100 of a second */
302
    //int tout=100; /* 1/100 of a second */
303
    //tmlnk (tout);
303
    //tmlnk (tout);
304
    int nb=d->event(data,BSIZE);
304
    int nb=d->event(data,BSIZE);
305
    //tmulk();
305
    //tmulk();
306
    // zapis v datoteko   
306
    // zapis v datoteko   
-
 
307
    if (nb<0){
-
 
308
      ieve--;
-
 
309
      continue;
-
 
310
    }
307
    hdr[1]=nb+4*sizeof(int);
311
    hdr[1]=nb+4*sizeof(int);
308
    hdr[2]=time(NULL);
312
    hdr[2]=time(NULL);
309
    hdr[3]=ieve;
313
    hdr[3]=ieve;
310
   
314
   
311
    fwrite(hdr,   sizeof(int),4 , fp);
315
    fwrite(hdr,   sizeof(int),4 , fp);
Line 315... Line 319...
315
    int events=0;  
319
    int events=0;  
316
    int ib=1,count=0;
320
    int ib=1,count=0;
317
    events = data[0];
321
    events = data[0];
318
    evsize = data[ib++]&0xffff;
322
    evsize = data[ib++]&0xffff;
319
    if (ieve %100 == 0) printf("nb=%d Event:%d events=%d EvSize:%d\n",nb, ieve,  events, evsize);
323
    if (ieve %100 == 0) printf("nb=%d Event:%d events=%d EvSize:%d\n",nb, ieve,  events, evsize);
-
 
324
    if (evsize<2) {
-
 
325
      ieve--;
-
 
326
      continue;
-
 
327
    }
320
    for (int i=0;i<evsize;i++)  {
328
    for (int i=0;i<evsize;i++)  {
321
       //if (debug) printf("%d\t%08x\n", ib, data[ib]);
329
       //if (debug) printf("%d\t%08x\n", ib, data[ib]);
322
       if (data[ib]== END_MARKER) break;
330
       if (data[ib]== END_MARKER) break;
323
       if (i%2==0) {
331
       if (ib%2==0) {
324
          unsigned short word1 =data[ib  ]&0xFFFF;
332
          unsigned short word1 =data[ib  ]&0xFFFF;
325
          unsigned short word2 =data[ib+1]&0xFFFF;
333
          unsigned short word2 =data[ib+1]&0xFFFF;
326
          unsigned short tdc =  word1;                 
334
          unsigned short tdc =  word1;                 
327
          unsigned short ch  =  (word2 >> 1 ) &0x1F;
335
          unsigned short ch  =  (word2 >> 1 ) &0x1F;
328
          unsigned short edge =  word2   & 0x1;
336
          unsigned short edge =  word2   & 0x1;