Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MvtxMon.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MvtxMon.h
1 #ifndef MVTX_MVTXMON_H
2 #define MVTX_MVTXMON_H
3 
4 #include <onlmon/OnlMon.h>
5 
6 #include <TString.h>
7 #include <TPaveText.h>
8 
9 #include <map>
10 #include <cmath>
11 
12 
13 class Event;
14 class TH1;
15 class TH2;
16 class TH1I;
17 class TH2I;
18 class TH3I;
19 class TH1D;
20 class TH2D;
21 class TH2Poly;
22 class map;
23 class pair;
24 
25 class MvtxRawHit;
26 class Packet;
27 
28 class MvtxMon : public OnlMon
29 {
30  public:
31  MvtxMon(const std::string &name);
32  virtual ~MvtxMon();
33 
34  int process_event(Event *evt);
35  int Init();
36  int BeginRun(const int runno);
37  int Reset();
38 
39 
40  protected:
41  int evtcnt = 0;
42  int idummy = 0;
43 
44  static constexpr int NSTAVE = 48;
45  static constexpr int NCHIP = 9;
46  static constexpr int NLAYERS = 3;
47  static constexpr int NFees = 48 * 3;
48  static constexpr int NTrigger = 13;
49  static constexpr int NLanesMax = 9;
50  static constexpr int NCols = 1024;
51  static constexpr int NRows = 512;
53  static constexpr int NFlags = 3;
54 
55  int mMaxGeneralAxisRange = -3; // the range of TH2Poly plots z axis range, pow(10, mMinGeneralAxisRange) ~ pow(10, mMaxGeneralAxisRange)
57  std::string mLaneStatusFlag[NFlags] = { "WARNING", "ERROR", "FAULT" };
58 
59  const int StaveBoundary[4] = { 0, 12, 28, 48};
60  const int LayerBoundaryFEE[NLAYERS - 1] = { 35, 83};
61 
62  TH2 *mvtxmon_ChipStaveOcc= nullptr;
63  TH1 *mvtxmon_ChipStave1D= nullptr;
64  TH1 *mvtxmon_ChipFiredHis= nullptr;
65  TH1 *mvtxmon_EvtHitChip= nullptr;
66  TH1 *mvtxmon_EvtHitDis= nullptr;
67  TH2 *mvtxmon_HitMap[NSTAVE][NCHIP] = {nullptr};
68  TH2Poly* mvtxmon_GeneralOccupancy = nullptr;
69  TH2Poly* mvtxmon_LaneStatusOverview[NFlags] = {nullptr};
70 
71  TH1I* mRCDAQevt= nullptr;
72 
73  TH1I *hChipStrobes = nullptr;
74  TH1I *hChipL1 = nullptr;
75  //fee
76  TH2I* mTriggerVsFeeId= nullptr;
77  TH1I* mTrigger= nullptr;
78  TH2I* mLaneInfo= nullptr;
79  TH2I* mLaneStatus[NFlags] = {nullptr};
80  TH2I* mLaneStatusCumulative[NFlags] = {nullptr};
81  TH1I* mLaneStatusSummary[NLAYERS] = {nullptr};
82  TH1I* mLaneStatusSummaryIB= nullptr;
83  TString mTriggerType[NTrigger] = { "ORBIT", "HB", "HBr", "HC", "PHYSICS", "PP", "CAL", "SOT", "EOT", "SOC", "EOC", "TF", "INT" };
84 
85  //raw task
86  TH1D* hErrorPlots= nullptr;
87  TH2D* hErrorFile= nullptr;
88  TH1D* hOccupancyPlot[NLAYERS] = {nullptr};
89  TH2I* hEtaPhiHitmap[NLAYERS] = {nullptr};
90  TH2D* hChipStaveOccupancy[NLAYERS] = {nullptr};
91  TH3I* hChipHitmap = nullptr;
92  TH3I* hChipHitmap_evt = nullptr;
93 
94  //fhr
95  TH2I* mErrorVsFeeid= nullptr;
96  TH2Poly* mGeneralOccupancy= nullptr;
97  TH2Poly* mGeneralNoisyPixel= nullptr;
98  TH2D* mDeadChipPos[NLAYERS] = {nullptr};
99  TH2D* mAliveChipPos[NLAYERS] = {nullptr};
100  TH2D* mTotalDeadChipPos= nullptr;
101  TH2D* mTotalAliveChipPos= nullptr;
102  TH2D* mChipStaveOccupancy[NLAYERS] = {nullptr};
103  TH1D* mOccupancyPlot[NLAYERS] = {nullptr};
104  TH2D* hChipStaveNoisy[NLAYERS] = {nullptr};
105 
107  int mNoisyPixelNumber[3][20][9] = { { 0 } };
108 
109  static constexpr int NError = 11;
110  static constexpr int NErrorExtended = 19;
111 
112  /* TString ErrorType[NError] = { "Error ID 1: ErrPageCounterDiscontinuity", "Error ID 2: ErrRDHvsGBTHPageCnt",
113  "Error ID 3: ErrMissingGBTHeader", "Error ID 4: ErrMissingGBTTrailer", "Error ID 5: ErrNonZeroPageAfterStop",
114  "Error ID 6: ErrUnstoppedLanes", "Error ID 7: ErrDataForStoppedLane", "Error ID 8: ErrNoDataForActiveLane",
115  "Error ID 9: ErrIBChipLaneMismatch", "Error ID 10: ErrCableDataHeadWrong",
116  "Error ID 11: Jump in RDH_packetCounter" };*/
117 
118  TString ErrorType[NError] = { "Error ID 1", "Error ID 2",
119  "Error ID 3", "Error ID 4", "Error ID 5",
120  "Error ID 6", "Error ID 7", "Error ID 8",
121  "Error ID 9", "Error ID 10",
122  "Error ID 11" };
123 
124 
125  const int NFiles = 6;
126  int ntriggers = 0;
127 
128 
129  const int NStaves[3] = { 12, 16, 20 };
130  const float StartAngle[3] = { 16.997 / 360 * (M_PI * 2.), 17.504 / 360 * (M_PI * 2.), 17.337 / 360 * (M_PI * 2.)}; // start angle of first stave in each layer
131  const float MidPointRad[3] = { 23.49, 31.586, 39.341};
132 
133  const int mapstave[3][20] = {{10,11,12,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,0},{25,26,27,28,13,14,15,16,17,18,19,20,21,22,23,24,0,0,0,0},{44,45,46,47,48,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43}};
134 
135 
136  typedef struct linkId
137 {
138  uint32_t layer = 0xFF;
139  uint32_t stave = 0xFF;
140  uint32_t gbtid = 0xFF;
141 } LinkId_t;
142 
143  LinkId_t DecodeFeeid(const uint16_t& feeid)
144  {
145  LinkId_t ret = {};
146  ret.layer = (feeid >> 12) & 0x7;
147  ret.stave = feeid & 0x1F;
148  ret.gbtid = (feeid >> 8) & 0x3;
149  return ret;
150  }
151 
152  private:
153  unsigned short decode_row(int hit){ return hit >> 16;}
154  unsigned short decode_col(int hit){ return hit & 0xffff;}
155  void getStavePoint(int layer, int stave, double* px, double* py);
156  void drawLayerName(TH2* histo2D);
157  void createPoly(TH2Poly *h);
158 
159  Packet **plist = nullptr;
160  /*unsigned int m_NumSpecialEvents = 0;
161  std::map<uint64_t, std::set<int>> m_BeamClockFEE;
162  std::map<uint64_t, std::vector<MvtxRawHit *>> m_MvtxRawHitMap;
163  std::map<int, uint64_t> m_FEEBclkMap;
164  std::map<int, uint64_t> m_FeeStrobeMap;
165  std::set<uint64_t> m_BclkStack;
166  std::set<uint64_t> gtmL1BcoSet;*/
167 
168 
169 };
170 
171 
172 #endif /* MVTX_MVTXMON_H */