JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwEPICSControl.h
Go to the documentation of this file.
1#ifndef __QwEPICSCONTROL__
2#define __QwEPICSCONTROL__
3
4
5
6#include <vector>
7#include <string>
8#include <iostream>
9#include <fstream>
10#include <iomanip>
11
12#include <time.h>
13#include <iterator>
14
15
16#include "Rtypes.h"
17
18#include "TMath.h"
19#include "TMatrix.h"
20#include "TString.h"
21
22#include "cadef.h"
23
24
26public:
27
30
32 Int_t status;
33 // Char_t tmp[30];
34 // status = ca_get(DBR_STRING, fIDHall_A_IA, tmp);
35 // status = ca_pend_io(10);
36 // std::cout << "Hall A IA value: " << tmp << std::endl;
37 Double_t value;
38 status = ca_get(DBR_DOUBLE, fIDHall_A_IA, &value);
39 status = ca_pend_io(10);
40 printf("Hall A IA value: %lf\n", value);
41 };
42
43
45 Int_t status;
46 // Char_t tmp[30];
47 // status = ca_get(DBR_STRING, fIDHall_A_IA, tmp);
48 // status = ca_pend_io(10);
49 // std::cout << "Hall A IA value: " << tmp << std::endl;
50 Double_t value;
51
52 status = ca_get(DBR_DOUBLE, fIDPockels_Cell_plus, &value);
53 status = ca_pend_io(10);
54 std::cout << "Pockels Cell plus HV value: " << value << std::endl;
55 status = ca_get(DBR_DOUBLE, fIDPockels_Cell_minus, &value);
56 status = ca_pend_io(10);
57 std::cout << "Pockels Cell minus HV value: " << value << std::endl;
58
59 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A0, &value);
60 status = ca_pend_io(10);
61 std::cout << "Hall C IA value A0: " << value << std::endl;
62 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A1, &value);
63 status = ca_pend_io(10);
64 std::cout << "Hall C IA value A1: " << value << std::endl;
65 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A2, &value);
66 status = ca_pend_io(10);
67 std::cout << "Hall C IA value A2: " << value << std::endl;
68 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A3, &value);
69 status = ca_pend_io(10);
70 std::cout << "Hall C IA value A3: " << value << std::endl;
71
72 };
73
74 void Set_HallCIA(Int_t mode, Double_t &value){
75 Int_t status;
76 switch(mode){
77 case 0:
78#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
79 status = ca_put(DBR_DOUBLE, fIDHall_C_IA_A0, &value);
80 status = ca_pend_io(10);
81 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A0, &value);
82 status = ca_pend_io(10);
83#endif
84 std::cout << "Hall C IA value A0: " << value << std::endl;
85 break;
86 case 1:
87#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
88 status = ca_put(DBR_DOUBLE, fIDHall_C_IA_A1, &value);
89 status = ca_pend_io(10);
90 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A1, &value);
91 status = ca_pend_io(10);
92#endif
93 std::cout << "Hall C IA value A1: " << value << std::endl;
94 break;
95 case 2:
96#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
97 status = ca_put(DBR_DOUBLE, fIDHall_C_IA_A2, &value);
98 status = ca_pend_io(10);
99 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A2, &value);
100 status = ca_pend_io(10);
101#endif
102 std::cout << "Hall C IA value A2: " << value << std::endl;
103 break;
104 case 3:
105#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
106 status = ca_put(DBR_DOUBLE, fIDHall_C_IA_A3, &value);
107 status = ca_pend_io(10);
108 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A3, &value);
109 status = ca_pend_io(10);
110#endif
111 std::cout << "Hall C IA value A3: " << value << std::endl;
112 break;
113 }
114
115 };
116
117 void Set_HallAIA(Int_t mode, Double_t &value){
118 Int_t status;
119 switch(mode){
120 case 0:
121#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
122 status = ca_put(DBR_DOUBLE, fIDHall_A_IA_A0, &value);
123 status = ca_pend_io(10);
124 status = ca_get(DBR_DOUBLE, fIDHall_A_IA_A0, &value);
125 status = ca_pend_io(10);
126#endif
127 std::cout << "Hall A IA value A0: " << value << std::endl;
128 break;
129 case 1:
130#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
131 status = ca_put(DBR_DOUBLE, fIDHall_A_IA_A1, &value);
132 status = ca_pend_io(10);
133 status = ca_get(DBR_DOUBLE, fIDHall_A_IA_A1, &value);
134 status = ca_pend_io(10);
135#endif
136 std::cout << "Hall A IA value A1: " << value << std::endl;
137 break;
138 case 2:
139#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
140 status = ca_put(DBR_DOUBLE, fIDHall_A_IA_A2, &value);
141 status = ca_pend_io(10);
142 status = ca_get(DBR_DOUBLE, fIDHall_A_IA_A2, &value);
143 status = ca_pend_io(10);
144#endif
145 std::cout << "Hall A IA value A2: " << value << std::endl;
146 break;
147 case 3:
148#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
149 status = ca_put(DBR_DOUBLE, fIDHall_A_IA_A3, &value);
150 status = ca_pend_io(10);
151 status = ca_get(DBR_DOUBLE, fIDHall_A_IA_A3, &value);
152 status = ca_pend_io(10);
153#endif
154 std::cout << "Hall A IA value A3: " << value << std::endl;
155 break;
156 }
157
158 };
159
160 void Set_HelicityMagnet(size_t magnet_index, size_t helicity_index, Double_t &value){
161 Int_t status;
162 if (magnet_index<4 && helicity_index<2){
163#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
164 status = ca_put(DBR_DOUBLE, fIDHelMag[magnet_index][helicity_index], &value);
165 status = ca_pend_io(10);
166 status = ca_get(DBR_DOUBLE, fIDHelMag[magnet_index][helicity_index], &value);
167 status = ca_pend_io(10);
168#endif
169 std::cout << "Helicity Magnet, " << fHelMagNames[magnet_index]
170 << "," << fHelicityNames[helicity_index] << " setpoint: "
171 << value << std::endl;
172 } else {
173 std::cerr << "Set_HelicityMagnet(): "
174 << "magnet_index must be less than 4, and is " << magnet_index
175 << "; helicity_index must be 0 or 1 but is " << helicity_index
176 << std::endl;
177 }
178 };
179
180
181
182 void Get_HallCIA(Int_t mode, Double_t &value){
183 Int_t status;
184 switch(mode){
185 case 0:
186 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A0, &value);
187 status = ca_pend_io(10);
188 std::cout << "Hall C IA value A0: " << value << std::endl;
189 break;
190 case 1:
191 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A1, &value);
192 status = ca_pend_io(10);
193 std::cout << "Hall C IA value A1: " << value << std::endl;
194 break;
195 case 2:
196 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A2, &value);
197 status = ca_pend_io(10);
198 std::cout << "Hall C IA value A2: " << value << std::endl;
199 break;
200 case 3:
201 status = ca_get(DBR_DOUBLE, fIDHall_C_IA_A3, &value);
202 status = ca_pend_io(10);
203 std::cout << "Hall C IA value A3: " << value << std::endl;
204 break;
205 }
206
207
208 }
209
210 void Get_HallAIA(Int_t mode, Double_t &value){
211 Int_t status;
212 switch(mode){
213 case 0:
214 status = ca_get(DBR_DOUBLE, fIDHall_A_IA_A0, &value);
215 status = ca_pend_io(10);
216 std::cout << "Hall A IA value A0: " << value << std::endl;
217 break;
218 case 1:
219 status = ca_get(DBR_DOUBLE, fIDHall_A_IA_A1, &value);
220 status = ca_pend_io(10);
221 std::cout << "Hall A IA value A1: " << value << std::endl;
222 break;
223 case 2:
224 status = ca_get(DBR_DOUBLE, fIDHall_A_IA_A2, &value);
225 status = ca_pend_io(10);
226 std::cout << "Hall A IA value A2: " << value << std::endl;
227 break;
228 case 3:
229 status = ca_get(DBR_DOUBLE, fIDHall_A_IA_A3, &value);
230 status = ca_pend_io(10);
231 std::cout << "Hall A IA value A3: " << value << std::endl;
232 break;
233 }
234
235
236 }
237
238 void Get_HelicityMagnet(size_t magnet_index, size_t helicity_index, Double_t &value){
239 Int_t status;
240 if (magnet_index<4 && helicity_index<2){
241 status = ca_get(DBR_DOUBLE, fIDHelMag[magnet_index][helicity_index], &value);
242 status = ca_pend_io(10);
243 std::cout << "Helicity Magnet, " << fHelMagNames[magnet_index]
244 << "," << fHelicityNames[helicity_index] << " setpoint: "
245 << value << std::endl;
246 } else {
247 std::cerr << "Get_HelicityMagnet(): "
248 << "magnet_index must be less than 4, and is " << magnet_index
249 << "; helicity_index must be 0 or 1 but is " << helicity_index
250 << std::endl;
251 }
252 };
253
254 //I removed followup read after eahc ca_put command - rakithab (02-29-2012)
255 void Set_Pockels_Cell_plus(Double_t &value){
256 Int_t status;
257#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
258 status = ca_put(DBR_DOUBLE, fIDPockels_Cell_plus, &value);
259 status = ca_pend_io(10);
260 status = ca_put(DBR_DOUBLE, fIDPockels_Cell_plus, &value);
261 status = ca_pend_io(10);
262#endif
263 std::cout << "Pockels Cell pos HW-count value: " << value << std::endl;
264
265 };
266 void Set_Pockels_Cell_minus(Double_t &value){
267 Int_t status;
268#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
269 status = ca_put(DBR_DOUBLE, fIDPockels_Cell_minus, &value);
270 status = ca_pend_io(10);
271 status = ca_put(DBR_DOUBLE, fIDPockels_Cell_minus, &value);
272 status = ca_pend_io(10);
273#endif
274 std::cout << "Pockels Cell minus HW-count value: " << value << std::endl;
275 };
276
277 void Get_Pockels_Cell_plus(Double_t &value){
278 Int_t status;
279 status = ca_get(DBR_DOUBLE, fIDPockels_Cell_plus, &value);
280 status = ca_pend_io(10);
281 std::cout << "Pockels Cell pos HW-count value: " << value << std::endl;
282
283 };
284 void Get_Pockels_Cell_minus(Double_t &value){
285 Int_t status;
286 status = ca_get(DBR_DOUBLE, fIDPockels_Cell_minus, &value);
287 status = ca_pend_io(10);
288 std::cout << "Pockels Cell minus HW-count value: " << value << std::endl;
289 };
290
291 void Set_ChargeAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width){
292 Int_t status;
293#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
294 status = ca_put(DBR_DOUBLE,fChargeAsymmetry , &value);
295 status = ca_pend_io(10);
296 //status = ca_get(DBR_DOUBLE,fChargeAsymmetry , &value);
297 //status = ca_pend_io(10);
298 status = ca_put(DBR_DOUBLE,fChargeAsymmetryError , &value_error);
299 status = ca_pend_io(10);
300 //status = ca_get(DBR_DOUBLE,fChargeAsymmetryError , &value_error);
301 //status = ca_pend_io(10);
302 status = ca_put(DBR_DOUBLE,fChargeAsymmetryWidth , &value_width);
303 status = ca_pend_io(10);
304 //status = ca_get(DBR_DOUBLE,fChargeAsymmetryWidth , &value_width);
305 //status = ca_pend_io(10);
306#endif
307
308 std::cout << "EPICS Charge asymmetry updated " << value <<" +/- "<<value_error<<" width "<<value_width<< std::endl;
309
310 };
311
312 void Get_ChargeAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width){
313 Int_t status;
314 status = ca_get(DBR_DOUBLE,fChargeAsymmetry , &value);
315 status = ca_pend_io(10);
316 status = ca_get(DBR_DOUBLE,fChargeAsymmetryError , &value_error);
317 status = ca_pend_io(10);
318 status = ca_get(DBR_DOUBLE,fChargeAsymmetryWidth , &value_width);
319 status = ca_pend_io(10);
320 std::cout << "Charge asymmetry " << value <<" +/- "<<value_error<<" width "<<value_width<< std::endl;
321
322 };
323
324 void Set_HAChargeAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width){
325 Int_t status;
326#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
327 status = ca_put(DBR_DOUBLE,fHAChargeAsymmetry , &value);
328 status = ca_pend_io(10);
329 //status = ca_get(DBR_DOUBLE,fHAChargeAsymmetry , &value);
330 // status = ca_pend_io(10);
331 status = ca_put(DBR_DOUBLE,fHAChargeAsymmetryError , &value_error);
332 status = ca_pend_io(10);
333 //status = ca_get(DBR_DOUBLE,fHAChargeAsymmetryError , &value_error);
334 //status = ca_pend_io(10);
335 status = ca_put(DBR_DOUBLE,fHAChargeAsymmetryWidth , &value_width);
336 status = ca_pend_io(10);
337 //status = ca_get(DBR_DOUBLE,fHAChargeAsymmetryWidth , &value_width);
338 //status = ca_pend_io(10);
339#endif
340
341 std::cout << "EPICS HA Charge asymmetry updated " << value <<" +/- "<<value_error<<" width "<<value_width<< std::endl;
342
343 };
344
345 void Get_HAChargeAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width){
346 Int_t status;
347 status = ca_get(DBR_DOUBLE,fHAChargeAsymmetry , &value);
348 status = ca_pend_io(10);
349 status = ca_get(DBR_DOUBLE,fHAChargeAsymmetryError , &value_error);
350 status = ca_pend_io(10);
351 status = ca_get(DBR_DOUBLE,fHAChargeAsymmetryWidth , &value_width);
352 status = ca_pend_io(10);
353 std::cout << "HA Charge asymmetry " << value <<" +/- "<<value_error<<" width "<<value_width<< std::endl;
354
355 };
356
357 void Set_TargetHCDiffereces(Double_t &xvalue, Double_t &xvalue_error, Double_t &xvalue_width,Double_t &xpvalue, Double_t &xpvalue_error, Double_t &xpvalue_width, Double_t &yvalue, Double_t &yvalue_error, Double_t &yvalue_width, Double_t &ypvalue, Double_t &ypvalue_error, Double_t &ypvalue_width){
358
359 Int_t status;
360#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
361 status = ca_put(DBR_DOUBLE,fTargetXDiff , &xvalue);
362 status = ca_pend_io(10);
363 status = ca_put(DBR_DOUBLE,fTargetXDiffError , &xvalue_error);
364 status = ca_pend_io(10);
365 status = ca_put(DBR_DOUBLE,fTargetXDiffWidth , &xvalue_width);
366 status = ca_pend_io(10);
367
368 status = ca_put(DBR_DOUBLE,fTargetXPDiff , &xpvalue);
369 status = ca_pend_io(10);
370 status = ca_put(DBR_DOUBLE,fTargetXPDiffError , &xpvalue_error);
371 status = ca_pend_io(10);
372 status = ca_put(DBR_DOUBLE,fTargetXPDiffWidth , &xpvalue_width);
373 status = ca_pend_io(10);
374
375 status = ca_put(DBR_DOUBLE,fTargetYDiff , &yvalue);
376 status = ca_pend_io(10);
377 status = ca_put(DBR_DOUBLE,fTargetYDiffError , &yvalue_error);
378 status = ca_pend_io(10);
379 status = ca_put(DBR_DOUBLE,fTargetYDiffWidth , &yvalue_width);
380 status = ca_pend_io(10);
381
382 status = ca_put(DBR_DOUBLE,fTargetYPDiff , &ypvalue);
383 status = ca_pend_io(10);
384 status = ca_put(DBR_DOUBLE,fTargetYPDiffError , &ypvalue_error);
385 status = ca_pend_io(10);
386 status = ca_put(DBR_DOUBLE,fTargetYPDiffWidth , &ypvalue_width);
387 status = ca_pend_io(10);
388#endif
389
390 std::cout << "Target X Diff (um) " << xvalue <<" +/- "<<xvalue_error<<" width "<<xvalue_width << std::endl;
391 std::cout << "Target XP Diff (mrad) " << xpvalue <<" +/- "<<xpvalue_error<<" width "<<xpvalue_width << std::endl;
392 std::cout << "Target Y Diff (um) " << yvalue <<" +/- "<<yvalue_error<<" width "<<yvalue_width << std::endl;
393 std::cout << "Target YP Diff (mrad) " << ypvalue <<" +/- "<<ypvalue_error<<" width "<<ypvalue_width << std::endl;
394
395
396
397 }
398
399 void Get_TargetHCDiffereces(Double_t &xvalue, Double_t &xvalue_error, Double_t &xvalue_width,Double_t &xpvalue, Double_t &xpvalue_error, Double_t &xpvalue_width, Double_t &yvalue, Double_t &yvalue_error, Double_t &yvalue_width, Double_t &ypvalue, Double_t &ypvalue_error, Double_t &ypvalue_width){
400
401 Int_t status;
402 status = ca_get(DBR_DOUBLE,fTargetXDiff , &xvalue);
403 status = ca_pend_io(10);
404 status = ca_get(DBR_DOUBLE,fTargetXDiffError , &xvalue_error);
405 status = ca_pend_io(10);
406 status = ca_get(DBR_DOUBLE,fTargetXDiffWidth , &xvalue_width);
407 status = ca_pend_io(10);
408
409 status = ca_get(DBR_DOUBLE,fTargetXPDiff , &xpvalue);
410 status = ca_pend_io(10);
411 status = ca_get(DBR_DOUBLE,fTargetXPDiffError , &xpvalue_error);
412 status = ca_pend_io(10);
413 status = ca_get(DBR_DOUBLE,fTargetXPDiffWidth , &xpvalue_width);
414 status = ca_pend_io(10);
415
416 status = ca_get(DBR_DOUBLE,fTargetYDiff , &yvalue);
417 status = ca_pend_io(10);
418 status = ca_get(DBR_DOUBLE,fTargetYDiffError , &yvalue_error);
419 status = ca_pend_io(10);
420 status = ca_get(DBR_DOUBLE,fTargetYDiffWidth , &yvalue_width);
421 status = ca_pend_io(10);
422
423 status = ca_get(DBR_DOUBLE,fTargetYPDiff , &ypvalue);
424 status = ca_pend_io(10);
425 status = ca_get(DBR_DOUBLE,fTargetYPDiffError , &ypvalue_error);
426 status = ca_pend_io(10);
427 status = ca_get(DBR_DOUBLE,fTargetYPDiffWidth , &ypvalue_width);
428 status = ca_pend_io(10);
429
430 }
431
432
433 void Set_3C12HCDiffereces(Double_t &xvalue, Double_t &xvalue_error, Double_t &xvalue_width, Double_t &yvalue, Double_t &yvalue_error, Double_t &yvalue_width, Double_t &yqvalue, Double_t &yqvalue_error, Double_t &yqvalue_width){
434
435 Int_t status;
436#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
437 status = ca_put(DBR_DOUBLE,f3C12XDiff , &xvalue);
438 status = ca_pend_io(10);
439 status = ca_put(DBR_DOUBLE,f3C12XDiffError , &xvalue_error);
440 status = ca_pend_io(10);
441 status = ca_put(DBR_DOUBLE,f3C12XDiffWidth , &xvalue_width);
442 status = ca_pend_io(10);
443
444 status = ca_put(DBR_DOUBLE,f3C12YDiff , &yvalue);
445 status = ca_pend_io(10);
446 status = ca_put(DBR_DOUBLE,f3C12YDiffError , &yvalue_error);
447 status = ca_pend_io(10);
448 status = ca_put(DBR_DOUBLE,f3C12YDiffWidth , &yvalue_width);
449 status = ca_pend_io(10);
450
451 status = ca_put(DBR_DOUBLE,f3C12YQ , &yqvalue);
452 status = ca_pend_io(10);
453 status = ca_put(DBR_DOUBLE,f3C12YQError , &yqvalue_error);
454 status = ca_pend_io(10);
455 status = ca_put(DBR_DOUBLE,f3C12YQWidth , &yqvalue_width);
456 status = ca_pend_io(10);
457#endif
458
459 std::cout << "3C12 X Diff (um) " << xvalue <<" +/- "<<xvalue_error<<" width "<<xvalue_width << std::endl;
460 std::cout << "3C12 Y Diff (mrad) " << yvalue <<" +/- "<<yvalue_error<<" width "<<yvalue_width << std::endl;
461 std::cout << "3C12 EffQ Diff (um) " << yqvalue <<" +/- "<<yqvalue_error<<" width "<<yqvalue_width << std::endl;
462
463
464 }
465
466 void Get_3C12HCDiffereces(Double_t &xvalue, Double_t &xvalue_error, Double_t &xvalue_width, Double_t &yvalue, Double_t &yvalue_error, Double_t &yvalue_width, Double_t &yqvalue, Double_t &yqvalue_error, Double_t &yqvalue_width){
467 Int_t status;
468 status = ca_get(DBR_DOUBLE,f3C12XDiff , &xvalue);
469 status = ca_pend_io(10);
470 status = ca_get(DBR_DOUBLE,f3C12XDiffError , &xvalue_error);
471 status = ca_pend_io(10);
472 status = ca_get(DBR_DOUBLE,f3C12XDiffWidth , &xvalue_width);
473 status = ca_pend_io(10);
474
475 status = ca_get(DBR_DOUBLE,f3C12YDiff , &yvalue);
476 status = ca_pend_io(10);
477 status = ca_get(DBR_DOUBLE,f3C12YDiffError , &yvalue_error);
478 status = ca_pend_io(10);
479 status = ca_get(DBR_DOUBLE,f3C12YDiffWidth , &yvalue_width);
480 status = ca_pend_io(10);
481
482 status = ca_get(DBR_DOUBLE,f3C12YQ , &yqvalue);
483 status = ca_pend_io(10);
484 status = ca_get(DBR_DOUBLE,f3C12YQError , &yqvalue_error);
485 status = ca_pend_io(10);
486 status = ca_get(DBR_DOUBLE,f3C12YQWidth , &yqvalue_width);
487 status = ca_pend_io(10);
488 }
489
490
491
492 void Set_BCM78DDAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width){
493 Int_t status;
494#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
495 status = ca_put(DBR_DOUBLE,fBCM8DDAsymmetry , &value);
496 status = ca_pend_io(10);
497 status = ca_put(DBR_DOUBLE,fBCM8DDAsymmetryError , &value_error);
498 status = ca_pend_io(10);
499 status = ca_put(DBR_DOUBLE,fBCM8DDAsymmetryWidth , &value_width);
500 status = ca_pend_io(10);
501#endif
502 std::cout << "EPICS BCM78 DD asymmetry updated " << value <<" +/- "<<value_error<<" width "<<value_width<< std::endl;
503
504 }
505
506 void Get_BCM78DDAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width){
507 Int_t status;
508 status = ca_get(DBR_DOUBLE,fBCM8DDAsymmetry , &value);
509 status = ca_pend_io(10);
510 status = ca_get(DBR_DOUBLE,fBCM8DDAsymmetryError , &value_error);
511 status = ca_pend_io(10);
512 status = ca_get(DBR_DOUBLE,fBCM8DDAsymmetryWidth , &value_width);
513 status = ca_pend_io(10);
514
515 };
516
517
518 void Set_BCM8Yield(Double_t &value){
519 Int_t status;
520#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
521 status = ca_put(DBR_DOUBLE,fBCM8Yield, &value);
522 status = ca_pend_io(10);
523#endif
524 }
525
526 void Get_BCM8Yield(Double_t &value){
527 Int_t status;
528 status = ca_get(DBR_DOUBLE,fBCM8Yield, &value);
529 status = ca_pend_io(10);
530 }
531
532 void Set_USLumiSumAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width){
533 Int_t status;
534#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
535 status = ca_put(DBR_DOUBLE,fUSLumiSumAsymmetry , &value);
536 status = ca_pend_io(10);
537 status = ca_put(DBR_DOUBLE,fUSLumiSumAsymmetryError , &value_error);
538 status = ca_pend_io(10);
539 status = ca_put(DBR_DOUBLE,fUSLumiSumAsymmetryWidth , &value_width);
540 status = ca_pend_io(10);
541#endif
542 }
543
544 void Get_USLumiSumAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width){
545 Int_t status;
546 status = ca_get(DBR_DOUBLE,fUSLumiSumAsymmetry , &value);
547 status = ca_get(DBR_DOUBLE,fUSLumiSumAsymmetryError , &value_error);
548 status = ca_get(DBR_DOUBLE,fUSLumiSumAsymmetryWidth , &value_width);
549 }
550
551 void Set_FeedbackStatus(Double_t value){
552 Int_t status;
553#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
554 status = ca_put(DBR_DOUBLE, fFeedbackStatus, &value);
555 status = ca_pend_io(10);
556 status = ca_get(DBR_DOUBLE, fFeedbackStatus, &value);
557 status = ca_pend_io(10);
558 std::cout << "Feedback status updated " << value << std::endl;
559#endif
560 };
561
563 Int_t status;
564 Double_t fbstat;
565 status = ca_get(DBR_DOUBLE, fFeedbackStatus, &fbstat);
566 status = ca_pend_io(10);
567 return fbstat;
568 }
569
570 //
571 // not test yet, duplicated one to compare with QwHelicityCorrelatedFeedback::GetHalfWavePlateState()
572 //
573 // Wednesday, January 12 11:59:09 EST 2011, jhlee
574 //
576 Int_t plate_status;
577 // const char* epic_half_wave_plate = "IGL1I00DI24_24M";
578 plate_status = ca_get(DBF_STRING, fHalfWavePlateStatus, &plate_status);
579 if(plate_status == 1) {
580 return "IN";
581 }
582 else {
583 return "OUT";
584 }
585 };
586
587 /*
588 static const Double_t kOn;
589 static const Double_t kOff;
590 static const Double_t kQAsymCut;
591 static const Double_t kPosDiffCut;
592 static const Double_t kQAsymCutHallA;
593
594 void GetFeedbackParameters();
595 void GetHallAIAFeedbackParameters();
596 void Get33Matrix();
597 void PutFeedbackParameters();
598 void PutFeedbackParametersPos();
599 void CheckBeamDevice();
600 void OutputFeedbackValues(Helicity*, Asymmetry*);
601 void GetFeedbackValuesPos();
602 Bool_t BeamCut(QwTriggerSupervisor*);
603 Bool_t ASYCut();
604 Bool_t ASYCutPos();
605 void AccumulateFeedbackValues();
606 void AccumulateFeedbackValuesPos();
607 void GetFeedbackValues();
608 Bool_t TimeIsUp();
609 Bool_t TimeIsUpForPos();
610 void ResetCount();
611 void ResetCountPos();
612 void FeedbackLoggerCharge();
613 void FeedbackLogger(const UShort_t chargefeed=1, const UShort_t f33=1);
614 void FeedbackLoggerPos();
615
616 void GetFeedbackValues33(const Bool_t oneshot=kTRUE);
617
618 Bool_t ChargeFeedbackIsOn(void) const {
619 if(log_qonoff==kOn) return kTRUE;
620 else return kFALSE;
621 }
622
623 Bool_t PositionFeedbackIsOn(void) const {
624 if(log_ponoff==kOn) return kTRUE;
625 else return kFALSE;
626 }
627 void CorrectingIAVoltage();
628 void CorrectingHMDACs();
629
630 //for Mark's revised 3x3 feedback plan
631 Bool_t TimeIsUpForFastFeedBack();
632 Bool_t TimeIsUpForSlowFeedBack();
633
634 Bool_t ASYCutHallA() const;
635 Bool_t CurrentCutHallA(QwTriggerSupervisor*);
636 Bool_t TimeIsUpForHallAFeedBack();
637 Bool_t HallAFeedbackIsOn() const;
638
639 void GetFeedbackValuesHallA();
640 void FeedbackLoggerHallA();
641 void PutFeedbackParametersHallA();
642 void CorrectingHallAIAVoltage();
643 void AccumulateFeedbackValuesHallA();
644 void ResetCountHallA();
645 */
646
647 protected:
648
649 private:
650 /*
651 * Some of the private variables should be the EPICS variable names,
652 * the buffer containing the quartet information, the histograms (if
653 * used), the accumulated BPM and BCM feedback values and errors,
654 * event cuts, etc.
655 *
656 */
657
660 chid fIDHall_C_IA_A0;//hallc IA A0
661 chid fIDHall_C_IA_A1;//hallc IA A1
662 chid fIDHall_C_IA_A2;//hallc IA A2
663 chid fIDHall_C_IA_A3;//hallc IA A3
664
665 chid fIDHall_A_IA_A0;//hallA IA A0
666 chid fIDHall_A_IA_A1;//hallA IA A1
667 chid fIDHall_A_IA_A2;//hallA IA A2
668 chid fIDHall_A_IA_A3;//hallA IA A3
669
670
671
674
678
682
686
690
694
698
699
703
707
711
715
717
721
722
723
725
727
728 chid fIDHelMag[4][2]; ///< EPICS control setpoints for helicity magnets indexed by magnet and helicity state
729 TString fHelMagNames[4]; ///< Device names of the helicity magnets
730 TString fHelicityNames[2];
731
732
733
734
735
736
737 /* OLD VARIABLES */
738 /*
739 Int_t loopIteration;
740 Double_t loopLimit;
741
742 Int_t ploopIteration;
743 Double_t ploopLimit;
744
745 time_t currentTime;
746 Int_t ncount;
747 Int_t pncount;
748 dbr_double_t qtime;
749 char * qtime_cha;
750 dbr_double_t ptime;
751 char * ptime_cha;
752
753
754 Int_t IHWP_status;
755 Double_t hallc_I;
756 dbr_double_t bcm_threshold_feed;
757 dbr_double_t bcm_select_feed;
758 dbr_double_t bpm_threshold_feed;
759 dbr_double_t bpm_select_feed;
760 dbr_double_t sample_rate_feed;
761 dbr_double_t psample_rate_feed;
762 dbr_double_t q_asy;
763 dbr_double_t g0_IA_voltage_corrected;
764 dbr_double_t g0_IA_voltage_read;
765
766 dbr_double_t g0_hm1_DAC_corrected;
767 dbr_double_t g0_hm1_DAC_read;
768 dbr_double_t g0_hm2_DAC_corrected;
769 dbr_double_t g0_hm2_DAC_read;
770 dbr_double_t g0_hm3_DAC_corrected;
771 dbr_double_t g0_hm3_DAC_read;
772 dbr_double_t g0_hm4_DAC_corrected;
773 dbr_double_t g0_hm4_DAC_read;
774
775 dbr_double_t p_asy_x;
776 dbr_double_t p_asy_y;
777 double bpm_const_feed;
778 int status;
779 int stat;
780
781 Double_t bcm_scale_feed;
782 Double_t bcm_offset_feed;
783 Double_t bcm_readout_feed;
784
785 Double_t x_feed;
786 Double_t y_feed;
787 Double_t E_feed;
788
789 Double_t qasy;
790 Double_t q_asy_sum;
791 Double_t q_asy_sq_sum;
792 Double_t q_asy_d;
793 Double_t p_diff_x_sum;
794 Double_t p_diff_y_sum;
795 Double_t p_diff_E_sum;
796 Double_t p_diff_x_sq_sum;
797 Double_t p_diff_y_sq_sum;
798 Double_t p_diff_E_sq_sum;
799
800 Double_t p_diff_x;
801 Double_t p_diff_x_d;
802 Double_t p_diff_y;
803 Double_t p_diff_y_d;
804 Double_t p_diff_E;
805 Double_t p_diff_E_d;
806
807 Double_t log_bcm1;
808 Double_t log_bcm2;
809 Double_t log_qonoff;
810 Double_t log_ponoff;
811 Double_t log_ia;
812 Double_t log_wave;
813 Double_t log_pita_pos, log_pita_neg;
814 Double_t log_hel_even_1;
815 Double_t log_hel_even_2;
816 Double_t log_hel_even_3;
817 Double_t log_hel_even_4;
818 Double_t log_ia_slope;
819
820 //2 by 2 matrix
821 Double_t log_m11;
822 Double_t log_m12;
823 Double_t log_m21;
824 Double_t log_m22;
825 //3 by 3 matrix
826 Double_t fMatIAHM[3][3];
827
828 UInt_t numFastFeedback;//fast feedback loop counter
829 Bool_t fTimeIsUpForSlowFeedback;
830 UInt_t fNumFastLoopsInSlowLoop; //limit of fast feedbacks in the
831 //slow feedback loop
832
833 Double_t log_halla_i, halla_I, halla_bcm_readout_feed;
834 Double_t fAsym_q_halla, fAsym_q_halla_sum, fAsym_q_halla_sq_sum;
835
836 Double_t fHallA_IA_voltage_corrected, fHallA_IA_voltage_read;
837 Double_t fHallA_IA_slope;
838
839 Double_t fHallAFeedbackTConst;
840
841 Double_t fHallAFeedbackIsOn;
842
843 Double_t fAsym_q_halla_ave_log, fAsym_q_halla_err_log;
844
845 Double_t fAsym_q_halla_ave, fAsym_q_halla_ave_err;
846 //two more vars going into the log file
847
848 Int_t ancount;
849 Int_t aloopIteration;
850 Double_t aloopLimit;
851
852 Double_t fCurrentCutHallA;
853 */
854
855};
856
857#endif
void Get_Pockels_Cell_minus(Double_t &value)
void Set_Pockels_Cell_plus(Double_t &value)
void Set_HAChargeAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width)
void Get_Pockels_Cell_plus(Double_t &value)
void Set_USLumiSumAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width)
void Set_FeedbackStatus(Double_t value)
void Set_3C12HCDiffereces(Double_t &xvalue, Double_t &xvalue_error, Double_t &xvalue_width, Double_t &yvalue, Double_t &yvalue_error, Double_t &yvalue_width, Double_t &yqvalue, Double_t &yqvalue_error, Double_t &yqvalue_width)
void Set_HallCIA(Int_t mode, Double_t &value)
void Get_ChargeAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width)
void Set_BCM8Yield(Double_t &value)
void Get_TargetHCDiffereces(Double_t &xvalue, Double_t &xvalue_error, Double_t &xvalue_width, Double_t &xpvalue, Double_t &xpvalue_error, Double_t &xpvalue_width, Double_t &yvalue, Double_t &yvalue_error, Double_t &yvalue_width, Double_t &ypvalue, Double_t &ypvalue_error, Double_t &ypvalue_width)
chid fUSLumiSumAsymmetryError
void Set_TargetHCDiffereces(Double_t &xvalue, Double_t &xvalue_error, Double_t &xvalue_width, Double_t &xpvalue, Double_t &xpvalue_error, Double_t &xpvalue_width, Double_t &yvalue, Double_t &yvalue_error, Double_t &yvalue_width, Double_t &ypvalue, Double_t &ypvalue_error, Double_t &ypvalue_width)
void Set_BCM78DDAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width)
void Get_BCM8Yield(Double_t &value)
void Set_ChargeAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width)
void Set_HallAIA(Int_t mode, Double_t &value)
void Get_USLumiSumAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width)
void Set_HelicityMagnet(size_t magnet_index, size_t helicity_index, Double_t &value)
chid fIDHelMag[4][2]
EPICS control setpoints for helicity magnets indexed by magnet and helicity state.
void Get_HAChargeAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width)
void Get_BCM78DDAsymmetry(Double_t &value, Double_t &value_error, Double_t &value_width)
TString fHelicityNames[2]
TString fHelMagNames[4]
Device names of the helicity magnets.
void Get_HallAIA(Int_t mode, Double_t &value)
void Set_Pockels_Cell_minus(Double_t &value)
Double_t Get_FeedbackStatus()
void Get_HallCIA(Int_t mode, Double_t &value)
void Get_HelicityMagnet(size_t magnet_index, size_t helicity_index, Double_t &value)
TString Get_HalfWavePlateState()
void Get_3C12HCDiffereces(Double_t &xvalue, Double_t &xvalue_error, Double_t &xvalue_width, Double_t &yvalue, Double_t &yvalue_error, Double_t &yvalue_width, Double_t &yqvalue, Double_t &yqvalue_error, Double_t &yqvalue_width)
void Print_Qasym_Ctrls()
chid fUSLumiSumAsymmetryWidth