File indexing completed on 2025-08-03 08:16:17
0001
0002
0003 #ifndef XINGSHIFT_XINGSHIFTCAL_H
0004 #define XINGSHIFT_XINGSHIFTCAL_H
0005
0006 #include <fun4all/SubsysReco.h>
0007
0008 #include <map>
0009 #include <cstdint>
0010 #include <string>
0011
0012 class PHCompositeNode;
0013 class Packet;
0014
0015 class XingShiftCal : public SubsysReco
0016 {
0017 static const int NTRIG = 6;
0018 static const int NBUNCHES = 120;
0019
0020 public:
0021 XingShiftCal(const std::string &name = "XingShiftCal", const int poverwriteSpinEntry = 0);
0022
0023 ~XingShiftCal() override;
0024
0025 int Init(PHCompositeNode *topNode) override;
0026 int InitRun(PHCompositeNode *topNode) override;
0027 int process_event(PHCompositeNode *topNode) override;
0028 int ResetEvent(PHCompositeNode *topNode) override;
0029
0030 int End(PHCompositeNode *topNode) override;
0031 int Reset(PHCompositeNode * ) override;
0032
0033 void Print(const std::string &what = "ALL") const override;
0034
0035 int Calibrate(const int final = 0);
0036 int CalculateCrossingShift(int &xingshift, uint64_t counts[NTRIG][NBUNCHES], bool &success);
0037 int WriteToCDB(const std::string &fname);
0038 int CommitToSpinDB();
0039 int SpinDBQA();
0040 std::string SQLArrayConstF(float x, int n);
0041
0042 private:
0043 Packet *p{nullptr};
0044
0045
0046
0047 Packet *pBluePol{nullptr};
0048 Packet *pYellPol{nullptr};
0049 Packet *pBlueAsym {nullptr};
0050 Packet *pYellAsym {nullptr};
0051 Packet *pBlueIntPattern{nullptr};
0052 Packet *pYellIntPattern{nullptr};
0053 Packet *pBluePolPattern{nullptr};
0054 Packet *pYellPolPattern{nullptr};
0055 Packet *pBlueFillNumber{nullptr};
0056 Packet *pYellFillNumber{nullptr};
0057
0058 int nevt{0};
0059 int threshold{1000};
0060 int evtcap{50000};
0061 int done{0};
0062
0063
0064
0065
0066 const int packet_BLUEPOL{14905};
0067 const int packet_BLUEASYM {14906};
0068 const int packet_YELLPOL{14907};
0069 const int packet_YELLASYM {14908};
0070 const int packet_BLUEINTPATTERN{14910};
0071 const int packet_BLUEPOLPATTERN{14911};
0072 const int packet_YELLINTPATTERN{14912};
0073 const int packet_YELLPOLPATTERN{14913};
0074 const int packet_BLUEFILLNUMBER{14915};
0075 const int packet_YELLFILLNUMBER{14916};
0076 const int packet_GL1{14001};
0077
0078 int runnumber{0};
0079 bool success{0};
0080 int commitSuccessCDB{0};
0081 int commitSuccessSpinDB{0};
0082 int overwriteSpinEntry{0};
0083
0084
0085 int xingshift{0};
0086
0087 int blueSpinPattern[NBUNCHES]{0};
0088 int yellSpinPattern[NBUNCHES]{0};
0089 int blueFillPattern[NBUNCHES]{0};
0090 int yellFillPattern[NBUNCHES]{0};
0091
0092 int bluePcSpinPattern[NBUNCHES]{0};
0093 int yellPcSpinPattern[NBUNCHES]{0};
0094
0095 float polBlue{0};
0096 float polBlueErr{0};
0097 float polYellow{0};
0098 float polYellowErr{0};
0099
0100 int fillnumberBlue{0};
0101 int fillnumberYellow{0};
0102
0103 uint64_t scalercounts[NTRIG][NBUNCHES]{};
0104
0105 int64_t mbdns[NBUNCHES]{0};
0106 int64_t mbdvtx[NBUNCHES]{0};
0107 int64_t zdcns[NBUNCHES]{0};
0108
0109
0110 std::map<std::string, std::string> preset_pattern_blue;
0111 std::map<std::string, std::string> preset_pattern_yellow;
0112
0113
0114
0115 };
0116
0117 #endif