Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:21:09

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