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