From 188bb23b3b7efc02da8441c78210ef034593e575 Mon Sep 17 00:00:00 2001 From: Eric Torrence <eric.torrence@cern.ch> Date: Fri, 11 Sep 2020 14:08:49 -0700 Subject: [PATCH] Add P->T conversion --- .../ScintEventAthenaPool/ScintWaveform_p0.h | 1 + .../src/ScintWaveformCnv_p0.cxx | 9 ++++--- .../src/ScintWaveformContainerCnv_p0.cxx | 24 +++++++++++++++++-- .../ScintRawEvent/ScintWaveform.h | 11 +++++++++ 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Scintillator/ScintEventCnv/ScintEventAthenaPool/ScintEventAthenaPool/ScintWaveform_p0.h b/Scintillator/ScintEventCnv/ScintEventAthenaPool/ScintEventAthenaPool/ScintWaveform_p0.h index b37fe284..e91c8811 100644 --- a/Scintillator/ScintEventCnv/ScintEventAthenaPool/ScintEventAthenaPool/ScintWaveform_p0.h +++ b/Scintillator/ScintEventCnv/ScintEventAthenaPool/ScintEventAthenaPool/ScintWaveform_p0.h @@ -17,6 +17,7 @@ class ScintWaveform_p0 { friend class ScintWaveformCnv_p0; private: + unsigned int m_ID; unsigned int m_channel; std::vector<unsigned int> m_adc_counts; diff --git a/Scintillator/ScintEventCnv/ScintEventAthenaPool/src/ScintWaveformCnv_p0.cxx b/Scintillator/ScintEventCnv/ScintEventAthenaPool/src/ScintWaveformCnv_p0.cxx index b245674d..ffc6f0d8 100644 --- a/Scintillator/ScintEventCnv/ScintEventAthenaPool/src/ScintWaveformCnv_p0.cxx +++ b/Scintillator/ScintEventCnv/ScintEventAthenaPool/src/ScintWaveformCnv_p0.cxx @@ -7,8 +7,11 @@ void ScintWaveformCnv_p0::persToTrans(const ScintWaveform_p0* persObj, ScintWaveform* transObj, MsgStream& log) { - transObj = 0; - log << MSG::WARNING << "ScintWaveformCnv_p0::persToTrans not implemented!" << endmsg; + // Just fill available data here + // Rest of it patched up in ScintWaveformContainerCnv_p0 + transObj->setIdentifier(persObj->m_ID); + transObj->setChannel(persObj->m_channel); + transObj->setCounts(persObj->m_adc_counts); } @@ -20,7 +23,7 @@ ScintWaveformCnv_p0::transToPers(const ScintWaveform* transObj, ScintWaveform_p0 // log << MSG::DEBUG << (*transObj) << endmsg; // log << MSG::DEBUG << "Persistent waveform (before):" << endmsg; // persObj->print(); - + persObj->m_ID = transObj->identify(); persObj->m_channel = transObj->channel(); // Use copy here diff --git a/Scintillator/ScintEventCnv/ScintEventAthenaPool/src/ScintWaveformContainerCnv_p0.cxx b/Scintillator/ScintEventCnv/ScintEventAthenaPool/src/ScintWaveformContainerCnv_p0.cxx index f808f108..4312a030 100644 --- a/Scintillator/ScintEventCnv/ScintEventAthenaPool/src/ScintWaveformContainerCnv_p0.cxx +++ b/Scintillator/ScintEventCnv/ScintEventAthenaPool/src/ScintWaveformContainerCnv_p0.cxx @@ -8,10 +8,30 @@ void ScintWaveformContainerCnv_p0::persToTrans(const ScintWaveformContainer_p0* persCont, ScintWaveformContainer* transCont, MsgStream& log) { - transCont = 0; - log << MSG::WARNING << "ScintWaveformContainerCnv_p0::persToTrans not implemented!" << endmsg; + log << MSG::DEBUG << "ScintWaveformContainerCnv_p0::persToTrans called" << endmsg; + ScintWaveformCnv_p0 waveformCnv; + + // Clear this, transient container is DataVector, which stores pointers + // Create them below and push back to fill + transCont->clear(); + for (unsigned int index = 0; index < persCont->m_waveforms.size(); ++index) { + std::unique_ptr<ScintWaveform> data = std::make_unique<ScintWaveform>(); + const ScintWaveform_p0* pdata = &persCont->m_waveforms.at(index); + waveformCnv.persToTrans(pdata, data.get(), log); + + // Fill other values held by container in persistent class + data->setBoardFailFlag(persCont->m_board_fail_flag); + data->setBoardId(persCont->m_board_id); + data->setPatternTrigOptions(persCont->m_pattern_trig_options); + data->setChannelMask(persCont->m_channel_mask); + data->setEventCounter(persCont->m_event_counter); + data->setTriggerTime(persCont->m_trigger_time_tag); + data->setSamples(persCont->m_samples); + + transCont->push_back(data.release()); + } } void diff --git a/Scintillator/ScintRawEvent/ScintRawEvent/ScintWaveform.h b/Scintillator/ScintRawEvent/ScintRawEvent/ScintWaveform.h index 0c211be6..c7598d44 100644 --- a/Scintillator/ScintRawEvent/ScintRawEvent/ScintWaveform.h +++ b/Scintillator/ScintRawEvent/ScintRawEvent/ScintWaveform.h @@ -73,6 +73,17 @@ public: void setHeader (const DigitizerDataFragment* frag); void setWaveform (unsigned int channel, const std::vector<uint16_t> waveform); + // Set functions for P->T conversion + void setBoardId(unsigned int id) {m_board_id = id;} + void setBoardFailFlag(bool flag) {m_board_fail_flag = flag;} + void setPatternTrigOptions(unsigned int pattern) {m_pattern_trig_options = pattern;} + void setChannelMask(unsigned int mask) {m_channel_mask = mask;} + void setEventCounter(unsigned int counter) {m_event_counter = counter;} + void setTriggerTime(unsigned int tag) {m_trigger_time_tag = tag;} + void setChannel(unsigned int chan) {m_channel = chan;} + void setSamples(unsigned int samp) {m_samples = samp;} + void setCounts(const std::vector<unsigned int>& counts) {m_adc_counts = counts;} + /////////////////////////////////////////////////////////////////// // Private data: /////////////////////////////////////////////////////////////////// -- GitLab