Subversion Repositories f9daq

Rev

Rev 198 | Rev 201 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 198 Rev 200
Line 4... Line 4...
4
#include <userint.h>
4
#include <userint.h>
5
#include "drs4.h"
5
#include "drs4.h"
6
#include "drsread.h" 
6
#include "drsread.h" 
7
 
7
 
8
static int daq_on;
8
static int daq_on;
9
static int ph, plothandle;
9
static int ph, plothandle[4];
10
static int tfID;
10
static int tfID;
11
static int controlID;
11
static int controlID;
12
 
12
 
13
#define MAX_THREADS 10   
13
#define MAX_THREADS 10   
14
 
14
 
Line 129... Line 129...
129
    SetCtrlVal(ph,PANEL_CEVE,i);       
129
    SetCtrlVal(ph,PANEL_CEVE,i);       
130
        if (retval) i--;
130
        if (retval) i--;
131
    if (!daq_on) break;
131
    if (!daq_on) break;
132
    time(&t);
132
    time(&t);
133
    if (t!=told ) {
133
    if (t!=told ) {
134
                printf("%d events in %2.2f min (%d s) %s",i+1, (double)(t-tstart)/60.,(t-tstart), ctime(&t));
134
                  printf("%d events in %2.2f min (%d s) %s",i+1, (double)(t-tstart)/60.,(t-tstart), ctime(&t));
135
               
-
 
136
        }      
135
          }    
137
    told=t;
136
    told=t;
138
// Save data    
137
// Save data    
139
        if (nb>0 && fp) fwrite(buffer, 1,nb ,fp);
138
        if (nb>0 && fp) fwrite(buffer, 1,nb ,fp);
140
// Plot Data
139
// Plot Data
141
        for (int k=0;k<4;k++){
140
        for (int k=0;k<4;k++){
142
        if (! (mask & ( 0x1<<k ))  ) continue;
141
        if (! (mask & ( 0x1<<k ))  ) continue;
143
        float *t=DRSGetTime(k);
142
        float *t=DRSGetTime(k);
144
        float *x=DRSGetWave(k);        
143
        float *x=DRSGetWave(k);        
145
       
144
       
146
        if (!k){
145
        const int col[4]={VAL_BLACK,VAL_RED,VAL_GREEN,VAL_BLUE};
147
      if (plothandle)  DeleteGraphPlot (ph, PANEL_GRAPH, plothandle, VAL_DELAYED_DRAW);
146
        if (plothandle[k])  DeleteGraphPlot (ph, PANEL_GRAPH, plothandle[k], VAL_DELAYED_DRAW);
148
      plothandle = PlotXY (ph, PANEL_GRAPH, t, x, 1024, VAL_FLOAT, VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, VAL_BLUE);
147
        plothandle[k] = PlotXY (ph, PANEL_GRAPH, t, x, 1024, VAL_FLOAT, VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, col[k]);
149
        }  
148
         
150
       
-
 
151
       
-
 
152
            for (int i=0 ; i<1024 ; i++) {
149
              for (int i=0 ; i<1024 ; i++) {
153
           if (verbose) printf("[%d] %d. x= %3.2f  y=%3.2f\n", k, i, t[i], x[i] );
150
           if (verbose) printf("[%d] %d. x= %3.2f  y=%3.2f\n", k, i, t[i], x[i] );
154
           //h[k]->Fill( t[i], x[i]*1e-3);
151
           //h[k]->Fill( t[i], x[i]*1e-3);
155
        }
152
        }
156
        }
-
 
157
  }
153
  }
158
  time(&t);
154
  time(&t);
159
  printf("%d events in %2.2f min (%d s) %s",i+1, (double)(t-tstart)/60.,t-tstart, ctime(&t));
155
  printf("%d events in %2.2f min (%d s) %s",i+1, (double)(t-tstart)/60.,t-tstart, ctime(&t));
160
 
156
        }
161
  DRSEnd();
157
  DRSEnd();
162
}
158
}
163
 
159
 
164
if (fp) fclose(fp);
160
if (fp) fclose(fp);
165
 
161