Rev 200 | Rev 203 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 200 | Rev 201 | ||
|---|---|---|---|
| Line 113... | Line 113... | ||
| 113 | buffer_size = 4 + nBoards * (4 + 4*(4+waveDepth*4)); |
113 | buffer_size = 4 + nBoards * (4 + 4*(4+waveDepth*4)); |
| 114 | buffer_size += 24 + nBoards * (8 + 4*(4+waveDepth*2)); |
114 | buffer_size += 24 + nBoards * (8 + 4*(4+waveDepth*2)); |
| 115 | buffer = (unsigned char *)malloc(buffer_size); |
115 | buffer = (unsigned char *)malloc(buffer_size); |
| 116 | } |
116 | } |
| 117 | 117 | ||
| 118 | time_t t |
118 | time_t t=0,told=0, tstart=0; |
| 119 | 119 | ||
| 120 | if (!DRSInit()){ |
120 | if (!DRSInit()){ |
| 121 | time(&tstart); |
121 | time(&tstart); |
| 122 | told=tstart; |
122 | told=tstart; |
| 123 | int i=0; |
123 | int i=0; |
| Line 125... | Line 125... | ||
| 125 | start_timer(1);// 1 s timeout |
125 | start_timer(1);// 1 s timeout |
| 126 | int retval = DRSRead(0); |
126 | int retval = DRSRead(0); |
| 127 | stop_timer(); |
127 | stop_timer(); |
| 128 | int nb = ( retval == 0 && fp ) ? DRSToBuffer( buffer , i ) : 0; |
128 | int nb = ( retval == 0 && fp ) ? DRSToBuffer( buffer , i ) : 0; |
| 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 | } |
135 | } |
| Line 140... | Line 140... | ||
| 140 | for (int k=0;k<4;k++){ |
140 | for (int k=0;k<4;k++){ |
| 141 | if (! (mask & ( 0x1<<k )) ) continue; |
141 | if (! (mask & ( 0x1<<k )) ) continue; |
| 142 | float *t=DRSGetTime(k); |
142 | float *t=DRSGetTime(k); |
| 143 | float *x=DRSGetWave(k); |
143 | float *x=DRSGetWave(k); |
| 144 | 144 | ||
| 145 | const int col[4]={ |
145 | const int col[4]={VAL_WHITE,VAL_RED,VAL_GREEN,VAL_BLUE}; |
| 146 | if (plothandle[k]) |
146 | if (plothandle[k]) DeleteGraphPlot (ph, PANEL_GRAPH, plothandle[k], VAL_IMMEDIATE_DRAW); |
| 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]); |
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]); |
| 148 | 148 | ||
| 149 | for (int i=0 ; i<1024 ; i++) { |
149 | for (int i=0 ; i<1024 ; i++) { |
| 150 | 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] ); |
| 151 | //h[k]->Fill( t[i], x[i]*1e-3); |
151 | //h[k]->Fill( t[i], x[i]*1e-3); |
| 152 | } |
152 | } |
| 153 | } |
153 | } |
| - | 154 | ||
| 154 |
|
155 | |
| 155 | printf("%d events in %2.2f min (%d s) %s",i+1, (double)(t-tstart)/60.,t-tstart, ctime(&t)); |
- | |
| 156 | } |
156 | } |
| - | 157 | time(&t); |
|
| - | 158 | printf("%d events in %2.2f min (%d s) %s",i+1, (double)(t-tstart)/60.,t-tstart, ctime(&t)); |
|
| 157 | DRSEnd(); |
159 | DRSEnd(); |
| 158 | } |
160 | } |
| 159 | 161 | ||
| 160 | if (fp) fclose(fp); |
162 | if (fp) fclose(fp); |
| 161 | 163 | ||