Skip to content

Commit 9d03281

Browse files
authored
Merge pull request #3885 from mchiu-bnl/mbd
restored mbd histogram fixes, added process_mbd()
2 parents b8c8cc0 + 2235331 commit 9d03281

File tree

2 files changed

+84
-84
lines changed

2 files changed

+84
-84
lines changed

offline/QA/Global/GlobalQA.cc

Lines changed: 80 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ int GlobalQA::Init(PHCompositeNode * /*unused*/)
7474
int GlobalQA::process_event(PHCompositeNode *topNode)
7575
{
7676
_eventcounter++;
77-
process_towers(topNode);
78-
79-
return Fun4AllReturnCodes::EVENT_OK;
80-
}
81-
82-
int GlobalQA::process_towers(PHCompositeNode *topNode)
83-
{
8477
if (m_debug)
8578
{
8679
std::cout << _eventcounter << std::endl;
@@ -97,7 +90,7 @@ int GlobalQA::process_towers(PHCompositeNode *topNode)
9790
}
9891
}
9992

100-
uint64_t triggervec = 0;
93+
triggervec = 0;
10194
if (gl1PacketInfo)
10295
{
10396
triggervec = gl1PacketInfo->getScaledVector();
@@ -114,48 +107,35 @@ int GlobalQA::process_towers(PHCompositeNode *topNode)
114107
triggervec = gl1PacketInfo->getScaledVector();
115108
}
116109

117-
//--------------------------- MBD vertex------------------------------//
118-
MbdVertexMap *mbdmap = findNode::getClass<MbdVertexMap>(topNode, "MbdVertexMap");
119-
MbdVertex *bvertex = nullptr;
120-
float mbd_zvtx = std::numeric_limits<float>::quiet_NaN();
121-
if (mbdmap)
122-
{
123-
for (MbdVertexMap::ConstIter mbditer = mbdmap->begin(); mbditer != mbdmap->end(); ++mbditer)
124-
{
125-
bvertex = mbditer->second;
126-
}
127-
if (bvertex)
128-
{
129-
mbd_zvtx = bvertex->get_z();
130-
}
131-
}
132-
h_GlobalQA_mbd_zvtx->Fill(mbd_zvtx);
133-
h_GlobalQA_mbd_zvtx_wide->Fill(mbd_zvtx);
134-
if (!std::isfinite(mbd_zvtx))
135-
{
136-
h_GlobalQA_mbd_zvtxq->SetBinContent(1, h_GlobalQA_mbd_zvtxq->GetBinContent(1) + 1);
137-
}
138-
else
110+
process_towers(topNode);
111+
112+
if ( triggervec & mbdtrig )
139113
{
140-
h_GlobalQA_mbd_zvtxq->SetBinContent(2, h_GlobalQA_mbd_zvtxq->GetBinContent(2) + 1);
114+
process_mbd(topNode);
141115
}
142116

