Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:39

0001 ///////////////////////////////////////////////////////////////
0002 //
0003 // SpinDBContent class
0004 // Author      : D. Loomis, D. Neff (from Y. Fukao PHENIX class)
0005 // Description : Content of spin database
0006 // Created     : 2024-05-12
0007 //
0008 // ERROR_VALUE       : Error value
0009 // NCROSS            : Number of crossing (120)
0010 // runnum            : Run number
0011 // qa_level          : Level of QA for stored data.
0012 // fillnum           : Fill number
0013 // badrun            : Run QA by spin analysis, 1:bad 0:good
0014 // cross_shift       : Crossing sfhit, corrected=(raw+cross_shift)%NCROSS
0015 // bpol              : Blue beam polarization
0016 // bpolerr           : Blue beam polarization error
0017 // bpolsys           : Blue beam polarization systematic error
0018 // ypol              : Yellow beam polarization
0019 // ypolerr           : Yellow beam polarization error
0020 // ypolsys           : Yellow beam polarization systematic error
0021 // bpat              : Spin pattern at IP12. (NOT at sPHENIX)
0022 // ypat              : Spin pattern at IP12. (NOT at sPHENIX)
0023 // scaler_mbd_vtxcut : scaler (MBD VTX)
0024 // scaler_mbd_nocut  : scaler (MBD NS)
0025 // scaler_zdc_nocut  : scaler (ZDC NS)
0026 // bad_bunch         : Bad bunch QA, 0:good else:bad
0027 // cross_angle       : Average relative crossing angle between blue and yellow beams in mrad for run. Sign is dictated by CAD convention, can be + or -
0028 // cross_angle_std   : Standard deviation of relative crossing angle in mrad
0029 // cross_angle_min   : Minimum value of relative crossing angle in mrad
0030 // cross_angle_max   : Maximum value of relative crossing angle in mrad
0031 // asym_bf           : very forward neutron TSSA magnitude in blue beam
0032 // asym_bb           : very backward neutron TSSA magnitude in blue beam 
0033 // asym_yf           : very forward neutron TSSA magnitude in yellow beam
0034 // asym_yb           : very backward neutron TSSA magnitude in yellow beam 
0035 // asymerr_bf        : very forward neutron TSSA magnitude uncertainty in blue beam
0036 // asymerr_bb        : very backward neutron TSSA magnitude uncertainty in blue beam 
0037 // asymerr_yf        : very forward neutron TSSA magnitude uncertainty in yellow beam
0038 // asymerr_yb        : very backward neutron TSSA magnitude uncertainty in yellow beam 
0039 // phase_bf          : very forward neutron TSSA phase offset in blue beam
0040 // phase_bb          : very backward neutron TSSA phase offset in blue beam 
0041 // phase_yf          : very forward neutron TSSA phase offset in yellow beam
0042 // phase_yb          : very backward neutron TSSA phase offset in yellow beam 
0043 // phaseerr_bf       : very forward neutron TSSA phase offset uncertainty in blue beam
0044 // phaseerr_bb       : very backward neutron TSSA phase offset uncertainty in blue beam 
0045 // phaseerr_yf       : very forward neutron TSSA phase offset uncertainty in yellow beam
0046 // phaseerr_yb       : very backward neutron TSSA phase offset uncertainty in yellow beam 
0047 
0048 
0049 ////////////////////////////////////////////////////////////////
0050 
0051 #ifndef USPIN_SPINDBCONTENT_H
0052 #define USPIN_SPINDBCONTENT_H
0053 
0054 //#include <stdio.h>
0055 //#include <iostream>
0056 
0057 class SpinDBContent
0058 {
0059  public:
0060   SpinDBContent() { Initialize(); }
0061   virtual ~SpinDBContent() { ; }
0062   void Initialize();
0063   static int GetNCrossing() { return (NCROSS); }
0064   static int GetErrorValue() { return (ERROR_VALUE); }
0065   int CheckBunchNumber(int bunch);
0066   void Print() const;
0067 
0068   int GetRunNumber() { return (runnum); }
0069   int GetQALevel() { return (qa_level); }
0070   int GetFillNumber() { return (fillnum); }
0071   int GetBadRunFlag() { return (badrun); }
0072   int GetCrossingShift() { return (cross_shift); }
0073 
0074   int GetPolarizationBlue(int bunch, float &value, float &error);
0075   int GetPolarizationBlue(int bunch, float &value, float &error, float &syserr);
0076   int GetPolarizationBlue(int bunch, double &value, double &error);
0077   int GetPolarizationBlue(int bunch, double &value, double &error, double &syserr);
0078   int GetPolarizationYellow(int bunch, float &value, float &error);
0079   int GetPolarizationYellow(int bunch, float &value, float &error, float &syserr);
0080   int GetPolarizationYellow(int bunch, double &value, double &error);
0081   int GetPolarizationYellow(int bunch, double &value, double &error, double &syserr);
0082   int GetSpinPatternBlue(int bunch);
0083   int GetSpinPatternYellow(int bunch);
0084   long long GetScalerMbdVertexCut(int bunch);
0085   long long GetScalerMbdNoCut(int bunch);
0086   long long GetScalerZdcNoCut(int bunch);
0087   long long GetScaler(int channel, int bunch);
0088   int GetBadBunchFlag(int bunch);
0089 
0090   void GetAsymBlueForward(float &value, float &error);
0091   void GetAsymBlueBackward(float &value, float &error);
0092   void GetAsymYellowForward(float &value, float &error);
0093   void GetAsymYellowBackward(float &value, float &error);
0094   void GetPhaseBlueForward(float &value, float &error);
0095   void GetPhaseBlueBackward(float &value, float &error);
0096   void GetPhaseYellowForward(float &value, float &error);
0097   void GetPhaseYellowBackward(float &value, float &error);
0098 
0099   float GetCrossAngle() { return cross_angle; }
0100   float GetCrossAngleStd() { return cross_angle_std; }
0101   float GetCrossAngleMin() { return cross_angle_min; }
0102   float GetCrossAngleMax() { return cross_angle_max; }
0103 
0104   void SetRunNumber(int run)
0105   {
0106     runnum = run;
0107     return;
0108   }
0109   void SetQALevel(int qa)
0110   {
0111     qa_level = qa;
0112     return;
0113   }
0114   void SetFillNumber(int fill)
0115   {
0116     fillnum = fill;
0117     return;
0118   }
0119   void SetBadRunFlag(int flag)
0120   {
0121     badrun = flag;
0122     return;
0123   }
0124   void SetCrossingShift(int shift)
0125   {
0126     cross_shift = shift;
0127     return;
0128   }
0129   int SetPolarizationBlue(int bunch, float value, float error);
0130   int SetPolarizationYellow(int bunch, float value, float error);
0131   int SetPolarizationBlue(int bunch, float value, float error, float syserr);
0132   int SetPolarizationYellow(int bunch, float value, float error, float syserr);
0133   int SetSpinPatternBlue(int bunch, int value);
0134   int SetSpinPatternYellow(int bunch, int value);
0135   int SetScalerMbdVertexCut(int bunch, long long value);
0136   int SetScalerMbdNoCut(int bunch, long long value);
0137   int SetScalerZdcNoCut(int bunch, long long value);
0138   int SetScaler(int channel, int bunch, long long value);
0139   int SetBadBunchFlag(int bunch, int value);
0140 
0141   void SetAsymBlueForward(float value, float error);
0142   void SetAsymBlueBackward(float value, float error);
0143   void SetAsymYellowForward(float value, float error);
0144   void SetAsymYellowBackward(float value, float error);
0145   void SetPhaseBlueForward(float value, float error);
0146   void SetPhaseBlueBackward(float value, float error);
0147   void SetPhaseYellowForward(float value, float error);
0148   void SetPhaseYellowBackward(float value, float error);
0149 
0150   void SetCrossAngle(float value) { cross_angle = value; }
0151   void SetCrossAngleStd(float value) { cross_angle_std = value; }
0152   void SetCrossAngleMin(float value) { cross_angle_min = value; }
0153   void SetCrossAngleMax(float value) { cross_angle_max = value; }
0154 
0155 
0156   
0157 
0158 
0159 
0160  private:
0161   static const int NCROSS;
0162   static const int ERROR_VALUE;
0163 
0164   int runnum;
0165   int qa_level;
0166   int fillnum;
0167   int badrun;
0168   int cross_shift;
0169   float bpol[120];
0170   float bpolerr[120];
0171   float bpolsys[120];
0172   float ypol[120];
0173   float ypolerr[120];
0174   float ypolsys[120];
0175   int bpat[120];
0176   int ypat[120];
0177   long long scaler_mbd_vtxcut[120];
0178   long long scaler_mbd_nocut[120];
0179   long long scaler_zdc_nocut[120];
0180   int bad_bunch[120];
0181   float cross_angle;
0182   float cross_angle_std;
0183   float cross_angle_min;
0184   float cross_angle_max;
0185   float asym_bf;
0186   float asym_bb;
0187   float asym_yf;
0188   float asym_yb;
0189   float asymerr_bf;
0190   float asymerr_bb;
0191   float asymerr_yf;
0192   float asymerr_yb;
0193   float phase_bf;
0194   float phase_bb;
0195   float phase_yf;
0196   float phase_yb;
0197   float phaseerr_bf;
0198   float phaseerr_bb;
0199   float phaseerr_yf;
0200   float phaseerr_yb;
0201 };
0202 
0203 #endif /* USPIN_SPINDBCONTENT_H */