Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions offline/packages/epd/EpdReco.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int EpdReco::InitRun(PHCompositeNode *topNode)
}
if (!m_overrideFieldName)
{
m_fieldname = "sepd_calib";
m_fieldname = "mip_calib";
}
std::string calibdir = CDBInterface::instance()->getUrl(m_calibName);
if (!calibdir.empty())
Expand All @@ -62,6 +62,12 @@ int EpdReco::InitRun(PHCompositeNode *topNode)
exit(1);
}

for (unsigned int ch = 0; ch < 744; ch++)
{
unsigned int key = TowerInfoDefs::encode_epd(ch);
m_calibration_constants[ch] = cdbttree->GetFloatValue(key, m_fieldname);
}

CreateNodes(topNode);

PHNodeIterator node_itr(topNode);
Expand Down Expand Up @@ -141,8 +147,21 @@ int EpdReco::process_event(PHCompositeNode *topNode)
{
float ch_time = _sepd_towerinfo->get_tower_at_channel(ch)->get_time_float();
float ch_adc = _sepd_towerinfo->get_tower_at_channel(ch)->get_energy();
float ch_mpv = cdbttree->GetFloatValue(ch, m_fieldname);
double ch_nmip = ch_adc / ch_mpv;
float ch_mpv = m_calibration_constants[ch];
double ch_nmip;

// Check for bad channel calibration constant
if (ch_mpv <= 0)
{
// Bad channel marker (-999) or invalid calibration
ch_nmip = 0.0;
m_TowerInfoContainer_calib->get_tower_at_channel(ch)->set_isNoCalib(true);
}
else
{
ch_nmip = ch_adc / ch_mpv;
}

m_TowerInfoContainer_calib->get_tower_at_channel(ch)->set_energy(ch_nmip);
m_TowerInfoContainer_calib->get_tower_at_channel(ch)->set_time_float(ch_time);
}
Expand Down
1 change: 1 addition & 0 deletions offline/packages/epd/EpdReco.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class EpdReco : public SubsysReco

std::array<float, 24> tilephi{};
std::array<float, 12> tilephi0{};
std::array<float, 744> m_calibration_constants{};
};

#endif // EPD_EPDRECO_H