File indexing completed on 2025-08-03 08:21:00
0001 #ifndef CEMC_CEMCMONDRAW_H
0002 #define CEMC_CEMCMONDRAW_H
0003
0004 #include <onlmon/OnlMonDraw.h>
0005
0006 #include <Rtypes.h>
0007 #include <TColor.h>
0008
0009 #include <iostream> // for cout, endl
0010 #include <ostream> // for operator<<, basic_ostream, ostream
0011 #include <string> // for allocator, string
0012 #include <vector>
0013
0014 class TCanvas;
0015 class TGraphErrors;
0016 class TH1;
0017 class TH2;
0018 class TPad;
0019 class TProfile;
0020 class TProfile2D;
0021 class TStyle;
0022
0023 class CemcMonDraw : public OnlMonDraw
0024 {
0025 public:
0026 explicit CemcMonDraw(const std::string &name = "CEMCMON");
0027
0028 ~CemcMonDraw() override {}
0029
0030 int Init() override;
0031 int Draw(const std::string &what = "ALL") override;
0032 int MakeHtml(const std::string &what = "ALL") override;
0033 int SavePlot(const std::string &what = "ALL", const std::string &type = "png") override;
0034 void setSave(int s) { save = s; }
0035
0036
0037 private:
0038 int MakeCanvas(const std::string &name);
0039 int DrawFirst(const std::string &what = "ALL");
0040 int DrawAllTrigHits(const std::string &what = "ALL");
0041 int DrawSecond(const std::string &what = "ALL");
0042 int DrawThird(const std::string &what = "ALL");
0043 int DrawFourth(const std::string &what = "ALL");
0044 int DrawFifth(const std::string &what = "ALL");
0045 int DrawSixth(const std::string &what = "ALL");
0046 int DrawSeventh(const std::string &what = "ALL");
0047 int DrawHistory(const std::string &what = "ALL");
0048 int DrawBadChi2(const std::string &what = "ALL");
0049 int DrawNoiseRMS(const std::string &what = "ALL");
0050 int DrawServerStats();
0051
0052 int FindHotTower(TPad *warn, TH2 *, bool usetemplate = true);
0053 int FindGainMode(TPad *warn, TH2 *);
0054 std::vector<int> getBadPackets(TH1 *hist, int what, float cutoff);
0055
0056 const int nTowersEta{96};
0057 const int nTowersPhi{256};
0058 const int templateDepth{10000};
0059 const double SampleLowBoundary{4.5};
0060 const double SampleHighBoundary{7.5};
0061 int save{0};
0062
0063 TCanvas *TC[19]{nullptr};
0064
0065 TPad *transparent[19]{nullptr};
0066 TPad *Pad[90]{nullptr};
0067 TPad *warning[29]{nullptr};
0068
0069
0070
0071 TGraphErrors *gr[2]{nullptr};
0072
0073
0074 TH2 *h2_template_hit{nullptr};
0075 TH2 *h_cemc_datahits{nullptr};
0076 TH2 *h2_template_hit_alltrig{nullptr};
0077 TH2 *h2_noiserms{nullptr};
0078 TProfile2D *p2_noiserms{nullptr};
0079 TStyle *cemcStyle{nullptr};
0080
0081 TH1 *h1_zs {nullptr};
0082 TH1 *h1_zs_low {nullptr};
0083 TH1 *h1_zs_high {nullptr};
0084 Int_t ZSPalette[255] {0};
0085
0086 void MakeZSPalette()
0087 {
0088 if(ZSPalette[0] > 0) return;
0089 Double_t red[9] = {1.0, 0.0592, 0.0780, 0.0232, 0.1802, 0.5301, 0.8186, 0.9956, 0.9764};
0090 Double_t green[9] = {0.0, 0.3599, 0.5041, 0.6419, 0.7178, 0.7492, 0.7328, 0.7862, 0.9832};
0091 Double_t blue[9] = {0.0, 0.8684, 0.8385, 0.7914, 0.6425, 0.4662, 0.3499, 0.1968, 0.0539};
0092 Double_t stops[9] = {0.0, 0.04, 0.12, 0.15, 0.2, 0.25, 0.3, 0.35, 1.0000};
0093 Int_t nb = 255;
0094 Int_t FI = TColor::CreateGradientColorTable(9, stops, red, green, blue, nb, 1.);
0095
0096 for (int i = 0; i < nb; i++)
0097 {
0098 ZSPalette[i] = FI + i;
0099 }
0100 }
0101
0102 std::set<std::pair<int, int>> hotChannels = {{4, 24}, {4, 56}, {83, 179}, {51, 253}};
0103 };
0104
0105 #endif