117+
return Fun4AllReturnCodes::EVENT_OK;
118+
}
119+
120+
int GlobalQA::process_towers(PHCompositeNode *topNode)
121+
{
122+
143123
//--------------------------- sEPD ------------------------------//
144124

145-
if (triggervec & mbdtrig) // Any MBD trigger (bits 10-15)
125+
TowerInfoContainer *_sepd_towerinfo = findNode::getClass<TowerInfoContainer>(topNode, "TOWERS_SEPD");
126+
unsigned int ntowers = 0;
127+
if (_sepd_towerinfo)
146128
{
147-
//--------------------------- sEPD ------------------------------//
148-
TowerInfoContainer *_sepd_towerinfo = findNode::getClass<TowerInfoContainer>(topNode, "TOWERS_SEPD");
149-
unsigned int ntowers = 0;
150-
if (_sepd_towerinfo)
151-
{
152-
ntowers = _sepd_towerinfo->size();
153-
}
129+
ntowers = _sepd_towerinfo->size();
154130
if (ntowers != 744)
155131
{
156-
std::cout << "sEPD container has unexpected size - exiting now!" << std::endl;
157-
gSystem->Exit(1);
132+
std::cout << "sEPD container has unexpected size - skipping sEPD!" << std::endl;
133+
//gSystem->Exit(1); // commenting out exit so that ZDC and MBD aren't prevented
158134
}
135+
}
136+
if ( (triggervec & mbdtrig) && (ntowers == 744) ) // Any MBD trigger (bits 10-15)
137+
{
138+
//--------------------------- sEPD ------------------------------//
159139

160140
float sepdsouthadcsum = 0.;
161141
float sepdnorthadcsum = 0.;
@@ -208,7 +188,39 @@ int GlobalQA::process_towers(PHCompositeNode *topNode)
208188
h_GlobalQA_zdc_energy_n->Fill(totalzdcnorthcalib);
209189
}
210190

211-
//--------------------------- MBD ----------------------------------------//
191+
192+
return Fun4AllReturnCodes::EVENT_OK;
193+
}
194+
195+
196+
int GlobalQA::process_mbd(PHCompositeNode *topNode)
197+
{
198+
//--------------------------- MBD ------------------------------//
199+
MbdVertexMap *mbdmap = findNode::getClass<MbdVertexMap>(topNode, "MbdVertexMap");
200+
MbdVertex *bvertex = nullptr;
201+
float mbd_zvtx = std::numeric_limits<float>::quiet_NaN();
202+
if (mbdmap)
203+
{
204+
for (MbdVertexMap::ConstIter mbditer = mbdmap->begin(); mbditer != mbdmap->end(); ++mbditer)
205+
{
206+
bvertex = mbditer->second;
207+
}
208+
if (bvertex)
209+
{
210+
mbd_zvtx = bvertex->get_z();
211+
}
212+
}
213+
h_GlobalQA_mbd_zvtx->Fill(mbd_zvtx);
214+
h_GlobalQA_mbd_zvtx_wide->Fill(mbd_zvtx);
215+
if (!std::isfinite(mbd_zvtx))
216+
{
217+
h_GlobalQA_mbd_zvtxq->SetBinContent(1, h_GlobalQA_mbd_zvtxq->GetBinContent(1) + 1);
218+
}
219+
else
220+
{
221+
h_GlobalQA_mbd_zvtxq->SetBinContent(2, h_GlobalQA_mbd_zvtxq->GetBinContent(2) + 1);
222+
}
223+
212224
MbdPmtContainer *bbcpmts = findNode::getClass<MbdPmtContainer>(topNode, "MbdPmtContainer");
213225
if (!bbcpmts)
214226
{
@@ -365,55 +377,40 @@ int GlobalQA::process_towers(PHCompositeNode *topNode)
365377
return Fun4AllReturnCodes::EVENT_OK;
366378
}
367379

380+
368381
void GlobalQA::createHistos()
369382
{
370383
auto *hm = QAHistManagerDef::getHistoManager();
371384
assert(hm);
372385

373386
// MBD QA
374-
h_GlobalQA_mbd_zvtxq =
375-
new TH1D("h_GlobalQA_mbd_zvtxq",
376-
";Scaled Trigger 10: MBD Coincidence Has zvtx?;percentage", 2,
377-
-0.5, 1.5);
378-
h_GlobalQA_mbd_zvtx = new TH1D(
379-
"h_GlobalQA_mbd_zvtx", ";Scaled Trigger 10: MBD Coincidence zvtx [cm]",
380-
100, -50, 50);
381-
h_GlobalQA_mbd_zvtx_wide = new TH1D(
382-
"h_GlobalQA_mbd_zvtx_wide",
383-
";Scaled Trigger 10: MBD Coincidence zvtx [cm]", 100, -300, 300);
384-
h_GlobalQA_calc_zvtx = new TH1D(
385-
"h_GlobalQA_calc_zvtx",
386-
";Scaled Trigger 10: MBD Coincidence zvtx [cm]", 100, -50, 50);
387-
h_GlobalQA_calc_zvtx_wide = new TH1D(
388-
"h_GlobalQA_calc_zvtx_wide",
389-
";Scaled Trigger 10: MBD Coincidence zvtx [cm]", 100, -300, 300);
390-
h_GlobalQA_mbd_charge_s =
391-
new TH1D("h_GlobalQA_mbd_charge_s",
392-
";Scaled Trigger 10: MBD Coincidence charge", 100, 0, 10);
393-
h_GlobalQA_mbd_charge_n =
394-
new TH1D("h_GlobalQA_mbd_charge_n",
395-
";Scaled Trigger 10: MBD Coincidence charge", 100, 0, 10);
396-
h_GlobalQA_mbd_nhit_s =
397-
new TH1D("h_GlobalQA_mbd_nhit_s",
398-
";Scaled Trigger 10: MBD Coincidence nhit", 30, -0.5, 29.5);
399-
h_GlobalQA_mbd_nhit_n =
400-
new TH1D("h_GlobalQA_mbd_nhit_n",
401-
";Scaled Trigger 10: MBD Coincidence nhit", 30, -0.5, 29.5);
402-
403-
h_GlobalQA_mbd_charge_sum =
404-
new TH1F("h_GlobalQA_mbd_charge_sum", " ; MBD Total Charge ; Counts",
405-
100, 0., 20);
406-
407-
h2_GlobalQA_mbd_charge_NS_correlation = new TH2F(
408-
"h2_GlobalQA_mbd_charge_NS_correlation",
387+
h_GlobalQA_mbd_zvtxq = new TH1D("h_GlobalQA_mbd_zvtxq", ";Scaled Trigger 10: MBD Coincidence Has zvtx?;percentage", 2, -0.5, 1.5);
388+
389+
h_GlobalQA_mbd_zvtx = new TH1D( "h_GlobalQA_mbd_zvtx", ";Scaled Trigger 10: MBD Coincidence zvtx [cm]", 100, -50, 50);
390+
391+
h_GlobalQA_mbd_zvtx_wide = new TH1D( "h_GlobalQA_mbd_zvtx_wide", ";Scaled Trigger 10: MBD Coincidence zvtx [cm]", 100, -300, 300);
392+
393+
h_GlobalQA_calc_zvtx = new TH1D("h_GlobalQA_calc_zvtx", ";Scaled Trigger 10: MBD Coincidence zvtx [cm]", 100, -50, 50);
394+
395+
h_GlobalQA_calc_zvtx_wide = new TH1D("h_GlobalQA_calc_zvtx_wide", ";Scaled Trigger 10: MBD Coincidence zvtx [cm]", 100, -300, 300);
396+
397+
h_GlobalQA_mbd_charge_s = new TH1D("h_GlobalQA_mbd_charge_s", ";Scaled Trigger 10: MBD Coincidence charge", 1500, 0, 1500);
398+
399+
h_GlobalQA_mbd_charge_n = new TH1D("h_GlobalQA_mbd_charge_n", ";Scaled Trigger 10: MBD Coincidence charge", 1500, 0, 1500);
400+
401+
h_GlobalQA_mbd_nhit_s = new TH1D("h_GlobalQA_mbd_nhit_s", ";Scaled Trigger 10: MBD Coincidence nhit", 65, -0.5, 64.5);
402+
403+
h_GlobalQA_mbd_nhit_n = new TH1D("h_GlobalQA_mbd_nhit_n", ";Scaled Trigger 10: MBD Coincidence nhit", 65, -0.5, 64.5);
404+
405+
h_GlobalQA_mbd_charge_sum = new TH1F("h_GlobalQA_mbd_charge_sum", " ; MBD Total Charge ; Counts", 2500, 0., 2500);
406+
407+
h2_GlobalQA_mbd_charge_NS_correlation = new TH2F("h2_GlobalQA_mbd_charge_NS_correlation",
409408
"MBD Charge Correlation ; Total Charge (South); Total Charge (North)",
410409
150, 0, 1500, 150, 0, 1500);
411410

412-
h2_GlobalQA_mbd_nhits_NS_correlation =
413-
new TH2F("h2_GlobalQA_mbd_nhits_NS_correlation",
414-
"MBD Number Of Hits Correlation ; Number Of Hits (South); "
415-
"Number Of Hits (North)",
416-
70, 0., 70, 70, 0., 70);
411+
h2_GlobalQA_mbd_nhits_NS_correlation = new TH2F("h2_GlobalQA_mbd_nhits_NS_correlation",
412+
"MBD Number Of Hits Correlation ; Number Of Hits (South); " "Number Of Hits (North)",
413+
65, -0.5, 64.5, 65, -0.5, 64.5);
417414

418415
hm->registerHisto(h_GlobalQA_mbd_zvtx);
419416
hm->registerHisto(h_GlobalQA_mbd_zvtxq);
@@ -488,4 +485,4 @@ void GlobalQA::createHistos()
488485
h_GlobalQA_triggerVec = new TH1F("h_GlobalQA_triggerVec", "", 65, -0.5, 64.5);
489486
h_GlobalQA_triggerVec->SetDirectory(nullptr);
490487
hm->registerHisto(h_GlobalQA_triggerVec);
491-
}
488+
}

offline/QA/Global/GlobalQA.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class GlobalQA : public SubsysReco
3535
int process_g4cells(PHCompositeNode *);
3636
int process_towers(PHCompositeNode *);
3737
int process_clusters(PHCompositeNode *);
38+
int process_mbd(PHCompositeNode *);
3839

3940
void Detector(const std::string &name) { detector = name; }
4041
void set_timing_cut_width(const int &t) { _range = t; }
@@ -44,7 +45,7 @@ class GlobalQA : public SubsysReco
4445
double, double, int, double, double);
4546

4647
private:
47-
int evtcount{0};
48+
//int evtcount{0};
4849
int Getpeaktime(TH1 *h);
4950
void createHistos();
5051

@@ -82,6 +83,8 @@ class GlobalQA : public SubsysReco
8283

8384
int _eventcounter{0};
8485
int _range{1};
86+
uint64_t triggervec{0};
87+
8588

8689
bool m_debug{false};
8790

0 commit comments

Comments
 (0)