7#ifndef __QwHelicityCorrelatedFeedback__
8#define __QwHelicityCorrelatedFeedback__
64 for(Int_t i=0;i<4;i++){
77 fAsymBCM7.InitializeChannel(
"bcm7",
"derived");
78 fAsymBCM8.InitializeChannel(
"bcm8",
"derived");
104 out_file_IA = fopen(
"/local/scratch/qweak/Feedback_IA_log.txt",
"a");
108 fprintf(
out_file_IA,
"Pat num. \t A_q[mode]\t IA Setpoint \t IA Previous Setpoint \n");
112 out_file_PITA = fopen(
"/local/scratch/qweak/Feedback_PITA_log.txt",
"a");
113 out_file_HA_IA = fopen(
"/local/scratch/qweak/Feedback_HA_IA_log.txt",
"a");
116 "%10s %22s +- %16s %16s %26s %26s %26s %26s\n",
117 "Pat num.",
"Charge Asym [ppm]",
"Asym Error",
"Correction",
118 "New PITA Setpoint[+]",
"Old PITA Setpoint[+]",
119 "New PITA Setpoint[-]",
"Old PITA Setpoint[-]");
124 "%10s %22s %16s %16s %26s %23s \n",
125 "Pat num.",
"Charge Asym(ppm)",
"Asym Error",
"Correction",
126 "New IA Setpoint",
"Old IA Setpoint");
Base and derived classes for scaler channel data handling.
class QwScaler_Channel< 0x00ffffff, 0 > QwSIS3801D24_Channel
Parameter file parsing and management.
Decoding and management for VQWK ADC channels (6x32-bit datawords)
class QwMollerADC_Channel QwBeamCharge
Helicity pattern analysis and management.
QwBeamCharge fTargetCharge
Double_t GetChargeAsym()
Returns the charge asymmetry stats when required by feedback caluculations.
QwBeamCharge fYieldBCM8RunningSum
void LoadParameterFile(TString filename)
Load deltaA_q, no.of good patterns to accumulate and other neccessary feedback parameters.
Double_t fPITA_MIN_Charge_asym
void GetTargetPositionStat()
retrieves the target position angle parameters (X,XP,Y,YP) mean, error and width
Bool_t fInitialCorrection
QwBeamCharge fRunningCharge
QwBeamCharge fPreviousChargeAsymmetry
Int_t fHAAccumulatePatternMax
void FeedPCNeg()
Feed the IA set point based on the charge asymmetry.
Double_t fTargetYPDiffError
Double_t fTargetXPDiffWidth
Double_t fPrevHAIASetpoint[kHelModes]
Double_t fTargetYDiffWidth
QwBeamCharge fIAAsymmetry0
void FeedPITASetPoints()
Feed the Hall C PITA set point based on the charge asymmetry.
void GetTargetChargeStat()
retrieves the target charge asymmetry,asymmetry error ,asymmetry width
Double_t fPITASetpointPOS_t0_IN
Bool_t IsHAPatternsAccumulated()
Check to see no.of good patterns accumulated after the last position/angle feedback correction.
Double_t fPrevIASetpoint[kHelModes]
QwBeamCharge fTargetXPDiffRunningSum
void ApplyFeedbackCorrections()
Check neccessary conditions and apply IA setponts based on the charge asym for all four modes.
Double_t fAsymBCMUSLumiSumWidth
void UpdateGMClean(Int_t state)
Set Clean=0 or 1 in the GreenMonster.
Bool_t ApplyIAFeedback(Int_t mode)
Initiates the IA feedback if the Hall C charge asymmetry have passed the quality cut.
Double_t fTargetYPDiffWidth
Double_t fIASetpoint[kHelModes]
Double_t fChargeAsymmetry
QwBeamCharge f3C12YQRunningSum
QwBeamCharge f3C12XDiffRunningSum
void LogParameters()
Log the last PITA feedback information.
Int_t fAccumulatePatternMax
void ProcessOptions(QwOptions &options)
Process the configuration options.
Double_t fPrevPITASetpointPOS
QwBeamCharge fChargeAsymmetry0
Double_t fChargeAsymWidth[kHelModes]
Double_t fDelta_IASlopeA[kHelModes]
void FillTreeVector(std::vector< Double_t > &values) const
Double_t fIASlopeA[kHelModes]
Bool_t ApplyHMFeedback()
Initiates the Helicity magnet feedback if the position differences and/or angle differences have pass...
QwBeamCharge fTargetYDiffRunningSum
void FeedHAIASetPoint(Int_t mode)
Feed the Hall A IA set point based on the charge asymmetry.
void GetHAChargeStat(Int_t mode)
retrieves the Hall A charge asymmetry,asymmetry error ,asymmetry width for given mode
void LogPFParameters()
Log the Pos/angle information.
Double_t fPITASetpointNEG
Double_t fPITASetpointNEG_t0_OUT
Double_t fAsymBCM78DDWidth
Double_t fPITASetpointPOS
Int_t GetLastGoodHelicityPatternType()
Returns the type of the last helicity pattern based on following pattern history.
Double_t fHADelta_IASlopeA[kHelModes]
void CheckFeedbackStatus()
QwEPICSControl fEPICSCtrl
Create an EPICS control event.
Double_t GetChargeAsymError()
UInt_t GetHalfWavePlate2State()
static const Int_t kHelPat1
UInt_t fPreviousHalfWavePlateStatus
void CalculateRunningAverage()
QwBeamCharge fCurrentChargeAsymmetry
~QwHelicityCorrelatedFeedback()
QwBeamCharge fTargetYPDiffRunningSum
QwBeamCharge fPreviousIAAsymmetry
FILE * out_file_PC_IN_neg
Bool_t IsPatternsAccumulated()
Check to see no.of good patterns accumulated after the last feedback is greater than a set value.
FILE * out_file_PC_OUT_neg
QwBeamCharge fTargetParameter
Bool_t ApplyHAIAFeedback()
Initiates the Hall A IA feedback if the Hall A charge asymmetry passed the quality cut.
QwBeamCharge fAsymBCM78DDRunningSum
Double_t fPITASetpointNEG_t0_IN
Bool_t ApplyPITAFeedback()
Initiates the PITA feedback if the charge asymmetry passed the quality cut.
Double_t fAsymBCMUSLumiSumError
Int_t fHAGoodPatternCounter
Double_t fHAChargeAsym[kHelModes]
static const Int_t kHelPat2
QwBeamCharge fCurrentIAAsymmetry
Int_t fPFAccumulatePatternMax
Double_t fHAIASlopeA[kHelModes]
Double_t GetChargeAsymWidth()
Double_t fTargetXPDiffError
Double_t fChargeAsymmetryWidth
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Double_t fPITASetpointPOS_t0_OUT
Double_t fAsymBCMUSLumiSum
Bool_t IsPFPatternsAccumulated()
Check to see no.of good patterns accumulated after the last position/angle feedback correction.
void LogHAParameters(Int_t mode)
Log the last Hall A IA feedback information.
QwBeamCharge fTargetXDiffRunningSum
void FeedIASetPoint(Int_t mode)
Feed the Hall C IA set point based on the charge asymmetry.
QwSIS3801D24_Channel fScalerCharge
QwBeamCharge fAsymUSLumiSumRunningSum
TString fHalfWavePlateStatus
UInt_t fDefaultHalfWavePlateStatus
QwBeamCharge f3C12YDiffRunningSum
TString GetHalfWavePlateState()
The types of helicity patterns based on following pattern history.
Double_t fChargeAsym[kHelModes]
void FeedPCPos()
Feed the IA set point based on the charge asymmetry.
QwHelicityCorrelatedFeedback(QwSubsystemArrayParity &event)
void AccumulateRunningSum()
Int_t fPFGoodPatternCounter
void UpdateGMScanParameters()
Update last feedback setting into scan variables in the GreenMonster.
FILE * out_file_PC_OUT_pos
Double_t fTargetXDiffWidth
Double_t fTargetYDiffError
Int_t fGoodPatternCounter
static const Int_t kHelModes
Double_t fChargeAsymPrecision
Double_t fPITASlopeOUT_IN
Double_t fPITASetpointlow
Double_t fPrevPITASetpointNEG
Double_t fChargeAsymmetryError
Double_t fTargetXDiffError
Double_t fHAChargeAsymWidth[kHelModes]
static void DefineOptions(QwOptions &options)
Define the configuration options.
FILE * out_file_PC_IN_pos
Double_t fHAIASetpoint[kHelModes]
std::vector< QwSubsystemArrayParity > fFBRunningAsymmetry
Double_t fChargeAsymError[kHelModes]
Double_t fHAChargeAsymError[kHelModes]
void CalculateAsymmetry()
inherited from QwHelicityPattern
std::vector< Int_t > fHelModeGoodPatternCounter
Double_t fAsymBCM78DDError
QwSIS3801D24_Channel fScalerChargeRunningSum
Command-line and configuration file options processor.
QwHelicityPattern()
Private default constructor (not implemented, will throw linker error on use)
Subsystem array container specialized for parity analysis with asymmetry calculations.