11#include " CaloStatusSkimmer.h"
22
33#include < fun4all/Fun4AllReturnCodes.h>
4+ #include < fun4all/Fun4AllHistoManager.h>
45
56#include < phool/PHCompositeNode.h>
67#include < phool/getClass.h>
78#include < phool/phool.h>
89
10+ #include < qautils/QAHistManagerDef.h>
11+
912#include < calobase/TowerInfo.h>
1013#include < calobase/TowerInfoContainer.h>
1114
15+ #include < cassert>
1216#include < cstdint>
1317#include < iostream>
1418
19+ #include < TH1F.h>
20+
1521// ____________________________________________________________________________..
1622CaloStatusSkimmer::CaloStatusSkimmer (const std::string &name)
1723 : SubsysReco(name)
1824{
1925 std::cout << " CaloStatusSkimmer::CaloStatusSkimmer(const std::string &name) " " Calling ctor" << std::endl;
2026}
2127
28+
29+ // ____________________________________________________________________________..
30+ int CaloStatusSkimmer::Init ([[maybe_unused]] PHCompositeNode *topNode)
31+ {
32+ std::cout << " CaloStatusSkimmer::Init(PHCompositeNode *topNode) This is Init..." << std::endl;
33+
34+ if (b_produce_QA_histograms)
35+ {
36+ auto * hm = QAHistManagerDef::getHistoManager ();
37+ assert (hm);
38+
39+ h_EMC_nTowers_notinstr = new TH1F (" h_EMC_nTowers_notinstr" , " Number of not-instrumented(empty/missing pckt) towers in EMCal; nNotInstrTowers; Counts" , 193 , -0.5 , 192.5 );
40+ h_EMC_nTowers_notinstr->SetDirectory (nullptr );
41+ h_HCal_nTowers_notinstr = new TH1F (" h_HCal_nTowers_notinstr" , " Number of not-instrumented(empty/missing pckt) towers in HCal; nNotInstrTowers; Counts" , 193 , -0.5 , 192.5 );
42+ h_HCal_nTowers_notinstr->SetDirectory (nullptr );
43+ h_sEPD_nTowers_notinstr = new TH1F (" h_sEPD_nTowers_notinstr" , " Number of not-instrumented(empty/missing pckt) towers in sEPD; nNotInstrTowers; Counts" , 17 , -0.5 , 16.5 );
44+ h_sEPD_nTowers_notinstr->SetDirectory (nullptr );
45+ h_ZDC_nTowers_notinstr = new TH1F (" h_ZDC_nTowers_notinstr" , " Number of not-instrumented(empty/missing pckt) towers in ZDC; nNotInstrTowers; Counts" , 5 , -0.5 , 4.5 );
46+ h_ZDC_nTowers_notinstr->SetDirectory (nullptr );
47+
48+ h_EMC_nEvents = new TH1F (" h_EMC_nEvents" , " Number of events" , 2 , 0.5 , 2.5 );
49+ h_EMC_nEvents->GetXaxis ()->SetBinLabel (1 , " Total events processed" );
50+ h_EMC_nEvents->GetXaxis ()->SetBinLabel (2 , " Total events skimmed" );
51+ h_EMC_nEvents->SetDirectory (nullptr );
52+
53+ h_HCal_nEvents = new TH1F (" h_HCal_nEvents" , " Number of events" , 2 , 0.5 , 2.5 );
54+ h_HCal_nEvents->GetXaxis ()->SetBinLabel (1 , " Total events processed" );
55+ h_HCal_nEvents->GetXaxis ()->SetBinLabel (2 , " Total events skimmed" );
56+ h_HCal_nEvents->SetDirectory (nullptr );
57+
58+ h_sEPD_nEvents = new TH1F (" h_sEPD_nEvents" , " Number of events" , 2 , 0.5 , 2.5 );
59+ h_sEPD_nEvents->GetXaxis ()->SetBinLabel (1 , " Total events processed" );
60+ h_sEPD_nEvents->GetXaxis ()->SetBinLabel (2 , " Total events skimmed" );
61+ h_sEPD_nEvents->SetDirectory (nullptr );
62+
63+ h_ZDC_nEvents = new TH1F (" h_ZDC_nEvents" , " Number of events" , 2 , 0.5 , 2.5 );
64+ h_ZDC_nEvents->GetXaxis ()->SetBinLabel (1 , " Total events processed" );
65+ h_ZDC_nEvents->GetXaxis ()->SetBinLabel (2 , " Total events skimmed" );
66+ h_ZDC_nEvents->SetDirectory (nullptr );
67+
68+ hm->registerHisto (h_EMC_nTowers_notinstr);
69+ hm->registerHisto (h_HCal_nTowers_notinstr);
70+ hm->registerHisto (h_sEPD_nTowers_notinstr);
71+ hm->registerHisto (h_ZDC_nTowers_notinstr);
72+
73+ hm->registerHisto (h_EMC_nEvents);
74+ hm->registerHisto (h_HCal_nEvents);
75+ hm->registerHisto (h_sEPD_nEvents);
76+ hm->registerHisto (h_ZDC_nEvents);
77+ }
78+
79+ return Fun4AllReturnCodes::EVENT_OK;
80+ }
81+
2282// ____________________________________________________________________________..
2383int CaloStatusSkimmer::process_event (PHCompositeNode *topNode)
2484{
@@ -32,7 +92,7 @@ int CaloStatusSkimmer::process_event(PHCompositeNode *topNode)
3292 n_notowernodecounter++;
3393 if (Verbosity () > 0 )
3494 {
35- std::cout << PHWHERE << " calostatuscheck ::process_event: missing TOWERS_CEMC" << std::endl;
95+ std::cout << PHWHERE << " CaloStatusSkimmer ::process_event: missing TOWERS_CEMC" << std::endl;
3696 }
3797 return Fun4AllReturnCodes::ABORTEVENT;
3898 }
@@ -51,6 +111,11 @@ int CaloStatusSkimmer::process_event(PHCompositeNode *topNode)
51111 std::cout << " CaloStatusSkimmer::process_event: event " << n_eventcounter << " , ntowers in EMCal = " << ntowers << " , not-instrumented(empty/missing pckt) towers in EMCal = " << notinstr_count << std::endl;
52112 }
53113
114+ if (b_produce_QA_histograms)
115+ {
116+ h_EMC_nTowers_notinstr->Fill (notinstr_count);
117+ }
118+
54119 if (notinstr_count >= m_EMC_skim_threshold)
55120 {
56121 n_skimcounter++;
@@ -67,7 +132,7 @@ int CaloStatusSkimmer::process_event(PHCompositeNode *topNode)
67132 n_notowernodecounter++;
68133 if (Verbosity () > 0 )
69134 {
70- std::cout << PHWHERE << " calostatuscheck ::process_event: missing TOWERS_HCALIN or TOWERS_HCALOUT" << std::endl;
135+ std::cout << PHWHERE << " CaloStatusSkimmer ::process_event: missing TOWERS_HCALIN or TOWERS_HCALOUT" << std::endl;
71136 }
72137 return Fun4AllReturnCodes::ABORTEVENT;
73138 }
@@ -99,6 +164,12 @@ int CaloStatusSkimmer::process_event(PHCompositeNode *topNode)
99164 std::cout << " CaloStatusSkimmer::process_event: event " << n_eventcounter << " , ntowers in HCalIn = " << ntowers_hcalin << " , not-instrumented(empty/missing pckt) towers in HCalIn = " << notinstr_count_hcalin << " , ntowers in HCalOut = " << ntowers_hcalout << " , not-instrumented(empty/missing pckt) towers in HCalOut = " << notinstr_count_hcalout << std::endl;
100165 }
101166
167+ if (b_produce_QA_histograms)
168+ {
169+ h_HCal_nTowers_notinstr->Fill (notinstr_count_hcalin);
170+ h_HCal_nTowers_notinstr->Fill (notinstr_count_hcalout);
171+ }
172+
102173 if (notinstr_count_hcalin >= m_HCal_skim_threshold ||
103174 notinstr_count_hcalout >= m_HCal_skim_threshold)
104175 {
@@ -116,7 +187,7 @@ int CaloStatusSkimmer::process_event(PHCompositeNode *topNode)
116187 n_notowernodecounter++;
117188 if (Verbosity () > 0 )
118189 {
119- std::cout << PHWHERE << " calostatuscheck ::process_event: missing TOWERS_SEPD" << std::endl;
190+ std::cout << PHWHERE << " CaloStatusSkimmer ::process_event: missing TOWERS_SEPD" << std::endl;
120191 }
121192 return Fun4AllReturnCodes::ABORTEVENT;
122193 }
@@ -136,6 +207,11 @@ int CaloStatusSkimmer::process_event(PHCompositeNode *topNode)
136207 std::cout << " CaloStatusSkimmer::process_event: event " << n_eventcounter << " , ntowers in sEPD = " << ntowers << " , not-instrumented(empty/missing pckt) towers in sEPD = " << notinstr_count << std::endl;
137208 }
138209
210+ if (b_produce_QA_histograms)
211+ {
212+ h_sEPD_nTowers_notinstr->Fill (notinstr_count);
213+ }
214+
139215 if (notinstr_count >= m_sEPD_skim_threshold)
140216 {
141217 n_skimcounter++;
@@ -152,7 +228,7 @@ int CaloStatusSkimmer::process_event(PHCompositeNode *topNode)
152228 n_notowernodecounter++;
153229 if (Verbosity () > 0 )
154230 {
155- std::cout << PHWHERE << " calostatuscheck ::process_event: missing TOWERS_ZDC" << std::endl;
231+ std::cout << PHWHERE << " CaloStatusSkimmer ::process_event: missing TOWERS_ZDC" << std::endl;
156232 }
157233 return Fun4AllReturnCodes::ABORTEVENT;
158234 }
@@ -172,6 +248,11 @@ int CaloStatusSkimmer::process_event(PHCompositeNode *topNode)
172248 std::cout << " CaloStatusSkimmer::process_event: event " << n_eventcounter << " , ntowers in ZDC = " << ntowers << " , not-instrumented(empty/missing pckt) towers in ZDC = " << notinstr_count << std::endl;
173249 }
174250
251+ if (b_produce_QA_histograms)
252+ {
253+ h_ZDC_nTowers_notinstr->Fill (notinstr_count);
254+ }
255+
175256 if (notinstr_count >= m_ZDC_skim_threshold)
176257 {
177258 n_skimcounter++;
@@ -186,9 +267,25 @@ int CaloStatusSkimmer::process_event(PHCompositeNode *topNode)
186267int CaloStatusSkimmer::End ([[maybe_unused]] PHCompositeNode *topNode)
187268{
188269 std::cout << " CaloStatusSkimmer::End(PHCompositeNode *topNode) This is the End..." << std::endl;
189- std::cout << " Total events processed: " << n_eventcounter << std::endl;
190- std::cout << " Total events skimmed: " << n_skimcounter << std::endl;
191- std::cout << " Total events with missing tower nodes: " << n_notowernodecounter << std::endl;
270+ std::cout << " CaloStatusSkimmer::End Total events processed: " << n_eventcounter << std::endl;
271+ std::cout << " CaloStatusSkimmer::End Total events skimmed: " << n_skimcounter << std::endl;
272+ std::cout << " CaloStatusSkimmer::End Total events with missing tower nodes: " << n_notowernodecounter << std::endl;
273+
274+ if (b_produce_QA_histograms)
275+ {
276+ h_EMC_nEvents->SetBinContent (1 , n_eventcounter);
277+ h_EMC_nEvents->SetBinContent (2 , n_skimcounter);
278+
279+ h_HCal_nEvents->SetBinContent (1 , n_eventcounter);
280+ h_HCal_nEvents->SetBinContent (2 , n_skimcounter);
281+
282+ h_sEPD_nEvents->SetBinContent (1 , n_eventcounter);
283+ h_sEPD_nEvents->SetBinContent (2 , n_skimcounter);
284+
285+ h_ZDC_nEvents->SetBinContent (1 , n_eventcounter);
286+ h_ZDC_nEvents->SetBinContent (2 , n_skimcounter);
287+
288+ }
192289
193290 return Fun4AllReturnCodes::EVENT_OK;
194291}
0 commit comments