19 Name(
"OnlMonMainDaq");
31 h1_trig =
new TH1D(
"h1_trig",
"Trigger Status;Trigger;N of events", 10, 0.5, 10.5);
32 h1_n_taiwan =
new TH1D(
"h1_n_taiwan",
"Taiwan TDC Status;N of boards/event;N of events", 200, -0.5, 199.5);
33 h1_evt_qual =
new TH1D(
"h1_evt_qual",
"Event Status;Event-quality bit;N of events", 33, -0.5, 32.5);
34 h1_flag_v1495 =
new TH1D(
"h1_flag_v1495",
"V1495 Status;v1495 status bit; N of v1495 events", 5, -0.5, 4.5);
35 h1_cnt =
new TH1D(
"h1_cnt",
";Type;Count", 15, 0.5, 15.5);
37 h1_trig->GetXaxis()->SetBinLabel( 1,
"FPGA1");
38 h1_trig->GetXaxis()->SetBinLabel( 2,
"FPGA2");
39 h1_trig->GetXaxis()->SetBinLabel( 3,
"FPGA3");
40 h1_trig->GetXaxis()->SetBinLabel( 4,
"FPGA4");
41 h1_trig->GetXaxis()->SetBinLabel( 5,
"FPGA5");
42 h1_trig->GetXaxis()->SetBinLabel( 6,
"NIM1");
43 h1_trig->GetXaxis()->SetBinLabel( 7,
"NIM2");
44 h1_trig->GetXaxis()->SetBinLabel( 8,
"NIM3");
45 h1_trig->GetXaxis()->SetBinLabel( 9,
"NIM4");
46 h1_trig->GetXaxis()->SetBinLabel(10,
"NIM5");
49 h1_evt_qual->GetXaxis()->SetBinLabel(1,
"OK");
50 for (
int ii = 1; ii <= 32; ii++) {
51 oss.str(
""); oss << ii;
52 h1_evt_qual->GetXaxis()->SetBinLabel(ii+1, oss.str().c_str());
55 h1_flag_v1495->GetXaxis()->SetBinLabel(1,
"OK");
56 h1_flag_v1495->GetXaxis()->SetBinLabel(2,
"d1ad");
57 h1_flag_v1495->GetXaxis()->SetBinLabel(3,
"d2ad");
58 h1_flag_v1495->GetXaxis()->SetBinLabel(4,
"d3ad");
59 h1_flag_v1495->GetXaxis()->SetBinLabel(5,
"Other");
61 RegisterHist(h1_trig);
62 RegisterHist(h1_n_taiwan);
63 RegisterHist(h1_evt_qual);
64 RegisterHist(h1_flag_v1495);
72 SQRun*
run = findNode::getClass<SQRun >(topNode,
"SQRun");
73 SQEvent*
event = findNode::getClass<SQEvent>(topNode,
"SQEvent");
94 h1_cnt->SetBinContent( 8, run->
get_n_hit ());
103 h1_n_taiwan->Fill(event->get_n_board_taiwan());
105 int dq =
event->get_data_quality();
106 if (dq == 0) h1_evt_qual->Fill(0);
107 for (
int bit = 0; bit < 32; bit++) {
108 if ((dq >> bit) & 0x1) h1_evt_qual->Fill(bit + 1);
111 int v1495 =
event->get_flag_v1495();
112 if (v1495 == 0) h1_flag_v1495->Fill(0);
113 for (
int bit = 0; bit < 4; bit++) {
114 if ((v1495 >> bit) & 0x1) h1_flag_v1495->Fill(bit + 1);
127 h1_trig = FindMonHist(
"h1_trig");
128 h1_n_taiwan = FindMonHist(
"h1_n_taiwan");
129 h1_evt_qual = FindMonHist(
"h1_evt_qual");
130 h1_flag_v1495 = FindMonHist(
"h1_flag_v1495");
131 h1_cnt = FindMonHist(
"h1_cnt");
132 return (h1_trig && h1_evt_qual && h1_flag_v1495 && h1_cnt ? 0 : 1);
147 TPad* pad11 =
new TPad(
"pad11",
"", 0.0, 0.0, 0.6, 1.0);
148 TPad* pad12 =
new TPad(
"pad12",
"", 0.6, 0.0, 1.0, 1.0);
151 pad11->cd(); h1_trig->Draw();
152 pad12->cd(); h1_flag_v1495->Draw();
155 TPad* pad21 =
new TPad(
"pad21",
"", 0.0, 0.0, 0.7, 1.0);
156 TPad* pad22 =
new TPad(
"pad22",
"", 0.7, 0.0, 1.0, 1.0);
159 pad21->cd(); h1_evt_qual->Draw();
160 pad22->cd(); h1_n_taiwan->Draw();
163 TPaveText* pate =
new TPaveText(.02, .02, .98, .98);
165 oss <<
"N of spill-counter events = " << h1_cnt->GetBinContent(1);
166 pate->AddText(oss.str().c_str());
168 oss <<
"N of triggered events = " << h1_cnt->GetBinContent(2) <<
" (all), " << h1_cnt->GetBinContent(3) <<
" (decoded)";
169 pate->AddText(oss.str().c_str());
171 double n_all = h1_cnt->GetBinContent(4);
172 double n_bad = h1_cnt->GetBinContent(5);
174 oss <<
"N of Coda physics events = " << n_all <<
" (all), " << n_bad <<
" (bad)";
175 pate->AddText(oss.str().c_str());
177 n_all = h1_cnt->GetBinContent(6);
178 n_bad = h1_cnt->GetBinContent(7);
180 oss <<
"N of Coda flush events = " << n_all <<
" (all), " << n_bad <<
" (bad)";
181 pate->AddText(oss.str().c_str());
182 if (n_bad / n_all > 0.05) {
184 can->
AddMessage(
"Errors in >5% of Coda flush events.");
185 }
else if (n_bad / n_all > 0.01) {
187 can->
AddMessage(
"Errors in >1% of Coda flush events.");
190 n_all = h1_cnt->GetBinContent(8);
191 n_bad = h1_cnt->GetBinContent(10);
193 oss <<
"N of Taiwan TDC hits = " << n_all <<
" (all), " << n_bad <<
" (bad)";
194 pate->AddText(oss.str().c_str());
195 if (n_bad / n_all > 0.05) {
197 can->
AddMessage(
"Errors in >5% of Taiwan TDC hits.");
198 }
else if (n_bad / n_all > 0.01) {
200 can->
AddMessage(
"Errors in >1% of Taiwan TDC hits.");
203 n_all = h1_cnt->GetBinContent(9);
204 n_bad = h1_cnt->GetBinContent(11);
206 oss <<
"N of v1495 TDC hits = " << n_all <<
" (all), " << n_bad <<
" (bad)";
207 pate->AddText(oss.str().c_str());
208 if (n_bad / n_all > 0.05) {
210 can->
AddMessage(
"Errors in >5% of v1495 TDC hits.");
211 }
else if (n_bad / n_all > 0.01) {
213 can->
AddMessage(
"Errors in >1% of v1495 TDC hits.");
216 n_all = h1_cnt->GetBinContent(12);
217 double n_d1ad = h1_cnt->GetBinContent(13);
218 double n_d2ad = h1_cnt->GetBinContent(14);
219 double n_d3ad = h1_cnt->GetBinContent(15);
221 oss <<
"N of v1495 events = " << n_all <<
" (all), " << n_d1ad <<
" (d1ad), " << n_d2ad <<
" (d2ad), " << n_d3ad <<
" (d3ad)";
222 pate->AddText(oss.str().c_str());
224 if ((n_d1ad + n_d2ad + n_d3ad) / n_all > 0.05) {
226 can->
AddMessage(
"Errors in >5% of v1495 events.");
227 }
else if ((n_d1ad + n_d2ad + n_d3ad) / n_all > 0.01) {
229 can->
AddMessage(
"Errors in >1% of v1495 events.");
virtual int get_n_flush_evt_bad() const
Return the number of bad FLUSH events.
void AutoSetRange(TH1 *h1, const int margin_lo=5, const int margin_hi=5)
Adjust the axis range via "h1->GetXaxis()->SetRange(bin_lo, bin_hi)" to zoom up non-empty bins...
virtual int get_n_evt_dec() const
Return the number of decoded events. The online decoding usually skips a part of events in order to f...
virtual int get_n_t_hit_bad() const
Return the number of bad V1495-TDC (i.e. trigger) hits.
virtual int get_n_flush_evt() const
Return the number of all FLUSH events.
int InitRunOnlMon(PHCompositeNode *topNode)
virtual int get_n_t_hit() const
Return the number of all V1495-TDC (i.e. trigger) hits.
virtual int get_n_phys_evt() const
Return the number of all PHYSICS events.
int run(const int nEvents=1)
void SetWorseStatus(const MonStatus_t stat)
virtual int get_n_spill() const
Return the number of spill events.
virtual int get_n_v1495_d3ad() const
Return the number of V1495 events having 'd3ad'.
void SetStatus(const MonStatus_t stat)
virtual int get_n_hit_bad() const
Return the number of bad Taiwan-TDC hits.
virtual int get_n_v1495() const
Return the number of all V1495 events.
int EndOnlMon(PHCompositeNode *topNode)
virtual int get_n_phys_evt_bad() const
Return the number of bad PHYSICS events.
virtual int get_n_v1495_d1ad() const
Return the number of V1495 events having 'd1ad'.
virtual int get_n_evt_all() const
Return the number of all recorded events.
An SQ interface class to hold one event header.
virtual int get_n_v1495_d2ad() const
Return the number of V1495 events having 'd2ad'.
An SQ interface class to hold the run-level info.
void AddMessage(const char *msg)
int ProcessEventOnlMon(PHCompositeNode *topNode)
int InitOnlMon(PHCompositeNode *topNode)
virtual int get_n_hit() const
Return the number of all Taiwan-TDC hits.