1#ifndef __QwEPICSCONTROL__
2#define __QwEPICSCONTROL__
39 status = ca_pend_io(10);
40 printf(
"Hall A IA value: %lf\n", value);
53 status = ca_pend_io(10);
54 std::cout <<
"Pockels Cell plus HV value: " << value << std::endl;
56 status = ca_pend_io(10);
57 std::cout <<
"Pockels Cell minus HV value: " << value << std::endl;
60 status = ca_pend_io(10);
61 std::cout <<
"Hall C IA value A0: " << value << std::endl;
63 status = ca_pend_io(10);
64 std::cout <<
"Hall C IA value A1: " << value << std::endl;
66 status = ca_pend_io(10);
67 std::cout <<
"Hall C IA value A2: " << value << std::endl;
69 status = ca_pend_io(10);
70 std::cout <<
"Hall C IA value A3: " << value << std::endl;
78#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
80 status = ca_pend_io(10);
82 status = ca_pend_io(10);
84 std::cout <<
"Hall C IA value A0: " << value << std::endl;
87#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
89 status = ca_pend_io(10);
91 status = ca_pend_io(10);
93 std::cout <<
"Hall C IA value A1: " << value << std::endl;
96#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
98 status = ca_pend_io(10);
100 status = ca_pend_io(10);
102 std::cout <<
"Hall C IA value A2: " << value << std::endl;
105#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
107 status = ca_pend_io(10);
109 status = ca_pend_io(10);
111 std::cout <<
"Hall C IA value A3: " << value << std::endl;
121#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
123 status = ca_pend_io(10);
125 status = ca_pend_io(10);
127 std::cout <<
"Hall A IA value A0: " << value << std::endl;
130#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
132 status = ca_pend_io(10);
134 status = ca_pend_io(10);
136 std::cout <<
"Hall A IA value A1: " << value << std::endl;
139#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
141 status = ca_pend_io(10);
143 status = ca_pend_io(10);
145 std::cout <<
"Hall A IA value A2: " << value << std::endl;
148#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
150 status = ca_pend_io(10);
152 status = ca_pend_io(10);
154 std::cout <<
"Hall A IA value A3: " << value << std::endl;
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);
169 std::cout <<
"Helicity Magnet, " <<
fHelMagNames[magnet_index]
171 << value << std::endl;
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
187 status = ca_pend_io(10);
188 std::cout <<
"Hall C IA value A0: " << value << std::endl;
192 status = ca_pend_io(10);
193 std::cout <<
"Hall C IA value A1: " << value << std::endl;
197 status = ca_pend_io(10);
198 std::cout <<
"Hall C IA value A2: " << value << std::endl;
202 status = ca_pend_io(10);
203 std::cout <<
"Hall C IA value A3: " << value << std::endl;
215 status = ca_pend_io(10);
216 std::cout <<
"Hall A IA value A0: " << value << std::endl;
220 status = ca_pend_io(10);
221 std::cout <<
"Hall A IA value A1: " << value << std::endl;
225 status = ca_pend_io(10);
226 std::cout <<
"Hall A IA value A2: " << value << std::endl;
230 status = ca_pend_io(10);
231 std::cout <<
"Hall A IA value A3: " << value << std::endl;
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]
245 << value << std::endl;
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
257#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
259 status = ca_pend_io(10);
261 status = ca_pend_io(10);
263 std::cout <<
"Pockels Cell pos HW-count value: " << value << std::endl;
268#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
270 status = ca_pend_io(10);
272 status = ca_pend_io(10);
274 std::cout <<
"Pockels Cell minus HW-count value: " << value << std::endl;
280 status = ca_pend_io(10);
281 std::cout <<
"Pockels Cell pos HW-count value: " << value << std::endl;
287 status = ca_pend_io(10);
288 std::cout <<
"Pockels Cell minus HW-count value: " << value << std::endl;
293#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
295 status = ca_pend_io(10);
299 status = ca_pend_io(10);
303 status = ca_pend_io(10);
308 std::cout <<
"EPICS Charge asymmetry updated " << value <<
" +/- "<<value_error<<
" width "<<value_width<< std::endl;
315 status = ca_pend_io(10);
317 status = ca_pend_io(10);
319 status = ca_pend_io(10);
320 std::cout <<
"Charge asymmetry " << value <<
" +/- "<<value_error<<
" width "<<value_width<< std::endl;
326#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
328 status = ca_pend_io(10);
332 status = ca_pend_io(10);
336 status = ca_pend_io(10);
341 std::cout <<
"EPICS HA Charge asymmetry updated " << value <<
" +/- "<<value_error<<
" width "<<value_width<< std::endl;
348 status = ca_pend_io(10);
350 status = ca_pend_io(10);
352 status = ca_pend_io(10);
353 std::cout <<
"HA Charge asymmetry " << value <<
" +/- "<<value_error<<
" width "<<value_width<< std::endl;
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){
360#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
362 status = ca_pend_io(10);
364 status = ca_pend_io(10);
366 status = ca_pend_io(10);
369 status = ca_pend_io(10);
371 status = ca_pend_io(10);
373 status = ca_pend_io(10);
376 status = ca_pend_io(10);
378 status = ca_pend_io(10);
380 status = ca_pend_io(10);
383 status = ca_pend_io(10);
385 status = ca_pend_io(10);
387 status = ca_pend_io(10);
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;
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){
403 status = ca_pend_io(10);
405 status = ca_pend_io(10);
407 status = ca_pend_io(10);
410 status = ca_pend_io(10);
412 status = ca_pend_io(10);
414 status = ca_pend_io(10);
417 status = ca_pend_io(10);
419 status = ca_pend_io(10);
421 status = ca_pend_io(10);
424 status = ca_pend_io(10);
426 status = ca_pend_io(10);
428 status = ca_pend_io(10);
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){
436#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
437 status = ca_put(DBR_DOUBLE,
f3C12XDiff , &xvalue);
438 status = ca_pend_io(10);
440 status = ca_pend_io(10);
442 status = ca_pend_io(10);
444 status = ca_put(DBR_DOUBLE,
f3C12YDiff , &yvalue);
445 status = ca_pend_io(10);
447 status = ca_pend_io(10);
449 status = ca_pend_io(10);
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);
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;
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){
468 status = ca_get(DBR_DOUBLE,
f3C12XDiff , &xvalue);
469 status = ca_pend_io(10);
471 status = ca_pend_io(10);
473 status = ca_pend_io(10);
475 status = ca_get(DBR_DOUBLE,
f3C12YDiff , &yvalue);
476 status = ca_pend_io(10);
478 status = ca_pend_io(10);
480 status = ca_pend_io(10);
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);
494#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
496 status = ca_pend_io(10);
498 status = ca_pend_io(10);
500 status = ca_pend_io(10);
502 std::cout <<
"EPICS BCM78 DD asymmetry updated " << value <<
" +/- "<<value_error<<
" width "<<value_width<< std::endl;
509 status = ca_pend_io(10);
511 status = ca_pend_io(10);
513 status = ca_pend_io(10);
520#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
521 status = ca_put(DBR_DOUBLE,
fBCM8Yield, &value);
522 status = ca_pend_io(10);
528 status = ca_get(DBR_DOUBLE,
fBCM8Yield, &value);
529 status = ca_pend_io(10);
534#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
536 status = ca_pend_io(10);
538 status = ca_pend_io(10);
540 status = ca_pend_io(10);
553#ifdef(__QWFEEDBACK_ALLOW_EPICS_CA_PUT)
555 status = ca_pend_io(10);
557 status = ca_pend_io(10);
558 std::cout <<
"Feedback status updated " << value << std::endl;
566 status = ca_pend_io(10);
579 if(plate_status == 1) {
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)
chid fChargeAsymmetryWidth
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)
chid fChargeAsymmetryError
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)
chid fBCM8DDAsymmetryWidth
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)
chid fIDPockels_Cell_plus
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.
chid fHAChargeAsymmetryWidth
chid fHalfWavePlateStatus
chid fHAChargeAsymmetryError
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)
chid fBCM8DDAsymmetryError
chid fIDPockels_Cell_minus
chid fUSLumiSumAsymmetryWidth