diff --git a/Control/CalypsoExample/WaveformDataAccessExample/src/RawWaveformAccess.cxx b/Control/CalypsoExample/WaveformDataAccessExample/src/RawWaveformAccess.cxx index c9d8f9f90a8b826ec5f3dcdd89fe928d859f17ec..166d219c6fe29670843d5169ba5fea1c597c45f3 100644 --- a/Control/CalypsoExample/WaveformDataAccessExample/src/RawWaveformAccess.cxx +++ b/Control/CalypsoExample/WaveformDataAccessExample/src/RawWaveformAccess.cxx @@ -27,6 +27,7 @@ RawWaveformAccess::initialize() // Must initialize SG handles ATH_CHECK( m_CaloWaveformContainer.initialize() ); + ATH_CHECK( m_Calo2WaveformContainer.initialize() ); ATH_CHECK( m_VetoWaveformContainer.initialize() ); ATH_CHECK( m_TriggerWaveformContainer.initialize() ); ATH_CHECK( m_PreshowerWaveformContainer.initialize() ); @@ -53,6 +54,10 @@ RawWaveformAccess::execute(const EventContext& ctx) const ATH_MSG_INFO("Found ReadHandle for CaloWaveforms"); ATH_MSG_INFO(*caloHandle); + SG::ReadHandle<RawWaveformContainer> calo2Handle(m_Calo2WaveformContainer, ctx); + ATH_MSG_INFO("Found ReadHandle for Calo2Waveforms"); + ATH_MSG_INFO(*caloHandle); + SG::ReadHandle<RawWaveformContainer> vetoHandle(m_VetoWaveformContainer, ctx); ATH_MSG_INFO("Found ReadHandle for VetoWaveforms"); ATH_MSG_INFO(*vetoHandle); diff --git a/Control/CalypsoExample/WaveformDataAccessExample/src/RawWaveformAccess.h b/Control/CalypsoExample/WaveformDataAccessExample/src/RawWaveformAccess.h index 07cc4deb42b978b655ebaa9fb1eb7738fbc5c390..b07edde805c383b9b3750a10953df27b8aa28df7 100644 --- a/Control/CalypsoExample/WaveformDataAccessExample/src/RawWaveformAccess.h +++ b/Control/CalypsoExample/WaveformDataAccessExample/src/RawWaveformAccess.h @@ -32,6 +32,8 @@ class RawWaveformAccess: public AthReentrantAlgorithm /// StoreGate key SG::ReadHandleKey<RawWaveformContainer> m_CaloWaveformContainer { this, "CaloWaveformContainerKey", "CaloWaveforms", "ReadHandleKey for CaloWaveforms Container"}; + SG::ReadHandleKey<RawWaveformContainer> m_Calo2WaveformContainer + { this, "Calo2WaveformContainerKey", "Calo2Waveforms", "ReadHandleKey for Calo2Waveforms Container"}; SG::ReadHandleKey<RawWaveformContainer> m_VetoWaveformContainer { this, "VetoWaveformContainerKey", "VetoWaveforms", "ReadHandleKey for CaloWaveforms Container"}; SG::ReadHandleKey<RawWaveformContainer> m_TriggerWaveformContainer diff --git a/Event/FaserByteStreamCnvSvcBase/python/FaserByteStreamCnvSvcBaseConfig.py b/Event/FaserByteStreamCnvSvcBase/python/FaserByteStreamCnvSvcBaseConfig.py index 3a87cc4c75388ff53954f9a75be77b9c5d1dc9cd..0762f26a32509e0dd8c0f565d58d46baad9f64d8 100644 --- a/Event/FaserByteStreamCnvSvcBase/python/FaserByteStreamCnvSvcBaseConfig.py +++ b/Event/FaserByteStreamCnvSvcBase/python/FaserByteStreamCnvSvcBaseConfig.py @@ -14,6 +14,7 @@ def FaserByteStreamCnvSvcBaseCfg(flags, **kwargs): adxProvider.TypeNames += [ "RawWaveformContainer/CaloWaveforms", + "RawWaveformContainer/Calo2Waveforms", "RawWaveformContainer/VetoWaveforms", "RawWaveformContainer/VetoNuWaveforms", "RawWaveformContainer/TriggerWaveforms", diff --git a/Waveform/WaveEventCnv/WaveByteStream/src/RawWaveformDecoderTool.cxx b/Waveform/WaveEventCnv/WaveByteStream/src/RawWaveformDecoderTool.cxx index 852ae084edac08380e302ec3026548d667da70c2..d9728fa086b226b417d7af130431131f58d2d13b 100644 --- a/Waveform/WaveEventCnv/WaveByteStream/src/RawWaveformDecoderTool.cxx +++ b/Waveform/WaveEventCnv/WaveByteStream/src/RawWaveformDecoderTool.cxx @@ -61,34 +61,60 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re, // Find the Waveform fragment const DigitizerDataFragment* digitizer = NULL; + const DigitizerDataFragment* digitizer0 = NULL; + const DigitizerDataFragment* digitizer1 = NULL; const DAQFormats::EventFragment* frag = NULL; + + // Dump all fragments for debugging + // for(const auto &id : re->getFragmentIDs()) { + // frag=re->find_fragment(id); + // ATH_MSG_DEBUG("Fragment:\n" << *frag); + // } + for(const auto &id : re->getFragmentIDs()) { frag=re->find_fragment(id); if ((frag->source_id()&0xFFFF0000) != DAQFormats::SourceIDs::PMTSourceID) continue; - ATH_MSG_DEBUG("Fragment:\n" << *frag); - - digitizer = new DigitizerDataFragment(frag->payload<const uint32_t*>(), frag->payload_size()); - - break; + ATH_MSG_DEBUG("Found Fragment:\n" << *frag); + + if ((frag->source_id()&0x03) == 0) + digitizer0 = new DigitizerDataFragment(frag->payload<const uint32_t*>(), frag->payload_size()); + else if ((frag->source_id()&0x03) == 1) + digitizer1 = new DigitizerDataFragment(frag->payload<const uint32_t*>(), frag->payload_size()); + else + ATH_MSG_WARNING("Couldn't match digitizer with fragment source id!"); } - if (!digitizer) { - ATH_MSG_WARNING("Failed to find digitizer fragment in raw event!"); + if (!digitizer0) { + ATH_MSG_WARNING("Failed to find digitizer0 fragment in raw event!"); return StatusCode::SUCCESS; - } - + } + // Check validity here, try to continue, as perhaps not all channels are bad - if (!digitizer->valid()) { - ATH_MSG_WARNING("Found invalid digitizer fragment:\n" << *digitizer); + if (!digitizer0->valid()) { + ATH_MSG_WARNING("Found invalid digitizer0 fragment:\n" << *digitizer0); } else { - ATH_MSG_DEBUG("Found valid digitizer fragment"); + ATH_MSG_DEBUG("Found valid digitizer0 fragment"); } + + if (!digitizer1) { + // Will happen in data before 2024 + ATH_MSG_INFO("Failed to find digitizer1 fragment in raw event!"); + } else { + if (!digitizer1->valid()) { + ATH_MSG_WARNING("Found invalid digitizer1 fragment:\n" << *digitizer1); + } else { + ATH_MSG_DEBUG("Found valid digitizer1 fragment"); + } + } + // Detector type to match in first element of cable map std::string det_type; if (key == std::string("CaloWaveforms")) { det_type = std::string("calo"); + } else if (key == std::string("Calo2Waveforms")) { + det_type = std::string("calo2"); } else if (key == std::string("VetoWaveforms")) { det_type = std::string("veto"); } else if (key == std::string("VetoNuWaveforms")) { @@ -104,8 +130,8 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re, return StatusCode::FAILURE; } - // Loop over 16 digitizer channels - std::vector<int> channelList(16); + // Loop over 32 digitizer channels + std::vector<int> channelList(32); std::iota (std::begin(channelList), std::end(channelList), 0); for (int channel: channelList) { @@ -115,8 +141,15 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re, ATH_MSG_DEBUG("Converting channel "+std::to_string(channel)+" for "+key); + int chan = channel; + digitizer = digitizer0; + if (channel > 15) { + chan = channel-16; + digitizer = digitizer1; + } + // Check if this has data - if (!digitizer->channel_has_data(channel)) { + if (!digitizer->channel_has_data(chan)) { ATH_MSG_DEBUG("Channel " << channel << " has no data - skipping!"); continue; } @@ -124,7 +157,7 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re, RawWaveform* wfm = new RawWaveform(); try { - wfm->setWaveform( channel, digitizer->channel_adc_counts( channel ) ); + wfm->setWaveform( channel, digitizer->channel_adc_counts( chan ) ); } catch ( DigitizerData::DigitizerDataException& e ) { ATH_MSG_WARNING("RawWaveformDecoderTool:\n" <<e.what() @@ -162,8 +195,10 @@ RawWaveformDecoderTool::convert(const DAQFormats::EventFull* re, } // Don't spring a leak - delete digitizer; - + delete digitizer0; + if (digitizer1) + delete digitizer1; + ATH_MSG_DEBUG( "RawWaveformDecoderTool created container " << key << " with size=" << container->size()); return StatusCode::SUCCESS; diff --git a/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py b/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py index 527c4e289eb1533e130301ee3a9c916d48d8e129..6af8ed0e1c78771a1121bce792b4d69105dc46e1 100644 --- a/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py +++ b/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py @@ -28,17 +28,14 @@ def WaveformReconstructionCfg(flags): else: acc.merge(WaveformHitRecCfg(flags, "CaloWaveformRecAlg", "Calo")) + acc.merge(WaveformHitRecCfg(flags, "Calo2WaveformRecAlg", "Calo2")) + # Make preshower window 200 ns wide (value in digitizer clock ticks) acc.merge(WaveformHitRecCfg(flags, "VetoWaveformRecAlg", "Veto", FitWindowWidth=100 )) acc.merge(WaveformHitRecCfg(flags, "PreshowerWaveformRecAlg", "Preshower", FitWindowWidth=100 )) acc.merge(WaveformHitRecCfg(flags, "TriggerWaveformRecAlg", "Trigger", FitWindowWidth=100)) acc.merge(WaveformHitRecCfg(flags, "VetoNuWaveformRecAlg", "VetoNu", FitWindowWidth=100)) - acc.merge(WaveformHitRecCfg(flags, "VetoWaveformRecAlg", "Veto", FitWindowWidth=100 )) - # Make preshower window 200 ns wide (value in digitizer clock ticks) - acc.merge(WaveformHitRecCfg(flags, "PreshowerWaveformRecAlg", "Preshower", FitWindowWidth=100 )) - acc.merge(WaveformHitRecCfg(flags, "CaloWaveformRecAlg", "Calo")) - acc.merge(WaveformTimingCfg(flags)) return acc diff --git a/Waveform/WaveformConditions/WaveformConditionsTools/src/WaveformCableMappingTool.cxx b/Waveform/WaveformConditions/WaveformConditionsTools/src/WaveformCableMappingTool.cxx index 3922d0605339fce204cff01c9dbd69d3c6f21a97..a7de79076eddf9fa132849deb24089dacbf996dd 100644 --- a/Waveform/WaveformConditions/WaveformConditionsTools/src/WaveformCableMappingTool.cxx +++ b/Waveform/WaveformConditions/WaveformConditionsTools/src/WaveformCableMappingTool.cxx @@ -96,6 +96,9 @@ WaveformCableMappingTool::getCableMapping(const EventContext& ctx) const { if (det_type == "calo") { identifier = m_ecalID->pmt_id(rowVal, moduleVal, pmtVal); } + else if (det_type == "calo2") { + identifier = m_ecalID->pmt_id(rowVal, moduleVal, pmtVal); + } else if (det_type == "veto") { identifier = m_vetoID->pmt_id(stationVal, plateVal, pmtVal); } @@ -186,6 +189,9 @@ WaveformCableMappingTool::getChannelMapping(const EventContext& ctx, const Ident if (det_type == "calo") { identifier = m_ecalID->pmt_id(rowVal, moduleVal, pmtVal); } + else if (det_type == "calo2") { + identifier = m_ecalID->pmt_id(rowVal, moduleVal, pmtVal); + } else if (det_type == "veto") { identifier = m_vetoID->pmt_id(stationVal, plateVal, pmtVal); }