BmnRoot
Loading...
Searching...
No Matches
BmnHistStat.h
Go to the documentation of this file.
1/*
2 * Author: Andrei Driuk
3 *
4 * Created on August 14, 2022
5 */
6#ifndef BMNHISTStat_H
7#define BMNHISTStat_H 1
8// STL
9#include <vector>
10// prometheus-cpp
11#ifdef HAVE_PROMCPP
12#include <prometheus/counter.h>
13#include <prometheus/exposer.h>
14#include <prometheus/registry.h>
15#endif
16// ROOT
17#include <TH1.h>
18// BmnRoot
19#include "BmnHist.h"
20#include "BmnMath.h"
21
22using std::string;
23using std::vector;
24// using namespace prometheus;
25
26class BmnHistStat : public BmnHist
27{
28 public:
29 BmnHistStat(TString title, TString path = "");
30 virtual ~BmnHistStat();
31 void Reset();
32 void Register(THttpServer* serv);
33 void SetDir(TFile* outFile = NULL, TTree* recoTree = NULL);
34 void DrawBoth();
35 void FillFromDigi(DigiArrays* fDigiArrays);
38
39 private:
40 void initHistDet();
41 void initHistFD();
42 void initHistBD();
43 void initHistCorr();
44 Int_t getPositionInArray(vector<TClonesArray*>* trigDigits, TString name);
45
46 // BmnStatus SendMetrics();
47 void ResetTimelineCounters();
48
49 void ResetRegistry();
50 void CreateMetrics();
51 void DestroyMetrics();
52 BmnStatus UpdateMetrics();
53
54 vector<TString> NamesStatDet;
55 vector<TString> NamesStatFD;
56 vector<TString> NamesStatBD;
57 vector<TString> NamesStatCorr;
58
59 const int32_t Max_ToF_Cnt = 301;
60 const int32_t Max_GEM_Cnt = 5001;
61 const int32_t Max_FSD_Cnt = 5001;
62 const int32_t Max_CSC_Cnt = 2001;
63 const int32_t Max_FHC_Cnt = 1001;
64
65 const int32_t Max_BD_Cnt = 51;
66
67 const int32_t Max_FD_Sig = 8000;
68
69 TH1I* histGemStat;
70 TH1I* histSiliconStat;
71 TH1I* histTof400Stat;
72 TH1I* histTof700Stat;
73 TH1I* histCscStat;
74 TH1I* histFHCalStat;
75 //===FD vs Det======
76 TH2F* histFDGemStat;
77 TH2F* histFDSiliconStat;
78 TH2F* histFDTof400Stat;
79 TH2F* histFDTof700Stat;
80 TH2F* histFDCscStat;
81 TH2F* histFDFHCalStat;
82 //===BD vs Det======
83 TH2F* histBDGemStat;
84 TH2F* histBDSiliconStat;
85 TH2F* histBDTof400Stat;
86 TH2F* histBDTof700Stat;
87 TH2F* histBDCscStat;
88 TH2F* histBDFHCalStat;
89
90 //===Correlations=====
91 TH2F* histGemSilicon;
92 TH2F* histGemTof400;
93 TH2F* histGemTof700;
94 TH2F* histGemCsc;
95 TH2F* histGemFHCal;
96 TH2F* histCscFHCal;
97
98 TCanvas* canStatDet;
99 TCanvas* canStatFD;
100 TCanvas* canStatBD;
101 TCanvas* canStatCorr;
102 vector<PadInfo*> canStatDetPads;
103 vector<PadInfo*> canStatFDPads;
104 vector<PadInfo*> canStatBDPads;
105 vector<PadInfo*> canStatCorrPads;
106
107 bool varsInitDone;
108 int32_t fdPosition;
109 int32_t bdPosition;
110 int32_t bc1Position;
111
113 const double Min_NBC1 = 100000;
114 uint16_t bit_filter;
115
116 double sum_fsd;
117 double sum_tof400;
118 double sum_tof700;
119 double sum_csc;
120 double sum_fhcal;
121 double sum_gem;
122 double sum_nbc1;
123
124 double nbc1;
125 double fsd2gem;
126 double tof4002gem;
127 double tof7002gem;
128 double csc2gem;
129 double fhcal2gem;
130 double gem2nbc1;
131 uint64_t nevents;
132 SysPoint last_ev_time;
133 SysPoint last_ev_time_show;
134
135 BmnEventType ev_type;
136 BmnEventType ev_type_prev;
137
138#ifdef HAVE_PROMCPP
139 unique_ptr<prometheus::Exposer> exposer;
140 shared_ptr<prometheus::Registry> registry;
141
142 prometheus::Family<prometheus::Gauge>* gauge_family;
143 prometheus::Counter* counter_family;
144 unordered_map<string, prometheus::Gauge*> gauges_by_name;
145 bool registry_init_done;
146 bool metrics_available;
147#endif
148
149 // string pushgateway;
150
151 ClassDef(BmnHistStat, 1)
152};
153
154#endif /* BMNMONHISTS_H */
BmnStatus
Definition BmnEnums.h:24
BmnEventType
Definition BmnEnums.h:69
std::chrono::time_point< SysClock > SysPoint
BmnStatus SetRefRun(Int_t id)
void FillFromDigi(DigiArrays *fDigiArrays)
void SetDir(TFile *outFile=NULL, TTree *recoTree=NULL)
void DrawBoth()
void ClearRefRun()
virtual ~BmnHistStat()
void Reset()
BmnHistStat(TString title, TString path="")
void Register(THttpServer *serv)