From ae074bdce4f49ad60106772d01d402e77db7459e Mon Sep 17 00:00:00 2001 From: Gianantonio Pezzullo Date: Fri, 11 Jun 2021 13:53:44 -0500 Subject: [PATCH 01/11] updated script using MUSE vars --- ups_install/install.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ups_install/install.sh b/ups_install/install.sh index 862bc66f38..2feb953788 100644 --- a/ups_install/install.sh +++ b/ups_install/install.sh @@ -6,12 +6,12 @@ # same product+version+qualifiers: use with care. # -export COMPILER_CODE=e20 +export COMPILER_CODE=${MUSE_COMPILER_E} export ${MU2E_SETUP_BUILDOPTS} -export DEBUG_LEVEL=${build} +export DEBUG_LEVEL=${MUSE_BUILD} export PACKAGE_NAME=offline -export PACKAGE_SOURCE=${MU2E_BASE_RELEASE} -export PACKAGE_VERSION=v09_11_03 +export PACKAGE_SOURCE=${MUSE_WORK_DIR}/Offline +export PACKAGE_VERSION=v10_00_00 # Check that the installation directoy has been defined. if [ "${PRODUCTS_INSTALL}" = '' ];then @@ -36,7 +36,7 @@ old_flavour=`ups flavor` new_flavour=`get-directory-name subdir` # Build the names of the directories into which we will write things -fq=${new_flavour}.${COMPILER_CODE}.${MU2E_ART_SQUALIFIER}${haveTrigger}.${DEBUG_LEVEL} +fq=${new_flavour}.${COMPILER_CODE}.${MUSE_ART}${haveTrigger}.${DEBUG_LEVEL} topdir=${PRODUCTS_INSTALL}/${PACKAGE_NAME} proddir=${PRODUCTS_INSTALL}/${PACKAGE_NAME}/${PACKAGE_VERSION} verdir=${PRODUCTS_INSTALL}/${PACKAGE_NAME}/${PACKAGE_VERSION}.version @@ -88,8 +88,8 @@ rsync -ar --exclude-from ${PACKAGE_SOURCE}/ups_install/tar_exclude_for_config.t ${PACKAGE_SOURCE} ${cfgdir} # Libaries and binaries -rsync -ar lib ${fqdir} -rsync -ar bin ${fqdir} +rsync -ar ${BUILD}/lib ${fqdir} +rsync -ar ${BUILD}/bin ${fqdir} # A copy of the full source rsync -ar --exclude-from ${PACKAGE_SOURCE}/ups_install/tar_exclude_for_source.txt \ @@ -97,13 +97,13 @@ rsync -ar --exclude-from ${PACKAGE_SOURCE}/ups_install/tar_exclude_for_source.t # Create the ups fq files. ${PACKAGE_SOURCE}/ups_install/installFQFile.sh \ - ${verdir}/${old_flavour}_${COMPILER_CODE}_${MU2E_ART_SQUALIFIER} \ - ${COMPILER_CODE}:${MU2E_ART_SQUALIFIER} + ${verdir}/${old_flavour}_${COMPILER_CODE}_${MUSE_ART} \ + ${COMPILER_CODE}:${MUSE_ART} # Repeat for the trig qualified fq files. ${PACKAGE_SOURCE}/ups_install/installFQFile.sh \ - ${verdir}/${old_flavour}_${COMPILER_CODE}_${MU2E_ART_SQUALIFIER}_trig \ - ${COMPILER_CODE}:${MU2E_ART_SQUALIFIER}:trig + ${verdir}/${old_flavour}_${COMPILER_CODE}_${MUSE_ART}_trig \ + ${COMPILER_CODE}:${MUSE_ART}:trig unset old_flavour unset new_flavour From de1f057593cbac7dd300750f18605f541e194103 Mon Sep 17 00:00:00 2001 From: gianipez Date: Tue, 15 Jun 2021 13:03:27 -0500 Subject: [PATCH 02/11] clean up + updated ups-maker script --- Trigger/fcl/prolog_trigger.fcl | 10 +++++----- ups_install/install.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Trigger/fcl/prolog_trigger.fcl b/Trigger/fcl/prolog_trigger.fcl index 037e2c757a..378ad262d9 100644 --- a/Trigger/fcl/prolog_trigger.fcl +++ b/Trigger/fcl/prolog_trigger.fcl @@ -164,19 +164,19 @@ Trigger : { @table::CstTrigger.sequences #unbiased filter. It selects the events based on their event id - unbiased : [ unbiasedEventPrescale, unbiasedTriggerInfoMerger ] + unbiased : [ unbiasedEventPrescale ] #minimum bias filters. So far, a filter based on the StrawDigi occupancy - minimumbiasSDCount : [ minimumbiasSDCountEventPrescale, minimumbiasSDCountFilter, minimumbiasSDCountTriggerInfoMerger] + minimumbiasSDCount : [ minimumbiasSDCountEventPrescale, minimumbiasSDCountFilter] #filter to select events with large occupancy in the tracker - largeSDCount : [ largeSDCountEventPrescale, largeSDCountFilter, largeSDCountTriggerInfoMerger] + largeSDCount : [ largeSDCountEventPrescale, largeSDCountFilter] #minimum bias filters. So far, a filter based on the StrawDigi occupancy - minimumbiasCDCount : [ minimumbiasCDCountEventPrescale, minimumbiasCDCountFilter, minimumbiasCDCountTriggerInfoMerger] + minimumbiasCDCount : [ minimumbiasCDCountEventPrescale, minimumbiasCDCountFilter] #filter to select events with large occupancy in the tracker - largeCDCount : [ largeCDCountEventPrescale, largeCDCountFilter, largeCDCountTriggerInfoMerger] + largeCDCount : [ largeCDCountEventPrescale, largeCDCountFilter] } outputs: { diff --git a/ups_install/install.sh b/ups_install/install.sh index 862bc66f38..b2cc354fd9 100644 --- a/ups_install/install.sh +++ b/ups_install/install.sh @@ -11,7 +11,7 @@ export ${MU2E_SETUP_BUILDOPTS} export DEBUG_LEVEL=${build} export PACKAGE_NAME=offline export PACKAGE_SOURCE=${MU2E_BASE_RELEASE} -export PACKAGE_VERSION=v09_11_03 +export PACKAGE_VERSION=v10_00_00 # Check that the installation directoy has been defined. if [ "${PRODUCTS_INSTALL}" = '' ];then From 66e92a19cfef57aa9ef7b06abdf7060bd3dec52a Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Tue, 15 Jun 2021 14:18:54 -0500 Subject: [PATCH 03/11] Start work on supporting Mu2eEventFragment --- DAQ/src/CaloHitsFromFragments_module.cc | 156 ++++++++++++++---------- DAQ/src/FragmentAna_module.cc | 22 ++-- 2 files changed, 100 insertions(+), 78 deletions(-) diff --git a/DAQ/src/CaloHitsFromFragments_module.cc b/DAQ/src/CaloHitsFromFragments_module.cc index 0ee35f0a0a..e4cb480ff9 100644 --- a/DAQ/src/CaloHitsFromFragments_module.cc +++ b/DAQ/src/CaloHitsFromFragments_module.cc @@ -13,6 +13,7 @@ #include "art/Framework/Principal/Handle.h" #include "mu2e-artdaq-core/Overlays/CalorimeterFragment.hh" #include "mu2e-artdaq-core/Overlays/FragmentType.hh" +#include "mu2e-artdaq-core/Overlays/Mu2eEventFragment.hh" #include "RecoDataProducts/inc/CaloHit.hh" @@ -24,10 +25,10 @@ #include +#include #include #include #include -#include #include namespace art { @@ -80,13 +81,13 @@ class art::CaloHitsFromFragments : public EDProducer { virtual void produce(Event&); private: - void analyze_calorimeter_(const artdaq::Fragment& f, + void analyze_calorimeter_(const mu2e::CalorimeterFragment& cc, std::unique_ptr const& calo_hits, std::unique_ptr const& caphri_hits); - void addPulse(uint16_t& crystalID, float& time, float& eDep, - std::unique_ptrconst& hits_calo, - std::unique_ptrconst& hits_caphri); + void addPulse(uint16_t& crystalID, float& time, float& eDep, + std::unique_ptr const& hits_calo, + std::unique_ptr const& hits_caphri); int diagLevel_; @@ -96,12 +97,13 @@ class art::CaloHitsFromFragments : public EDProducer { const int hexShiftPrint = 7; - std::unordered_map> pulseMap_; // Temporary hack until the Calorimeter channel map is finialized + std::unordered_map> + pulseMap_; // Temporary hack until the Calorimeter channel map is finialized mu2e::CaloDAQUtilities caloDAQUtil_; std::array peakADC2MeV_; std::array timeCalib_; - std::array caphriCrystalID_; + std::array caphriCrystalID_; }; // ====================================================================== @@ -115,7 +117,7 @@ void art::CaloHitsFromFragments::beginRun(art::Run& Run) { // NOW FILLING THE ARRAY WITH A DUMMY VALUE for (size_t i = 0; i < peakADC2MeV_.size(); ++i) { peakADC2MeV_[i] = 0.0461333; - timeCalib_ [i] = 0.; + timeCalib_[i] = 0.; } // FIX ME! @@ -124,35 +126,36 @@ void art::CaloHitsFromFragments::beginRun(art::Run& Run) { caphriCrystalID_ = {623, 624, 595, 596}; } -void art::CaloHitsFromFragments::addPulse(uint16_t& crystalID, float& time, float& eDep, - std::unique_ptrconst & hits_calo, - std::unique_ptrconst & hits_caphri) { +void art::CaloHitsFromFragments::addPulse( + uint16_t& crystalID, float& time, float& eDep, + std::unique_ptr const& hits_calo, + std::unique_ptr const& hits_caphri) { bool addNewHit(true); bool isCaphri = std::find(caphriCrystalID_.begin(), caphriCrystalID_.end(), crystalID) != - caphriCrystalID_.end(); + caphriCrystalID_.end(); size_t counter(0); for (auto& pulse : pulseMap_[crystalID]) { ++counter; - if (std::fabs(pulse.time() - time) < deltaTPulses_){ - if( (eDep / pulse.energyDep() <= pulseRatioMax_) && - (eDep / pulse.energyDep() >= pulseRatioMin_) ) { - // combine the pulses - pulse.setTime ( (pulse.time() + time) / 2.);//probably not necessary - pulse.setEDep ( (pulse.energyDep() + eDep) / 2.); - pulse.setNSiPMs( pulse.nSiPMs()+ 1); - addNewHit = false; - }else if (eDep > pulse.energyDep()) { - pulse.setTime (time);//probably not necessary - pulse.setEDep (eDep); - addNewHit = false; + if (std::fabs(pulse.time() - time) < deltaTPulses_) { + if ((eDep / pulse.energyDep() <= pulseRatioMax_) && + (eDep / pulse.energyDep() >= pulseRatioMin_)) { + // combine the pulses + pulse.setTime((pulse.time() + time) / 2.); // probably not necessary + pulse.setEDep((pulse.energyDep() + eDep) / 2.); + pulse.setNSiPMs(pulse.nSiPMs() + 1); + addNewHit = false; + } else if (eDep > pulse.energyDep()) { + pulse.setTime(time); // probably not necessary + pulse.setEDep(eDep); + addNewHit = false; } - //move the pulse in the final collection - if (isCaphri){ - hits_caphri->emplace_back(std::move(pulse)); - }else{ - hits_calo->emplace_back(std::move(pulse)); + // move the pulse in the final collection + if (isCaphri) { + hits_caphri->emplace_back(std::move(pulse)); + } else { + hits_calo->emplace_back(std::move(pulse)); } break; } @@ -163,19 +166,15 @@ void art::CaloHitsFromFragments::addPulse(uint16_t& crystalID, float& time, floa } art::CaloHitsFromFragments::CaloHitsFromFragments(const art::EDProducer::Table& config) : - art::EDProducer{config}, diagLevel_(config().diagLevel()), - caloFragmentsTag_(config().caloTag()), - digiSampling_ (config().digiSampling()), - deltaTPulses_ (config().deltaTPulses()), - pulseRatioMax_ (config().pulseRatioMax()), - pulseRatioMin_ (config().pulseRatioMin()), - hitEDepMax_ (config().hitEDepMax()), - caloDAQUtil_ ("CaloHitsFromFragments") - { - pulseMap_.reserve(4000); - produces(); - produces("caphri"); - } + art::EDProducer{config}, diagLevel_(config().diagLevel()), + caloFragmentsTag_(config().caloTag()), digiSampling_(config().digiSampling()), + deltaTPulses_(config().deltaTPulses()), pulseRatioMax_(config().pulseRatioMax()), + pulseRatioMin_(config().pulseRatioMin()), hitEDepMax_(config().hitEDepMax()), + caloDAQUtil_("CaloHitsFromFragments") { + pulseMap_.reserve(4000); + produces(); + produces("caphri"); +} // ---------------------------------------------------------------------- @@ -188,23 +187,51 @@ void art::CaloHitsFromFragments::produce(Event& event) { std::unique_ptr calo_hits(new mu2e::CaloHitCollection); std::unique_ptr caphri_hits(new mu2e::CaloHitCollection); - art::Handle calFragments; - size_t numCalFrags(0); size_t totalSize = 0; - event.getByLabel(caloFragmentsTag_, calFragments); - if (!calFragments.isValid()) { + size_t numCalFrags = 0; + std::vector> fragmentHandles; +#if ART_HEX_VERSION < 0x30900 + evt.getManyByType(fragmentHandles); +#else + fragmentHandles = evt.getMany>(); +#endif + + for (const auto& handle : fragmentHandles) { + if (!handle.isValid() || handle->empty()) { + continue; + } + + if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + for (const auto& cont : *handle) { + mu2e::Mu2eEventFragment mef(cont); + for (size_t ii = 0; ii < mef.calorimeter_block_count(); ++ii) { + auto pair = mef.calorimeterAtPtr(ii); + mu2e::CalorimeterFragment cc(pair); + analyze_calorimeter_(cc, calo_hits, caphri_hits); + + totalSize += pair.second; + numCalFrags++; + } + } + } else { + if (handle->front().type() == detail::FragmentType::CAL) { + for (auto frag : *handle) { + mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_calorimeter_(cc, calo_hits, caphri_hits); + + totalSize += frag.dataSizeBytes(); + numCalFrags++; + } + } + } + } + + if (numCalFrags == 0) { std::cout << "[CaloHitsFromFragments::produce] found no Calorimeter fragments!" << std::endl; event.put(std::move(calo_hits)); event.put(std::move(caphri_hits)); return; } - numCalFrags = calFragments->size(); - for (size_t idx = 0; idx < numCalFrags; ++idx) { - auto size = ((*calFragments)[idx]).sizeBytes(); // * sizeof(artdaq::RawDataType); - totalSize += size; - analyze_calorimeter_((*calFragments)[idx], calo_hits, caphri_hits); - // std::cout << "\tCAL Fragment " << idx << " has size " << size << std::endl; - } if (diagLevel_ > 1) { std::cout << std::dec << "Producer: Run " << event.run() << ", subrun " << event.subRun() @@ -226,9 +253,8 @@ void art::CaloHitsFromFragments::produce(Event& event) { } // produce() void art::CaloHitsFromFragments::analyze_calorimeter_( - const artdaq::Fragment& f, std::unique_ptr const& calo_hits, + const mu2e::CalorimeterFragment& cc, std::unique_ptr const& calo_hits, std::unique_ptr const& caphri_hits) { - mu2e::CalorimeterFragment cc(f); if (diagLevel_ > 1) { caloDAQUtil_.printCaloFragmentInfo(f, cc); @@ -316,21 +342,21 @@ void art::CaloHitsFromFragments::analyze_calorimeter_( size_t peakIndex = hits[hitIdx].first.IndexOfMaxDigitizerSample; // float eDep(0); // if (hits[hitIdx].first.IndexOfMaxDigitizerSample < hits[hitIdx].second.size()) { - // eDep = hits[hitIdx].second.at(peakIndex) * peakADC2MeV_[sipmID]; - float eDep = hits[hitIdx].second * peakADC2MeV_[sipmID]; - // } - float time = hits[hitIdx].first.Time + peakIndex * digiSampling_ + timeCalib_[sipmID]; - - //FIX ME! WE NEED TO CHECK IF TEH PULSE IS SATURATED HERE - if (eDep < hitEDepMax_){ - addPulse(crystalID, time, eDep, calo_hits, caphri_hits); + // eDep = hits[hitIdx].second.at(peakIndex) * peakADC2MeV_[sipmID]; + float eDep = hits[hitIdx].second * peakADC2MeV_[sipmID]; + // } + float time = hits[hitIdx].first.Time + peakIndex * digiSampling_ + timeCalib_[sipmID]; + + // FIX ME! WE NEED TO CHECK IF TEH PULSE IS SATURATED HERE + if (eDep < hitEDepMax_) { + addPulse(crystalID, time, eDep, calo_hits, caphri_hits); } if (diagLevel_ > 1) { // Until we have the final mapping, the BoardID is just a placeholder // adc_t BoardId = cc.DBC_BoardID(pos,channelIdx); - caloDAQUtil_.printAllHitInfo(crystalID, sipmID, hdr, hits[hitIdx].first, - hits[hitIdx].second); + caloDAQUtil_.printAllHitInfo(crystalID, sipmID, hdr, hits[hitIdx].first, + hits[hitIdx].second); } // End debug output } // End loop over readout channels in DataBlock diff --git a/DAQ/src/FragmentAna_module.cc b/DAQ/src/FragmentAna_module.cc index 225e54f79d..c64f250fdc 100644 --- a/DAQ/src/FragmentAna_module.cc +++ b/DAQ/src/FragmentAna_module.cc @@ -176,18 +176,16 @@ void FragmentAna::analyze(const art::Event& event) { // Loop over the TRK and CAL fragments for (size_t idx = 0; idx < numTrkFrags + numCalFrags; ++idx) { - auto curHandle = trkFragments; size_t curIdx = idx; - if (idx >= numTrkFrags) { - curIdx = idx - numTrkFrags; - curHandle = calFragments; - } - const auto& fragment((*curHandle)[curIdx]); - if (idx < numTrkFrags) { - analyze_tracker_(fragment); + mu2e::TrackerFragment cc(trkFragments->at(curIdx).dataBegin(), + trkFragments->at(curIdx).dataSizeBytes()); + analyze_tracker_(cc); } else { - analyze_calorimeter_(fragment); + curIdx = idx - numTrkFrags; + mu2e::CalorimeterFragment cc(calFragments->at(curIdx).dataBegin(), + calFragments->at(curIdx).dataSizeBytes()); + analyze_calorimeter_(cc); } } if (diagLevel_ > 0) { @@ -196,8 +194,7 @@ void FragmentAna::analyze(const art::Event& event) { } } -void FragmentAna::analyze_tracker_(const artdaq::Fragment& f) { - mu2e::TrackerFragment cc(f); +void FragmentAna::analyze_tracker_(const mu2e::TrackerFragment& cc) { if (diagLevel_ > 1) { std::cout << std::endl; @@ -267,8 +264,7 @@ void FragmentAna::analyze_tracker_(const artdaq::Fragment& f) { cc.ClearUpgradedPackets(); } -void FragmentAna::analyze_calorimeter_(const artdaq::Fragment& f) { - mu2e::CalorimeterFragment cc(f); +void FragmentAna::analyze_calorimeter_(const mu2e::CalorimeterFragment& cc) { if (diagLevel_ > 1) { std::cout << std::endl; From 70c6a444c0874fdfec0a0d7fde23fc7df2b17cba Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Tue, 15 Jun 2021 14:58:54 -0500 Subject: [PATCH 04/11] More Mu2eEventFragment compatibility --- DAQ/src/CaloRecoFromFragments_module.cc | 148 +++++++++-------- DAQ/src/FragmentAna_module.cc | 104 +++++++----- DAQ/src/PrefetchDAQData_module.cc | 14 +- .../StrawAndCaloDigisFromFragments_module.cc | 155 ++++++++++-------- DAQ/src/StrawRecoFromFragments_module.cc | 58 +++++-- 5 files changed, 281 insertions(+), 198 deletions(-) diff --git a/DAQ/src/CaloRecoFromFragments_module.cc b/DAQ/src/CaloRecoFromFragments_module.cc index 0526a62bff..95de63880d 100644 --- a/DAQ/src/CaloRecoFromFragments_module.cc +++ b/DAQ/src/CaloRecoFromFragments_module.cc @@ -12,15 +12,15 @@ #include "art/Framework/Principal/Handle.h" #include "mu2e-artdaq-core/Overlays/CalorimeterFragment.hh" - #include "mu2e-artdaq-core/Overlays/FragmentType.hh" +#include "mu2e-artdaq-core/Overlays/FragmentType.hh" //-- insert calls to proditions ..for calodmap----- -#include "ProditionsService/inc/ProditionsHandle.hh" #include "CaloConditions/inc/CaloDAQMap.hh" +#include "ProditionsService/inc/ProditionsHandle.hh" //------------------------------------------------- -#include "RecoDataProducts/inc/CaloDigi.hh" #include "DAQ/inc/CaloDAQUtilities.hh" +#include "RecoDataProducts/inc/CaloDigi.hh" #include @@ -52,61 +52,79 @@ class art::CaloRecoFromFragments : public EDProducer { virtual void produce(Event&); private: - mu2e::ProditionsHandle _calodaqconds_h; void analyze_calorimeter_(mu2e::CaloDAQMap const& calodaqconds, - const artdaq::Fragment& f, + const mu2e::CalorimeterFragment& cc, std::unique_ptr const& calo_digis); - int diagLevel_; + int diagLevel_; - art::InputTag caloFragmentsTag_; - mu2e::CaloDAQUtilities caloDAQUtil_; + art::InputTag caloFragmentsTag_; + mu2e::CaloDAQUtilities caloDAQUtil_; - const int hexShiftPrint = 7; + const int hexShiftPrint = 7; }; // CaloRecoFromFragments // ====================================================================== art::CaloRecoFromFragments::CaloRecoFromFragments(const art::EDProducer::Table& config) : - art::EDProducer{config}, - diagLevel_(config().diagLevel()), - caloFragmentsTag_(config().caloTag()), - caloDAQUtil_("CaloRecoFromFragments") { - produces(); - } + art::EDProducer{config}, diagLevel_(config().diagLevel()), + caloFragmentsTag_(config().caloTag()), caloDAQUtil_("CaloRecoFromFragments") { + produces(); +} // ---------------------------------------------------------------------- void art::CaloRecoFromFragments::produce(Event& event) { art::EventNumber_t eventNumber = event.event(); - + // Collection of CaloDigis for the event std::unique_ptr calo_digis(new mu2e::CaloDigiCollection); mu2e::CaloDAQMap const& calodaqconds = _calodaqconds_h.get(event.id()); // Get calo daq cond - - art::Handle calFragments; - size_t numCalFrags(0); + size_t totalSize = 0; - event.getByLabel(caloFragmentsTag_, calFragments); - if (!calFragments.isValid()) { - std::cout << "[CaloRecoFromFragments::produce] found no Calorimeter fragments!" - << std::endl; + size_t numCalFrags = 0; + std::vector> fragmentHandles; +#if ART_HEX_VERSION < 0x30900 + evt.getManyByType(fragmentHandles); +#else + fragmentHandles = evt.getMany>(); +#endif + + for (const auto& handle : fragmentHandles) { + if (!handle.isValid() || handle->empty()) { + continue; + } + + if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + for (const auto& cont : *handle) { + mu2e::Mu2eEventFragment mef(cont); + for (size_t ii = 0; ii < mef.calorimeter_block_count(); ++ii) { + auto pair = mef.calorimeterAtPtr(ii); + mu2e::CalorimeterFragment cc(pair); + analyze_calorimeter_(calodaqconds, cc, calo_digis); + + totalSize += pair.second; + numCalFrags++; + } + } + } else { + if (handle->front().type() == detail::FragmentType::CAL) { + for (auto frag : *handle) { + mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_calorimeter_(calodaqconds, cc, calo_digis); + + totalSize += frag.dataSizeBytes(); + numCalFrags++; + } + } + } + } + + if (numCalFrags == 0) { + std::cout << "[CaloRecoFromFragments::produce] found no Calorimeter fragments!" << std::endl; event.put(std::move(calo_digis)); return; } - - numCalFrags = calFragments->size(); - if (diagLevel_ > 1) { - std::cout << "[CaloRecoFromFragments::produce] found "<< numCalFrags <<" Calorimeter fragments" - << std::endl; - } - for (size_t idx = 0; idx < numCalFrags; ++idx) { - auto size = ((*calFragments)[idx]).sizeBytes(); // * sizeof(artdaq::RawDataType); - totalSize += size; - analyze_calorimeter_(calodaqconds, (*calFragments)[idx], calo_digis); - // std::cout << "\tCAL Fragment " << idx << " has size " << size << std::endl; - } - if (diagLevel_ > 1) { std::cout << std::dec << "Producer: Run " << event.run() << ", subrun " << event.subRun() @@ -117,33 +135,30 @@ void art::CaloRecoFromFragments::produce(Event& event) { } if (diagLevel_ > 0) { - std::cout << "mu2e::CaloRecoFromFragments::produce exiting eventNumber=" - << (int)(event.event()) << " / timestamp=" << (int)eventNumber << std::endl; + std::cout << "mu2e::CaloRecoFromFragments::produce exiting eventNumber=" << (int)(event.event()) + << " / timestamp=" << (int)eventNumber << std::endl; } // Store the calo digis in the event event.put(std::move(calo_digis)); - } // produce() -void art::CaloRecoFromFragments::analyze_calorimeter_(mu2e::CaloDAQMap const& calodaqconds, - const artdaq::Fragment& f, std::unique_ptr const& calo_digis) { +void art::CaloRecoFromFragments::analyze_calorimeter_( + mu2e::CaloDAQMap const& calodaqconds, const mu2e::CalorimeterFragment& cc, + std::unique_ptr const& calo_digis) { - mu2e::CalorimeterFragment cc(f); if (diagLevel_ > 1) { std::cout << std::endl; std::cout << "ArtFragmentReader: "; std::cout << "\tBlock Count: " << std::dec << cc.block_count() << std::endl; - std::cout << "\tByte Count: " << f.dataSizeBytes() << std::endl; std::cout << std::endl; std::cout << "\t" << "====== Example Block Sizes ======" << std::endl; for (size_t i = 0; i < 10; i++) { if (i < cc.block_count()) { - std::cout << "\t" << i << "\t" << cc.blockSizeBytes(i) - << std::endl; + std::cout << "\t" << i << "\t" << cc.blockSizeBytes(i) << std::endl; } } std::cout << "\t" @@ -170,7 +185,7 @@ void art::CaloRecoFromFragments::analyze_calorimeter_(mu2e::CaloDAQMap const& ca } std::cout << std::endl; } - #endif +#endif auto block = cc.dataAtBlockIndex(curBlockIdx); if (block == nullptr) { @@ -182,7 +197,8 @@ void art::CaloRecoFromFragments::analyze_calorimeter_(mu2e::CaloDAQMap const& ca if (diagLevel_ > 1) { - std::cout << "timestamp: " << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) << std::endl; + std::cout << "timestamp: " + << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) << std::endl; std::cout << "hdr->SubsystemID: " << static_cast(hdr.GetSubsystemID()) << std::endl; std::cout << "dtcID: " << static_cast(hdr.GetID()) << std::endl; std::cout << "rocID: " << static_cast(hdr.GetLinkID()) << std::endl; @@ -203,8 +219,8 @@ void art::CaloRecoFromFragments::analyze_calorimeter_(mu2e::CaloDAQMap const& ca } if (diagLevel_ > 0) { - std::cout << "[CaloRecoFromFragments] NEW CALDATA: NumberOfHits " - << calData->NumberOfHits << std::endl; + std::cout << "[CaloRecoFromFragments] NEW CALDATA: NumberOfHits " << calData->NumberOfHits + << std::endl; } auto hits = cc.GetCalorimeterHits(curBlockIdx); @@ -223,19 +239,14 @@ void art::CaloRecoFromFragments::analyze_calorimeter_(mu2e::CaloDAQMap const& ca if (diagLevel_ > 0) { std::cout << "[CaloRecoFromFragments] calo hit " << hitIdx << std::endl; std::cout << "[CaloRecoFromFragments] \tChNumber " - << (int)hits[hitIdx].first.ChannelNumber - << std::endl; - std::cout << "[CaloRecoFromFragments] \tDIRACA " - << (int)hits[hitIdx].first.DIRACA + << (int)hits[hitIdx].first.ChannelNumber << std::endl; + std::cout << "[CaloRecoFromFragments] \tDIRACA " << (int)hits[hitIdx].first.DIRACA << std::endl; - std::cout << "[CaloRecoFromFragments] \tDIRACB " - << (int)hits[hitIdx].first.DIRACB + std::cout << "[CaloRecoFromFragments] \tDIRACB " << (int)hits[hitIdx].first.DIRACB << std::endl; - std::cout << "[CaloRecoFromFragments] \tErrorFlags " - << (int)hits[hitIdx].first.ErrorFlags + std::cout << "[CaloRecoFromFragments] \tErrorFlags " << (int)hits[hitIdx].first.ErrorFlags << std::endl; - std::cout << "[CaloRecoFromFragments] \tTime " - << (int)hits[hitIdx].first.Time + std::cout << "[CaloRecoFromFragments] \tTime " << (int)hits[hitIdx].first.Time << std::endl; std::cout << "[CaloRecoFromFragments] \tNSamples " << (int)hits[hitIdx].first.NumberOfSamples << std::endl; @@ -249,17 +260,18 @@ void art::CaloRecoFromFragments::analyze_calorimeter_(mu2e::CaloDAQMap const& ca // temporarily storing the 4-bit roID and 12-bit crystalID in the Reserved DIRAC A slot. // Also, note that until we have an actual map, channel index does not actually correspond // to the physical readout channel on a ROC. - //uint16_t crystalID = hits[hitIdx].first.DIRACB & 0x0FFF; - //uint16_t roID = hits[hitIdx].first.DIRACB >> 12; + // uint16_t crystalID = hits[hitIdx].first.DIRACB & 0x0FFF; + // uint16_t roID = hits[hitIdx].first.DIRACB >> 12; + + uint16_t packetid = hits[hitIdx].first.DIRACA; + uint16_t roID = calodaqconds.packetIdTocaloRoId(packetid); + // uint16_t dettype = (packetId & 0x7000) >> 13; - uint16_t packetid = hits[hitIdx].first.DIRACA; - uint16_t roID = calodaqconds.packetIdTocaloRoId(packetid); - //uint16_t dettype = (packetId & 0x7000) >> 13; - // FIXME: Can we match vector types here? std::vector caloHits; - caloHits.reserve(hits[hitIdx].second.size()); - std::copy(hits[hitIdx].second.begin(), hits[hitIdx].second.end(), std::back_inserter(caloHits)); + caloHits.reserve(hits[hitIdx].second.size()); + std::copy(hits[hitIdx].second.begin(), hits[hitIdx].second.end(), + std::back_inserter(caloHits)); calo_digis->emplace_back(roID, hits[hitIdx].first.Time, caloHits, hits[hitIdx].first.IndexOfMaxDigitizerSample); @@ -267,7 +279,7 @@ void art::CaloRecoFromFragments::analyze_calorimeter_(mu2e::CaloDAQMap const& ca if (diagLevel_ > 1) { // Until we have the final mapping, the BoardID is just a placeholder // adc_t BoardId = cc.DBC_BoardID(pos,channelIdx); - uint16_t crystalID = roID/2; + uint16_t crystalID = roID / 2; std::cout << "Crystal ID: " << (int)crystalID << std::endl; std::cout << "SiPM ID: " << (int)roID << std::endl; std::cout << "Time: " << (int)hits[hitIdx].first.Time << std::endl; diff --git a/DAQ/src/FragmentAna_module.cc b/DAQ/src/FragmentAna_module.cc index c64f250fdc..6514e2da91 100644 --- a/DAQ/src/FragmentAna_module.cc +++ b/DAQ/src/FragmentAna_module.cc @@ -131,22 +131,68 @@ void FragmentAna::endJob() {} void FragmentAna::analyze(const art::Event& event) { art::EventNumber_t eventNumber = event.event(); - art::Handle trkFragments, calFragments; - size_t numTrkFrags(0), numCalFrags(0); - if (parseTRK_) { - event.getByLabel(trkFragmentsTag_, trkFragments); - if (!trkFragments.isValid()) { - return; + size_t totalSize = 0; + size_t numTrkFrags = 0; + size_t numCalFrags = 0; + std::vector> fragmentHandles; +#if ART_HEX_VERSION < 0x30900 + evt.getManyByType(fragmentHandles); +#else + fragmentHandles = evt.getMany>(); +#endif + + for (const auto& handle : fragmentHandles) { + if (!handle.isValid() || handle->empty()) { + continue; + } + + if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + for (const auto& cont : *handle) { + mu2e::Mu2eEventFragment mef(cont); + if (parseTRK_) { + for (size_t ii = 0; ii < mef.tracker_block_count(); ++ii) { + auto pair = mef.trackerAtPtr(ii); + mu2e::TrackerFragment cc(pair); + analyze_tracker_(cc); + + totalSize += pair.second; + numTrkFrags++; + } + } + if (parseCAL_) { + for (size_t ii = 0; ii < mef.calorimeter_block_count(); ++ii) { + auto pair = mef.calorimeterAtPtr(ii); + mu2e::TrackerFragment cc(pair); + analyze_calorimeter_(cc); + + totalSize += pair.second; + numTrkFrags++; + } + } + } + } else { + if (handle->front().type() == detail::FragmentType::TRK && parseTRK_) { + for (auto frag : *handle) { + mu2e::TrackerFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_tracker_(cc ); + + totalSize += frag.dataSizeBytes(); + numTrkFrags++; + } + } else if (handle->front().type() == detail::FragmentType::CAL && parseCAL_) { + mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_calorimeter_(cc); + + totalSize += frag.dataSizeBytes(); + numCalFrags++; + } } - numTrkFrags = trkFragments->size(); + } + + if (parseTRK_) { _hTrkNFragment->Fill(numTrkFrags); } if (parseCAL_) { - event.getByLabel(caloFragmentsTag_, calFragments); - if (!calFragments.isValid()) { - return; - } - numCalFrags = calFragments->size(); _hCalNFragment->Fill(numCalFrags); } @@ -156,38 +202,9 @@ void FragmentAna::analyze(const art::Event& event) { std::cout << numTrkFrags << " TRK fragments, and "; std::cout << numCalFrags << " CAL fragments." << std::endl; - size_t totalSize = 0; - for (size_t idx = 0; idx < numTrkFrags; ++idx) { - auto size = ((*trkFragments)[idx]).size(); // * sizeof(artdaq::RawDataType); - totalSize += size; - // std::cout << "\tTRK Fragment " << idx << " has size " << size << std::endl; - } - for (size_t idx = 0; idx < numCalFrags; ++idx) { - auto size = ((*calFragments)[idx]).size(); // * sizeof(artdaq::RawDataType); - totalSize += size; - // std::cout << "\tCAL Fragment " << idx << " has size " << size << std::endl; - } - totalSize *= sizeof(artdaq::RawDataType); - std::cout << "\tTotal Size: " << (int)totalSize << " bytes." << std::endl; } - std::string curMode = "TRK"; - - // Loop over the TRK and CAL fragments - for (size_t idx = 0; idx < numTrkFrags + numCalFrags; ++idx) { - size_t curIdx = idx; - if (idx < numTrkFrags) { - mu2e::TrackerFragment cc(trkFragments->at(curIdx).dataBegin(), - trkFragments->at(curIdx).dataSizeBytes()); - analyze_tracker_(cc); - } else { - curIdx = idx - numTrkFrags; - mu2e::CalorimeterFragment cc(calFragments->at(curIdx).dataBegin(), - calFragments->at(curIdx).dataSizeBytes()); - analyze_calorimeter_(cc); - } - } if (diagLevel_ > 0) { std::cout << "mu2e::FragmentAna::produce exiting eventNumber=" << (int)(event.event()) << " / timestamp=" << (int)eventNumber << std::endl; @@ -293,8 +310,7 @@ void FragmentAna::analyze_calorimeter_(const mu2e::CalorimeterFragment& cc) { } auto hdr = block->GetHeader(); - if (hdr.GetPacketCount() > 0 && - parseCAL_ > 0) { // Parse phyiscs information from CAL packets + if (hdr.GetPacketCount() > 0 && parseCAL_ > 0) { // Parse phyiscs information from CAL packets auto calData = cc.GetCalorimeterData(curBlockIdx); if (calData == nullptr) { @@ -314,7 +330,7 @@ void FragmentAna::analyze_calorimeter_(const mu2e::CalorimeterFragment& cc) { for (auto& hit : hits) { // Fill the CaloDigiCollection - + // IMPORTANT NOTE: we don't have a final // mapping yet so for the moment, the BoardID field (described in docdb 4914) is just a // placeholder. Because we still need to know which crystal a hit belongs to, we are diff --git a/DAQ/src/PrefetchDAQData_module.cc b/DAQ/src/PrefetchDAQData_module.cc index 18243c2e82..b00da21776 100644 --- a/DAQ/src/PrefetchDAQData_module.cc +++ b/DAQ/src/PrefetchDAQData_module.cc @@ -41,6 +41,7 @@ namespace mu2e { int _fetchStrawDigis; int _fetchCaloFragments; int _fetchTrkFragments; + int _fetchAllFragments; art::InputTag _cdTag; art::InputTag _sdTag; @@ -62,6 +63,7 @@ namespace mu2e { _fetchStrawDigis (pset.get ("fetchStrawDigis")), _fetchCaloFragments(pset.get ("fetchCaloFragments")), _fetchTrkFragments (pset.get ("fetchTrkFragments")), + _fetchAllFragments(pset.get("fetchAllFragments")), _cdTag (pset.get("caloDigiCollectionTag")), _sdTag (pset.get("strawDigiCollectionTag")), _cfTag (pset.get("caloFragmentTag")), @@ -92,6 +94,7 @@ namespace mu2e { _sdcol = 0; _cfcol = 0; _tfcol = 0; + _allfcol = 0; if (_fetchCaloDigis) { auto cdH = evt.getValidHandle(_cdTag); @@ -112,7 +115,16 @@ namespace mu2e { auto sdH = evt.getValidHandle(_sdTag); _sdcol = sdH.product(); } -//----------------------------------------------------------------------------- + + if (_fetchAllFragments) { + auto allH = evt.getMany>(); + for (auto& fs : allH) { + for (auto& frag : *fs) { + fake_access(frag); + } + } + } + //----------------------------------------------------------------------------- // prefetch data //----------------------------------------------------------------------------- if (_cdcol) { diff --git a/DAQ/src/StrawAndCaloDigisFromFragments_module.cc b/DAQ/src/StrawAndCaloDigisFromFragments_module.cc index dee9883849..88df16564b 100644 --- a/DAQ/src/StrawAndCaloDigisFromFragments_module.cc +++ b/DAQ/src/StrawAndCaloDigisFromFragments_module.cc @@ -17,8 +17,8 @@ #include "DataProducts/inc/TrkTypes.hh" #include "RecoDataProducts/inc/CaloDigi.hh" -#include "RecoDataProducts/inc/StrawDigiCollection.hh" #include "RecoDataProducts/inc/ProtonBunchTime.hh" +#include "RecoDataProducts/inc/StrawDigiCollection.hh" #include @@ -41,7 +41,8 @@ class art::StrawAndCaloDigisFromFragments : public EDProducer { fhicl::Atom diagLevel{fhicl::Name("diagLevel"), fhicl::Comment("diagnostic level")}; fhicl::Atom parseCAL{fhicl::Name("parseCAL"), fhicl::Comment("parseCAL")}; fhicl::Atom parseTRK{fhicl::Name("parseTRK"), fhicl::Comment("parseTRK")}; - fhicl::Atom useTrkADC{fhicl::Name("useTrkADC"), fhicl::Comment("parse tracker ADC waveforms")}; + fhicl::Atom useTrkADC{fhicl::Name("useTrkADC"), + fhicl::Comment("parse tracker ADC waveforms")}; fhicl::Atom caloTag{fhicl::Name("caloTag"), fhicl::Comment("caloTag")}; fhicl::Atom trkTag{fhicl::Name("trkTag"), fhicl::Comment("trkTag")}; }; @@ -54,9 +55,10 @@ class art::StrawAndCaloDigisFromFragments : public EDProducer { virtual void produce(Event&); private: - void analyze_tracker_(const artdaq::Fragment& f, - std::unique_ptr const& straw_digis, - std::unique_ptr const& straw_digi_adcs); + void + analyze_tracker_(const artdaq::Fragment& f, + std::unique_ptr const& straw_digis, + std::unique_ptr const& straw_digi_adcs); void analyze_calorimeter_(const artdaq::Fragment& f, std::unique_ptr const& calo_digis); @@ -78,12 +80,9 @@ class art::StrawAndCaloDigisFromFragments : public EDProducer { art::StrawAndCaloDigisFromFragments::StrawAndCaloDigisFromFragments( const art::EDProducer::Table& config) : art::EDProducer{config}, - diagLevel_(config().diagLevel()), - parseCAL_(config().parseCAL()), - parseTRK_(config().parseTRK()), - useTrkADC_(config().useTrkADC()), - trkFragmentsTag_(config().trkTag()), - caloFragmentsTag_(config().caloTag()) { + diagLevel_(config().diagLevel()), parseCAL_(config().parseCAL()), + parseTRK_(config().parseTRK()), useTrkADC_(config().useTrkADC()), + trkFragmentsTag_(config().trkTag()), caloFragmentsTag_(config().caloTag()) { if (parseTRK_) { produces(); if (useTrkADC_) { @@ -93,7 +92,7 @@ art::StrawAndCaloDigisFromFragments::StrawAndCaloDigisFromFragments( if (parseCAL_) { produces(); } - //FIXME! + // FIXME! produces(); } @@ -104,50 +103,73 @@ void art::StrawAndCaloDigisFromFragments::produce(Event& event) { // Collection of StrawDigis for the event std::unique_ptr straw_digis(new mu2e::StrawDigiCollection); - std::unique_ptr straw_digi_adcs(new mu2e::StrawDigiADCWaveformCollection); + std::unique_ptr straw_digi_adcs( + new mu2e::StrawDigiADCWaveformCollection); // Collection of CaloDigis for the event std::unique_ptr calo_digis(new mu2e::CaloDigiCollection); - //FIXME! this is temporary + // FIXME! this is temporary std::unique_ptr pbt(new mu2e::ProtonBunchTime); pbt->pbtime_ = 0; pbt->pbterr_ = 0; event.put(std::move(pbt)); - art::Handle trkFragments, calFragments; - size_t numTrkFrags(0), numCalFrags(0); size_t totalSize = 0; - if (parseTRK_) { - event.getByLabel(trkFragmentsTag_, trkFragments); - if (!trkFragments.isValid()) { - std::cout << "[StrawAndCaloDigisFromFragments::produce] found no Tracker fragments!" - << std::endl; - event.put(std::move(straw_digis)); - return; - } - numTrkFrags = trkFragments->size(); - for (size_t idx = 0; idx < numTrkFrags; ++idx) { - auto size = ((*trkFragments)[idx]).sizeBytes(); // * sizeof(artdaq::RawDataType); - totalSize += size; - analyze_tracker_((*trkFragments)[idx], straw_digis, straw_digi_adcs); - // std::cout << "\tTRK Fragment " << idx << " has size " << size << std::endl; - } - } - if (parseCAL_) { - event.getByLabel(caloFragmentsTag_, calFragments); - if (!calFragments.isValid()) { - std::cout << "[StrawAndCaloDigisFromFragments::produce] found no Calorimeter fragments!" - << std::endl; - event.put(std::move(calo_digis)); - return; + size_t numTrkFrags = 0; + size_t numCalFrags = 0; + std::vector> fragmentHandles; +#if ART_HEX_VERSION < 0x30900 + evt.getManyByType(fragmentHandles); +#else + fragmentHandles = evt.getMany>(); +#endif + + for (const auto& handle : fragmentHandles) { + if (!handle.isValid() || handle->empty()) { + continue; } - numCalFrags = calFragments->size(); - for (size_t idx = 0; idx < numCalFrags; ++idx) { - auto size = ((*calFragments)[idx]).sizeBytes(); // * sizeof(artdaq::RawDataType); - totalSize += size; - analyze_calorimeter_((*calFragments)[idx], calo_digis); - // std::cout << "\tCAL Fragment " << idx << " has size " << size << std::endl; + + if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + for (const auto& cont : *handle) { + mu2e::Mu2eEventFragment mef(cont); + if (parseTRK_) { + for (size_t ii = 0; ii < mef.tracker_block_count(); ++ii) { + auto pair = mef.trackerAtPtr(ii); + mu2e::TrackerFragment cc(pair); + analyze_tracker_(cc, straw_digis, straw_digi_adcs); + + totalSize += pair.second; + numTrkFrags++; + } + } + if (parseCAL_) { + for (size_t ii = 0; ii < mef.calorimeter_block_count(); ++ii) { + auto pair = mef.calorimeterAtPtr(ii); + mu2e::TrackerFragment cc(pair); + analyze_calorimeter_(cc, calo_digis); + + totalSize += pair.second; + numTrkFrags++; + } + } + } + } else { + if (handle->front().type() == detail::FragmentType::TRK && parseTRK_) { + for (auto frag : *handle) { + mu2e::TrackerFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_tracker_(cc, straw_digis, straw_digi_adcs); + + totalSize += frag.dataSizeBytes(); + numTrkFrags++; + } + } else if (handle->front().type() == detail::FragmentType::CAL && parseCAL_) { + mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_calorimeter_(cc, calo_digis); + + totalSize += frag.dataSizeBytes(); + numCalFrags++; + } } } @@ -232,8 +254,8 @@ void art::StrawAndCaloDigisFromFragments::analyze_tracker_( if (diagLevel_ > 1) { - std::cout << "timestamp: " << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) - << std::endl; + std::cout << "timestamp: " + << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) << std::endl; std::cout << "hdr->SubsystemID: " << static_cast(hdr.GetSubsystemID()) << std::endl; std::cout << "dtcID: " << static_cast(hdr.GetID()) << std::endl; std::cout << "rocID: " << static_cast(hdr.GetLinkID()) << std::endl; @@ -264,7 +286,7 @@ void art::StrawAndCaloDigisFromFragments::analyze_tracker_( // Fill the StrawDigiCollection straw_digis->emplace_back(sid, tdc, tot, pmp); - if (useTrkADC_){ + if (useTrkADC_) { straw_digi_adcs->emplace_back(trkDataPair.second); } @@ -286,7 +308,7 @@ void art::StrawAndCaloDigisFromFragments::analyze_tracker_( std::cout << "TDC1: " << tdc[1] << std::endl; std::cout << "TOT0: " << tot[0] << std::endl; std::cout << "TOT1: " << tot[1] << std::endl; - std::cout << "PMP: " << pmp << std::endl; + std::cout << "PMP: " << pmp << std::endl; std::cout << "Waveform: {"; for (size_t i = 0; i < trkDataPair.second.size(); i++) { std::cout << trkDataPair.second[i]; @@ -306,8 +328,8 @@ void art::StrawAndCaloDigisFromFragments::analyze_tracker_( } std::cout << std::endl; - std::cout << "LOOP: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << " " << curBlockIdx - << std::endl; + std::cout << "LOOP: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << " " + << curBlockIdx << std::endl; // Text format: timestamp strawidx tdc0 tdc1 nsamples sample0-11 // Example: 1 1113 36978 36829 12 1423 1390 1411 1354 2373 2392 2342 2254 1909 1611 1525 @@ -350,8 +372,7 @@ void art::StrawAndCaloDigisFromFragments::analyze_calorimeter_( << "====== Example Block Sizes ======" << std::endl; for (size_t i = 0; i < 10; i++) { if (i < cc.block_count()) { - std::cout << "\t" << i << "\t" << cc.blockSizeBytes(i) - << std::endl; + std::cout << "\t" << i << "\t" << cc.blockSizeBytes(i) << std::endl; } } std::cout << "\t" @@ -378,7 +399,7 @@ void art::StrawAndCaloDigisFromFragments::analyze_calorimeter_( } std::cout << std::endl; } - #endif +#endif auto block = cc.dataAtBlockIndex(curBlockIdx); if (block == nullptr) { @@ -390,7 +411,8 @@ void art::StrawAndCaloDigisFromFragments::analyze_calorimeter_( if (diagLevel_ > 1) { - std::cout << "timestamp: " << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) << std::endl; + std::cout << "timestamp: " + << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) << std::endl; std::cout << "hdr->SubsystemID: " << static_cast(hdr.GetSubsystemID()) << std::endl; std::cout << "dtcID: " << static_cast(hdr.GetID()) << std::endl; std::cout << "rocID: " << static_cast(hdr.GetLinkID()) << std::endl; @@ -400,8 +422,7 @@ void art::StrawAndCaloDigisFromFragments::analyze_calorimeter_( std::cout << std::endl; } - if (hdr.GetPacketCount() > 0 && - parseCAL_ > 0) { // Parse phyiscs information from CAL packets + if (hdr.GetPacketCount() > 0 && parseCAL_ > 0) { // Parse phyiscs information from CAL packets auto calData = cc.GetCalorimeterData(curBlockIdx); if (calData == nullptr) { @@ -432,20 +453,15 @@ void art::StrawAndCaloDigisFromFragments::analyze_calorimeter_( if (diagLevel_ > 0) { std::cout << "[StrawAndCaloDigiFromFragments] calo hit " << hitIdx << std::endl; std::cout << "[StrawAndCaloDigiFromFragments] \tChNumber " - << (int)hits[hitIdx].first.ChannelNumber - << std::endl; + << (int)hits[hitIdx].first.ChannelNumber << std::endl; std::cout << "[StrawAndCaloDigiFromFragments] \tDIRACA " - << (int)hits[hitIdx].first.DIRACA - << std::endl; + << (int)hits[hitIdx].first.DIRACA << std::endl; std::cout << "[StrawAndCaloDigiFromFragments] \tDIRACB " - << (int)hits[hitIdx].first.DIRACB - << std::endl; + << (int)hits[hitIdx].first.DIRACB << std::endl; std::cout << "[StrawAndCaloDigiFromFragments] \tErrorFlags " - << (int)hits[hitIdx].first.ErrorFlags - << std::endl; + << (int)hits[hitIdx].first.ErrorFlags << std::endl; std::cout << "[StrawAndCaloDigiFromFragments] \tTime " - << (int)hits[hitIdx].first.Time - << std::endl; + << (int)hits[hitIdx].first.Time << std::endl; std::cout << "[StrawAndCaloDigiFromFragments] \tNSamples " << (int)hits[hitIdx].first.NumberOfSamples << std::endl; std::cout << "[StrawAndCaloDigiFromFragments] \tIndexMax " @@ -463,8 +479,9 @@ void art::StrawAndCaloDigisFromFragments::analyze_calorimeter_( // FIXME: Can we match vector types here? std::vector caloHits; - caloHits.reserve(hits[hitIdx].second.size()); - std::copy(hits[hitIdx].second.begin(), hits[hitIdx].second.end(), std::back_inserter(caloHits)); + caloHits.reserve(hits[hitIdx].second.size()); + std::copy(hits[hitIdx].second.begin(), hits[hitIdx].second.end(), + std::back_inserter(caloHits)); calo_digis->emplace_back((crystalID * 2 + apdID), hits[hitIdx].first.Time, caloHits, hits[hitIdx].first.IndexOfMaxDigitizerSample); diff --git a/DAQ/src/StrawRecoFromFragments_module.cc b/DAQ/src/StrawRecoFromFragments_module.cc index 0067946c17..4280db0f8d 100644 --- a/DAQ/src/StrawRecoFromFragments_module.cc +++ b/DAQ/src/StrawRecoFromFragments_module.cc @@ -49,7 +49,7 @@ class art::StrawRecoFromFragmnets : public EDProducer { virtual void produce(Event&); private: - void analyze_tracker_(const artdaq::Fragment& f, + void analyze_tracker_(const mu2e::TrackerFragment& cc, std::unique_ptr const& straw_digis, std::unique_ptr const& straw_digi_adcs); int diagLevel_; @@ -90,24 +90,52 @@ void art::StrawRecoFromFragmnets::produce(Event& event) { pbt->pbtime_ = 0; pbt->pbterr_ = 0; event.put(std::move(pbt)); - - art::Handle trkFragments; - size_t numTrkFrags(0); + size_t totalSize = 0; - event.getByLabel(trkFragmentsTag_, trkFragments); - if (!trkFragments.isValid()) { + size_t numTrkFrags = 0; + std::vector> fragmentHandles; +#if ART_HEX_VERSION < 0x30900 + evt.getManyByType(fragmentHandles); +#else + fragmentHandles = evt.getMany>(); +#endif + + for (const auto& handle : fragmentHandles) { + if (!handle.isValid() || handle->empty()) { + continue; + } + + if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + for (const auto& cont : *handle) { + mu2e::Mu2eEventFragment mef(cont); + for (size_t ii = 0; ii < mef.tracker_block_count(); ++ii) { + auto pair = mef.trackerAtPtr(ii); + mu2e::TrackerFragment cc(pair); + analyze_tracker_(cc, straw_digis, straw_digi_adcs); + + totalSize += pair.second; + numTrkFrags++; + } + } + } else { + if (handle->front().type() == detail::FragmentType::TRK) { + for (auto frag : *handle) { + mu2e::TrackerFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_tracker_(cc, straw_digis, straw_digi_adcs); + + totalSize += frag.dataSizeBytes(); + numTrkFrags++; + } + } + } + } + + if (numTrkFrags == 0) { std::cout << "[StrawRecoFromFragmnets::produce] found no Tracker fragments!" << std::endl; event.put(std::move(straw_digis)); return; } - numTrkFrags = trkFragments->size(); - for (size_t idx = 0; idx < numTrkFrags; ++idx) { - auto size = ((*trkFragments)[idx]).sizeBytes(); // * sizeof(artdaq::RawDataType); - totalSize += size; - analyze_tracker_((*trkFragments)[idx], straw_digis, straw_digi_adcs); - // std::cout << "\tTRK Fragment " << idx << " has size " << size << std::endl; - } if (diagLevel_ > 1) { std::cout << std::dec << "Producer: Run " << event.run() << ", subrun " << event.subRun() @@ -131,16 +159,14 @@ void art::StrawRecoFromFragmnets::produce(Event& event) { } // produce() void art::StrawRecoFromFragmnets::analyze_tracker_( - const artdaq::Fragment& f, std::unique_ptr const& straw_digis, + const mu2e::TrackerFragment& cc, std::unique_ptr const& straw_digis, std::unique_ptr const& straw_digi_adcs) { - mu2e::TrackerFragment cc(f); if (diagLevel_ > 1) { std::cout << std::endl; std::cout << "TrackerFragment: "; std::cout << "\tBlock Count: " << std::dec << cc.block_count() << std::endl; - std::cout << "\tByte Count: " << f.dataSizeBytes() << std::endl; std::cout << std::endl; std::cout << "\t" << "====== Example Block Sizes ======" << std::endl; From 797da2a9dda5fcc5e5dde2bda711e9cd48cc5baf Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Tue, 15 Jun 2021 18:07:46 -0500 Subject: [PATCH 05/11] More updates to the DAQ modules, get them building --- DAQ/inc/CaloDAQUtilities.hh | 14 ++-- DAQ/src/CaloDAQUtilities.cc | 27 ++++--- DAQ/src/CaloHitsFromFragments_module.cc | 15 ++-- DAQ/src/CaloRecoFromFragments_module.cc | 28 +++---- DAQ/src/CrvDigisFromFragments_module.cc | 20 ++--- DAQ/src/FragmentAna_module.cc | 41 +++++----- DAQ/src/PrefetchDAQData_module.cc | 1 - .../StrawAndCaloDigisFromFragments_module.cc | 78 +++++++++---------- DAQ/src/StrawRecoFromFragments_module.cc | 34 ++++---- 9 files changed, 118 insertions(+), 140 deletions(-) diff --git a/DAQ/inc/CaloDAQUtilities.hh b/DAQ/inc/CaloDAQUtilities.hh index 865c98c6b0..f942b0754a 100644 --- a/DAQ/inc/CaloDAQUtilities.hh +++ b/DAQ/inc/CaloDAQUtilities.hh @@ -18,22 +18,22 @@ namespace mu2e { public: CaloDAQUtilities(std::string ModuleName); - uint16_t getCrystalID(CalorimeterFragment::CalorimeterHitReadoutPacket& Hit){ return Hit.DIRACB & 0x0FFF;} - uint16_t getSiPMID (CalorimeterFragment::CalorimeterHitReadoutPacket& Hit){ + uint16_t getCrystalID(CalorimeterFragment::CalorimeterHitReadoutPacket const& Hit){ return Hit.DIRACB & 0x0FFF;} + uint16_t getSiPMID (CalorimeterFragment::CalorimeterHitReadoutPacket const& Hit){ uint16_t crystalID = getCrystalID(Hit); uint16_t sipmID = Hit.DIRACB >> 12; return (crystalID * 2 + sipmID); } - void printCaloFragmentInfo(const artdaq::Fragment& f, CalorimeterFragment& Frag); + void printCaloFragmentInfo(CalorimeterFragment const& Frag); - void printCaloFragmentHeader(DTCLib::DTC_DataHeaderPacket &Header); + void printCaloFragmentHeader(std::shared_ptr Header); - void printCaloPulse(CalorimeterFragment::CalorimeterHitReadoutPacket& Hit); + void printCaloPulse(CalorimeterFragment::CalorimeterHitReadoutPacket const& Hit); - void printWaveform(std::vector& Pulse); + void printWaveform(std::vector const& Pulse); - void printAllHitInfo(int CrystalID, int SiPMID, DTCLib::DTC_DataHeaderPacket &Header, CalorimeterFragment::CalorimeterHitReadoutPacket& Hit, uint16_t& PulseMax); + void printAllHitInfo(int CrystalID, int SiPMID, std::shared_ptr Header, CalorimeterFragment::CalorimeterHitReadoutPacket const& Hit, uint16_t PulseMax); private: std::string moduleName_; diff --git a/DAQ/src/CaloDAQUtilities.cc b/DAQ/src/CaloDAQUtilities.cc index 85e6b80ce9..0fe6fa48b8 100644 --- a/DAQ/src/CaloDAQUtilities.cc +++ b/DAQ/src/CaloDAQUtilities.cc @@ -9,11 +9,10 @@ namespace mu2e { CaloDAQUtilities::CaloDAQUtilities(std::string ModuleName):moduleName_(ModuleName){} - void CaloDAQUtilities::printCaloFragmentInfo(const artdaq::Fragment& f, CalorimeterFragment& cc){ + void CaloDAQUtilities::printCaloFragmentInfo(CalorimeterFragment const& cc){ std::cout << std::endl; std::cout << "ArtFragmentReader: "; std::cout << "\tBlock Count: " << std::dec << cc.block_count() << std::endl; - std::cout << "\tByte Count: " << f.dataSizeBytes() << std::endl; std::cout << std::endl; std::cout << "\t" << "====== Example Block Sizes ======" << std::endl; @@ -28,20 +27,20 @@ namespace mu2e { } - void CaloDAQUtilities::printCaloFragmentHeader(DTCLib::DTC_DataHeaderPacket &Header){ + void CaloDAQUtilities::printCaloFragmentHeader(std::shared_ptr Header){ - std::cout << "timestamp: " << static_cast(Header.GetEventWindowTag().GetEventWindowTag(true)) << std::endl; - std::cout << "Header->SubsystemID: " << static_cast(Header.GetSubsystemID()) << std::endl; - std::cout << "dtcID: " << static_cast(Header.GetID()) << std::endl; - std::cout << "rocID: " << static_cast(Header.GetLinkID()) << std::endl; - std::cout << "packetCount: " << static_cast(Header.GetPacketCount()) << std::endl; - std::cout << "EVB mode: " << static_cast(Header.GetEVBMode()) << std::endl; + std::cout << "timestamp: " << static_cast(Header->GetEventWindowTag().GetEventWindowTag(true)) << std::endl; + std::cout << "Header->SubsystemID: " << static_cast(Header->GetSubsystemID()) << std::endl; + std::cout << "dtcID: " << static_cast(Header->GetID()) << std::endl; + std::cout << "rocID: " << static_cast(Header->GetLinkID()) << std::endl; + std::cout << "packetCount: " << static_cast(Header->GetPacketCount()) << std::endl; + std::cout << "EVB mode: " << static_cast(Header->GetEVBMode()) << std::endl; std::cout << std::endl; } - void CaloDAQUtilities::printCaloPulse(CalorimeterFragment::CalorimeterHitReadoutPacket& Hit){ + void CaloDAQUtilities::printCaloPulse(CalorimeterFragment::CalorimeterHitReadoutPacket const& Hit){ std::cout << "[CaloHitsFromFragments] \tChNumber " << (int)Hit.ChannelNumber << std::endl; @@ -64,7 +63,7 @@ namespace mu2e { } - void CaloDAQUtilities::printWaveform(std::vector& Pulse){ + void CaloDAQUtilities::printWaveform(std::vector const& Pulse){ std::cout << "Waveform: {"; for (size_t i = 0; i < Pulse.size(); i++) { std::cout << Pulse[i]; @@ -76,8 +75,8 @@ namespace mu2e { } void CaloDAQUtilities::printAllHitInfo(int CrystalID, int SiPMID, - DTCLib::DTC_DataHeaderPacket &Header, - CalorimeterFragment::CalorimeterHitReadoutPacket& Hit, uint16_t& PulseMax){ + std::shared_ptr Header, + CalorimeterFragment::CalorimeterHitReadoutPacket const& Hit, uint16_t PulseMax){ std::cout << "Crystal ID: " << CrystalID << std::endl; std::cout << "SiPM ID: " << SiPMID << std::endl; @@ -87,7 +86,7 @@ namespace mu2e { // Text format: timestamp crystalID roID time nsamples samples... // Example: 1 201 402 660 18 0 0 0 0 1 17 51 81 91 83 68 60 58 52 42 33 23 16 - std::cout << "GREPMECAL: " << Header.GetEventWindowTag().GetEventWindowTag(true) << " "; + std::cout << "GREPMECAL: " << Header->GetEventWindowTag().GetEventWindowTag(true) << " "; std::cout << CrystalID << " "; std::cout << SiPMID << " "; std::cout << Hit.Time << " "; diff --git a/DAQ/src/CaloHitsFromFragments_module.cc b/DAQ/src/CaloHitsFromFragments_module.cc index e4cb480ff9..d074d34bf1 100644 --- a/DAQ/src/CaloHitsFromFragments_module.cc +++ b/DAQ/src/CaloHitsFromFragments_module.cc @@ -189,19 +189,14 @@ void art::CaloHitsFromFragments::produce(Event& event) { size_t totalSize = 0; size_t numCalFrags = 0; - std::vector> fragmentHandles; -#if ART_HEX_VERSION < 0x30900 - evt.getManyByType(fragmentHandles); -#else - fragmentHandles = evt.getMany>(); -#endif + std::vector> fragmentHandles = event.getMany>(); for (const auto& handle : fragmentHandles) { if (!handle.isValid() || handle->empty()) { continue; } - if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + if (handle->front().type() == mu2e::detail::FragmentType::MU2EEVENT) { for (const auto& cont : *handle) { mu2e::Mu2eEventFragment mef(cont); for (size_t ii = 0; ii < mef.calorimeter_block_count(); ++ii) { @@ -214,7 +209,7 @@ void art::CaloHitsFromFragments::produce(Event& event) { } } } else { - if (handle->front().type() == detail::FragmentType::CAL) { + if (handle->front().type() == mu2e::detail::FragmentType::CAL) { for (auto frag : *handle) { mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); analyze_calorimeter_(cc, calo_hits, caphri_hits); @@ -257,7 +252,7 @@ void art::CaloHitsFromFragments::analyze_calorimeter_( std::unique_ptr const& caphri_hits) { if (diagLevel_ > 1) { - caloDAQUtil_.printCaloFragmentInfo(f, cc); + caloDAQUtil_.printCaloFragmentInfo(cc); } for (size_t curBlockIdx = 0; curBlockIdx < cc.block_count(); curBlockIdx++) { @@ -294,7 +289,7 @@ void art::CaloHitsFromFragments::analyze_calorimeter_( caloDAQUtil_.printCaloFragmentHeader(hdr); } - if (hdr.GetPacketCount() == 0) + if (hdr->GetPacketCount() == 0) continue; auto calData = cc.GetCalorimeterData(curBlockIdx); diff --git a/DAQ/src/CaloRecoFromFragments_module.cc b/DAQ/src/CaloRecoFromFragments_module.cc index 95de63880d..cbcab35852 100644 --- a/DAQ/src/CaloRecoFromFragments_module.cc +++ b/DAQ/src/CaloRecoFromFragments_module.cc @@ -12,6 +12,7 @@ #include "art/Framework/Principal/Handle.h" #include "mu2e-artdaq-core/Overlays/CalorimeterFragment.hh" +#include "mu2e-artdaq-core/Overlays/Mu2eEventFragment.hh" #include "mu2e-artdaq-core/Overlays/FragmentType.hh" //-- insert calls to proditions ..for calodmap----- @@ -83,19 +84,14 @@ void art::CaloRecoFromFragments::produce(Event& event) { size_t totalSize = 0; size_t numCalFrags = 0; - std::vector> fragmentHandles; -#if ART_HEX_VERSION < 0x30900 - evt.getManyByType(fragmentHandles); -#else - fragmentHandles = evt.getMany>(); -#endif + std::vector> fragmentHandles = event.getMany>(); for (const auto& handle : fragmentHandles) { if (!handle.isValid() || handle->empty()) { continue; } - if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + if (handle->front().type() == mu2e::detail::FragmentType::MU2EEVENT) { for (const auto& cont : *handle) { mu2e::Mu2eEventFragment mef(cont); for (size_t ii = 0; ii < mef.calorimeter_block_count(); ++ii) { @@ -108,7 +104,7 @@ void art::CaloRecoFromFragments::produce(Event& event) { } } } else { - if (handle->front().type() == detail::FragmentType::CAL) { + if (handle->front().type() == mu2e::detail::FragmentType::CAL) { for (auto frag : *handle) { mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); analyze_calorimeter_(calodaqconds, cc, calo_digis); @@ -198,17 +194,17 @@ void art::CaloRecoFromFragments::analyze_calorimeter_( if (diagLevel_ > 1) { std::cout << "timestamp: " - << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) << std::endl; - std::cout << "hdr->SubsystemID: " << static_cast(hdr.GetSubsystemID()) << std::endl; - std::cout << "dtcID: " << static_cast(hdr.GetID()) << std::endl; - std::cout << "rocID: " << static_cast(hdr.GetLinkID()) << std::endl; - std::cout << "packetCount: " << static_cast(hdr.GetPacketCount()) << std::endl; - std::cout << "EVB mode: " << static_cast(hdr.GetEVBMode()) << std::endl; + << static_cast(hdr->GetEventWindowTag().GetEventWindowTag(true)) << std::endl; + std::cout << "hdr->SubsystemID: " << static_cast(hdr->GetSubsystemID()) << std::endl; + std::cout << "dtcID: " << static_cast(hdr->GetID()) << std::endl; + std::cout << "rocID: " << static_cast(hdr->GetLinkID()) << std::endl; + std::cout << "packetCount: " << static_cast(hdr->GetPacketCount()) << std::endl; + std::cout << "EVB mode: " << static_cast(hdr->GetEVBMode()) << std::endl; std::cout << std::endl; } - if (hdr.GetPacketCount() > 0) { // Parse phyiscs information from CAL packets + if (hdr->GetPacketCount() > 0) { // Parse phyiscs information from CAL packets auto calData = cc.GetCalorimeterData(curBlockIdx); if (calData == nullptr) { @@ -295,7 +291,7 @@ void art::CaloRecoFromFragments::analyze_calorimeter_( // Text format: timestamp crystalID roID time nsamples samples... // Example: 1 201 402 660 18 0 0 0 0 1 17 51 81 91 83 68 60 58 52 42 33 23 16 - std::cout << "GREPMECAL: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << " "; + std::cout << "GREPMECAL: " << hdr->GetEventWindowTag().GetEventWindowTag(true) << " "; std::cout << crystalID << " "; std::cout << roID << " "; std::cout << hits[hitIdx].first.Time << " "; diff --git a/DAQ/src/CrvDigisFromFragments_module.cc b/DAQ/src/CrvDigisFromFragments_module.cc index 876bb2c869..f2b6d35597 100644 --- a/DAQ/src/CrvDigisFromFragments_module.cc +++ b/DAQ/src/CrvDigisFromFragments_module.cc @@ -160,12 +160,12 @@ void CrvDigisFromFragments::produce(Event& event) { } auto hdr = block->GetHeader(); - if (hdr.GetSubsystemID() != 2) { + if (hdr->GetSubsystemID() != 2) { throw cet::exception("DATA") << " CRV packet does not have system ID 2"; } // Parse phyiscs information from the CRV packets - if (hdr.GetPacketCount() > 0) { + if (hdr->GetPacketCount() > 0) { auto crvRocHdr = cc.GetCRVROCStatusPacket(curBlockIdx); if (crvRocHdr == nullptr) { std::cerr << "Error retrieving CRV ROC Status Packet from DataBlock " << curBlockIdx @@ -221,12 +221,12 @@ void CrvDigisFromFragments::produce(Event& event) { } std::cout << std::endl; - std::cout << "timestamp: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << std::endl; - std::cout << "hdr->SubsystemID: " << hdr.GetSubsystemID() << std::endl; - std::cout << "hdr->DTCID: " << hdr.GetID() << std::endl; - std::cout << "rocID: " << hdr.GetLinkID() << std::endl; - std::cout << "packetCount: " << hdr.GetPacketCount() << std::endl; - std::cout << "EVB mode: " << hdr.GetEVBMode() << std::endl; + std::cout << "timestamp: " << hdr->GetEventWindowTag().GetEventWindowTag(true) << std::endl; + std::cout << "hdr->SubsystemID: " << hdr->GetSubsystemID() << std::endl; + std::cout << "hdr->DTCID: " << hdr->GetID() << std::endl; + std::cout << "rocID: " << hdr->GetLinkID() << std::endl; + std::cout << "packetCount: " << hdr->GetPacketCount() << std::endl; + std::cout << "EVB mode: " << hdr->GetEVBMode() << std::endl; // for(int i=7; i>=0; i--) { // std::cout << (adc_t) *(pos+8+i); @@ -253,7 +253,7 @@ void CrvDigisFromFragments::produce(Event& event) { std::cout << "}" << std::endl; #else // Text format: timestamp sipmID tdc nsamples sample_list - std::cout << "GREPMECRV: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << " "; + std::cout << "GREPMECRV: " << hdr->GetEventWindowTag().GetEventWindowTag(true) << " "; std::cout << crvHit.SiPMID << " "; std::cout << crvHit.HitTime << " "; auto hits = crvHit.Waveform(); @@ -268,7 +268,7 @@ void CrvDigisFromFragments::produce(Event& event) { } std::cout << "LOOP: " << eventNumber << " " << curBlockIdx << " " - << "(" << hdr.GetEventWindowTag().GetEventWindowTag(true) << ")" << std::endl; + << "(" << hdr->GetEventWindowTag().GetEventWindowTag(true) << ")" << std::endl; } // End debug output } // End parsing CRV packets diff --git a/DAQ/src/FragmentAna_module.cc b/DAQ/src/FragmentAna_module.cc index 6514e2da91..20b02dc88a 100644 --- a/DAQ/src/FragmentAna_module.cc +++ b/DAQ/src/FragmentAna_module.cc @@ -18,6 +18,7 @@ #include "fhiclcpp/ParameterSet.h" #include "mu2e-artdaq-core/Overlays/CalorimeterFragment.hh" #include "mu2e-artdaq-core/Overlays/FragmentType.hh" +#include "mu2e-artdaq-core/Overlays/Mu2eEventFragment.hh" #include "mu2e-artdaq-core/Overlays/TrackerFragment.hh" #include @@ -53,8 +54,8 @@ class FragmentAna : public art::EDAnalyzer { virtual void analyze(const art::Event& e) override; private: - void analyze_tracker_(const artdaq::Fragment& f); - void analyze_calorimeter_(const artdaq::Fragment& f); + void analyze_tracker_(const mu2e::TrackerFragment& cc); + void analyze_calorimeter_(const mu2e::CalorimeterFragment& cc); int diagLevel_; @@ -134,19 +135,15 @@ void FragmentAna::analyze(const art::Event& event) { size_t totalSize = 0; size_t numTrkFrags = 0; size_t numCalFrags = 0; - std::vector> fragmentHandles; -#if ART_HEX_VERSION < 0x30900 - evt.getManyByType(fragmentHandles); -#else - fragmentHandles = evt.getMany>(); -#endif + std::vector> fragmentHandles = + event.getMany>(); for (const auto& handle : fragmentHandles) { if (!handle.isValid() || handle->empty()) { continue; } - if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + if (handle->front().type() == mu2e::detail::FragmentType::MU2EEVENT) { for (const auto& cont : *handle) { mu2e::Mu2eEventFragment mef(cont); if (parseTRK_) { @@ -162,7 +159,7 @@ void FragmentAna::analyze(const art::Event& event) { if (parseCAL_) { for (size_t ii = 0; ii < mef.calorimeter_block_count(); ++ii) { auto pair = mef.calorimeterAtPtr(ii); - mu2e::TrackerFragment cc(pair); + mu2e::CalorimeterFragment cc(pair); analyze_calorimeter_(cc); totalSize += pair.second; @@ -171,20 +168,22 @@ void FragmentAna::analyze(const art::Event& event) { } } } else { - if (handle->front().type() == detail::FragmentType::TRK && parseTRK_) { + if (handle->front().type() == mu2e::detail::FragmentType::TRK && parseTRK_) { for (auto frag : *handle) { mu2e::TrackerFragment cc(frag.dataBegin(), frag.dataSizeBytes()); - analyze_tracker_(cc ); + analyze_tracker_(cc); totalSize += frag.dataSizeBytes(); numTrkFrags++; } - } else if (handle->front().type() == detail::FragmentType::CAL && parseCAL_) { - mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); - analyze_calorimeter_(cc); + } else if (handle->front().type() == mu2e::detail::FragmentType::CAL && parseCAL_) { + for (auto frag : *handle) { + mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_calorimeter_(cc); - totalSize += frag.dataSizeBytes(); - numCalFrags++; + totalSize += frag.dataSizeBytes(); + numCalFrags++; + } } } } @@ -217,7 +216,6 @@ void FragmentAna::analyze_tracker_(const mu2e::TrackerFragment& cc) { std::cout << std::endl; std::cout << "ArtFragment: "; std::cout << "\tBlock Count: " << std::dec << cc.block_count() << std::endl; - std::cout << "\tByte Count: " << f.dataSizeBytes() << std::endl; std::cout << std::endl; std::cout << "\t" << "====== Example Block Sizes ======" << std::endl; @@ -241,7 +239,7 @@ void FragmentAna::analyze_tracker_(const mu2e::TrackerFragment& cc) { auto hdr = block->GetHeader(); // Parse phyiscs information from TRK packets - if (hdr.GetPacketCount() > 0 && parseTRK_ > 0) { + if (hdr->GetPacketCount() > 0 && parseTRK_ > 0) { // Create the StrawDigi data products auto trkDataVec = cc.GetTrackerData(curBlockIdx); @@ -278,7 +276,7 @@ void FragmentAna::analyze_tracker_(const mu2e::TrackerFragment& cc) { } } - cc.ClearUpgradedPackets(); + // cc.ClearUpgradedPackets(); } void FragmentAna::analyze_calorimeter_(const mu2e::CalorimeterFragment& cc) { @@ -287,7 +285,6 @@ void FragmentAna::analyze_calorimeter_(const mu2e::CalorimeterFragment& cc) { std::cout << std::endl; std::cout << "ArtFragment: "; std::cout << "\tBlock Count: " << std::dec << cc.block_count() << std::endl; - std::cout << "\tByte Count: " << f.dataSizeBytes() << std::endl; std::cout << std::endl; std::cout << "\t" << "====== Example Block Sizes ======" << std::endl; @@ -310,7 +307,7 @@ void FragmentAna::analyze_calorimeter_(const mu2e::CalorimeterFragment& cc) { } auto hdr = block->GetHeader(); - if (hdr.GetPacketCount() > 0 && parseCAL_ > 0) { // Parse phyiscs information from CAL packets + if (hdr->GetPacketCount() > 0 && parseCAL_ > 0) { // Parse phyiscs information from CAL packets auto calData = cc.GetCalorimeterData(curBlockIdx); if (calData == nullptr) { diff --git a/DAQ/src/PrefetchDAQData_module.cc b/DAQ/src/PrefetchDAQData_module.cc index b00da21776..63c2942d5c 100644 --- a/DAQ/src/PrefetchDAQData_module.cc +++ b/DAQ/src/PrefetchDAQData_module.cc @@ -94,7 +94,6 @@ namespace mu2e { _sdcol = 0; _cfcol = 0; _tfcol = 0; - _allfcol = 0; if (_fetchCaloDigis) { auto cdH = evt.getValidHandle(_cdTag); diff --git a/DAQ/src/StrawAndCaloDigisFromFragments_module.cc b/DAQ/src/StrawAndCaloDigisFromFragments_module.cc index 88df16564b..700d8167fe 100644 --- a/DAQ/src/StrawAndCaloDigisFromFragments_module.cc +++ b/DAQ/src/StrawAndCaloDigisFromFragments_module.cc @@ -13,6 +13,7 @@ #include "art/Framework/Principal/Handle.h" #include "mu2e-artdaq-core/Overlays/CalorimeterFragment.hh" #include "mu2e-artdaq-core/Overlays/FragmentType.hh" +#include "mu2e-artdaq-core/Overlays/Mu2eEventFragment.hh" #include "mu2e-artdaq-core/Overlays/TrackerFragment.hh" #include "DataProducts/inc/TrkTypes.hh" @@ -56,10 +57,10 @@ class art::StrawAndCaloDigisFromFragments : public EDProducer { private: void - analyze_tracker_(const artdaq::Fragment& f, + analyze_tracker_(const mu2e::TrackerFragment& cc, std::unique_ptr const& straw_digis, std::unique_ptr const& straw_digi_adcs); - void analyze_calorimeter_(const artdaq::Fragment& f, + void analyze_calorimeter_(const mu2e::CalorimeterFragment& cc, std::unique_ptr const& calo_digis); int diagLevel_; @@ -118,19 +119,15 @@ void art::StrawAndCaloDigisFromFragments::produce(Event& event) { size_t totalSize = 0; size_t numTrkFrags = 0; size_t numCalFrags = 0; - std::vector> fragmentHandles; -#if ART_HEX_VERSION < 0x30900 - evt.getManyByType(fragmentHandles); -#else - fragmentHandles = evt.getMany>(); -#endif + std::vector> fragmentHandles = + event.getMany>(); for (const auto& handle : fragmentHandles) { if (!handle.isValid() || handle->empty()) { continue; } - if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + if (handle->front().type() == mu2e::detail::FragmentType::MU2EEVENT) { for (const auto& cont : *handle) { mu2e::Mu2eEventFragment mef(cont); if (parseTRK_) { @@ -146,7 +143,7 @@ void art::StrawAndCaloDigisFromFragments::produce(Event& event) { if (parseCAL_) { for (size_t ii = 0; ii < mef.calorimeter_block_count(); ++ii) { auto pair = mef.calorimeterAtPtr(ii); - mu2e::TrackerFragment cc(pair); + mu2e::CalorimeterFragment cc(pair); analyze_calorimeter_(cc, calo_digis); totalSize += pair.second; @@ -155,7 +152,7 @@ void art::StrawAndCaloDigisFromFragments::produce(Event& event) { } } } else { - if (handle->front().type() == detail::FragmentType::TRK && parseTRK_) { + if (handle->front().type() == mu2e::detail::FragmentType::TRK && parseTRK_) { for (auto frag : *handle) { mu2e::TrackerFragment cc(frag.dataBegin(), frag.dataSizeBytes()); analyze_tracker_(cc, straw_digis, straw_digi_adcs); @@ -163,12 +160,14 @@ void art::StrawAndCaloDigisFromFragments::produce(Event& event) { totalSize += frag.dataSizeBytes(); numTrkFrags++; } - } else if (handle->front().type() == detail::FragmentType::CAL && parseCAL_) { - mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); - analyze_calorimeter_(cc, calo_digis); + } else if (handle->front().type() == mu2e::detail::FragmentType::CAL && parseCAL_) { + for (auto frag : *handle) { + mu2e::CalorimeterFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_calorimeter_(cc, calo_digis); - totalSize += frag.dataSizeBytes(); - numCalFrags++; + totalSize += frag.dataSizeBytes(); + numCalFrags++; + } } } } @@ -201,16 +200,13 @@ void art::StrawAndCaloDigisFromFragments::produce(Event& event) { } // produce() void art::StrawAndCaloDigisFromFragments::analyze_tracker_( - const artdaq::Fragment& f, std::unique_ptr const& straw_digis, + const mu2e::TrackerFragment& cc, std::unique_ptr const& straw_digis, std::unique_ptr const& straw_digi_adcs) { - mu2e::TrackerFragment cc(f); - if (diagLevel_ > 1) { std::cout << std::endl; std::cout << "TrackerFragment: "; std::cout << "\tBlock Count: " << std::dec << cc.block_count() << std::endl; - std::cout << "\tByte Count: " << f.dataSizeBytes() << std::endl; std::cout << std::endl; std::cout << "\t" << "====== Example Block Sizes ======" << std::endl; @@ -255,18 +251,18 @@ void art::StrawAndCaloDigisFromFragments::analyze_tracker_( if (diagLevel_ > 1) { std::cout << "timestamp: " - << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) << std::endl; - std::cout << "hdr->SubsystemID: " << static_cast(hdr.GetSubsystemID()) << std::endl; - std::cout << "dtcID: " << static_cast(hdr.GetID()) << std::endl; - std::cout << "rocID: " << static_cast(hdr.GetLinkID()) << std::endl; - std::cout << "packetCount: " << static_cast(hdr.GetPacketCount()) << std::endl; - std::cout << "EVB mode: " << static_cast(hdr.GetEVBMode()) << std::endl; + << static_cast(hdr->GetEventWindowTag().GetEventWindowTag(true)) << std::endl; + std::cout << "hdr->SubsystemID: " << static_cast(hdr->GetSubsystemID()) << std::endl; + std::cout << "dtcID: " << static_cast(hdr->GetID()) << std::endl; + std::cout << "rocID: " << static_cast(hdr->GetLinkID()) << std::endl; + std::cout << "packetCount: " << static_cast(hdr->GetPacketCount()) << std::endl; + std::cout << "EVB mode: " << static_cast(hdr->GetEVBMode()) << std::endl; std::cout << std::endl; } // Parse phyiscs information from TRK packets - if (hdr.GetPacketCount() > 0 && parseTRK_ > 0) { + if (hdr->GetPacketCount() > 0 && parseTRK_ > 0) { // Create the StrawDigi data products auto trkDataVec = cc.GetTrackerData(curBlockIdx); @@ -328,13 +324,13 @@ void art::StrawAndCaloDigisFromFragments::analyze_tracker_( } std::cout << std::endl; - std::cout << "LOOP: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << " " + std::cout << "LOOP: " << hdr->GetEventWindowTag().GetEventWindowTag(true) << " " << curBlockIdx << std::endl; // Text format: timestamp strawidx tdc0 tdc1 nsamples sample0-11 // Example: 1 1113 36978 36829 12 1423 1390 1411 1354 2373 2392 2342 2254 1909 1611 1525 // 1438 - std::cout << "GREPMETRK: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << " "; + std::cout << "GREPMETRK: " << hdr->GetEventWindowTag().GetEventWindowTag(true) << " "; std::cout << sid.asUint16() << " "; std::cout << tdc[0] << " "; std::cout << tdc[1] << " "; @@ -354,19 +350,17 @@ void art::StrawAndCaloDigisFromFragments::analyze_tracker_( } } - cc.ClearUpgradedPackets(); + //cc.ClearUpgradedPackets(); } void art::StrawAndCaloDigisFromFragments::analyze_calorimeter_( - const artdaq::Fragment& f, std::unique_ptr const& calo_digis) { - - mu2e::CalorimeterFragment cc(f); + const mu2e::CalorimeterFragment& cc, + std::unique_ptr const& calo_digis) { if (diagLevel_ > 1) { std::cout << std::endl; std::cout << "ArtFragmentReader: "; std::cout << "\tBlock Count: " << std::dec << cc.block_count() << std::endl; - std::cout << "\tByte Count: " << f.dataSizeBytes() << std::endl; std::cout << std::endl; std::cout << "\t" << "====== Example Block Sizes ======" << std::endl; @@ -412,17 +406,17 @@ void art::StrawAndCaloDigisFromFragments::analyze_calorimeter_( if (diagLevel_ > 1) { std::cout << "timestamp: " - << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) << std::endl; - std::cout << "hdr->SubsystemID: " << static_cast(hdr.GetSubsystemID()) << std::endl; - std::cout << "dtcID: " << static_cast(hdr.GetID()) << std::endl; - std::cout << "rocID: " << static_cast(hdr.GetLinkID()) << std::endl; - std::cout << "packetCount: " << static_cast(hdr.GetPacketCount()) << std::endl; - std::cout << "EVB mode: " << static_cast(hdr.GetEVBMode()) << std::endl; + << static_cast(hdr->GetEventWindowTag().GetEventWindowTag(true)) << std::endl; + std::cout << "hdr->SubsystemID: " << static_cast(hdr->GetSubsystemID()) << std::endl; + std::cout << "dtcID: " << static_cast(hdr->GetID()) << std::endl; + std::cout << "rocID: " << static_cast(hdr->GetLinkID()) << std::endl; + std::cout << "packetCount: " << static_cast(hdr->GetPacketCount()) << std::endl; + std::cout << "EVB mode: " << static_cast(hdr->GetEVBMode()) << std::endl; std::cout << std::endl; } - if (hdr.GetPacketCount() > 0 && parseCAL_ > 0) { // Parse phyiscs information from CAL packets + if (hdr->GetPacketCount() > 0 && parseCAL_ > 0) { // Parse phyiscs information from CAL packets auto calData = cc.GetCalorimeterData(curBlockIdx); if (calData == nullptr) { @@ -505,7 +499,7 @@ void art::StrawAndCaloDigisFromFragments::analyze_calorimeter_( // Text format: timestamp crystalID roID time nsamples samples... // Example: 1 201 402 660 18 0 0 0 0 1 17 51 81 91 83 68 60 58 52 42 33 23 16 - std::cout << "GREPMECAL: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << " "; + std::cout << "GREPMECAL: " << hdr->GetEventWindowTag().GetEventWindowTag(true) << " "; std::cout << crystalID << " "; std::cout << apdID << " "; std::cout << hits[hitIdx].first.Time << " "; diff --git a/DAQ/src/StrawRecoFromFragments_module.cc b/DAQ/src/StrawRecoFromFragments_module.cc index 4280db0f8d..6a1dcb628f 100644 --- a/DAQ/src/StrawRecoFromFragments_module.cc +++ b/DAQ/src/StrawRecoFromFragments_module.cc @@ -13,6 +13,7 @@ #include "art/Framework/Principal/Handle.h" #include "mu2e-artdaq-core/Overlays/FragmentType.hh" #include "mu2e-artdaq-core/Overlays/TrackerFragment.hh" +#include "mu2e-artdaq-core/Overlays/Mu2eEventFragment.hh" #include "DataProducts/inc/TrkTypes.hh" #include "RecoDataProducts/inc/StrawDigiCollection.hh" @@ -93,19 +94,15 @@ void art::StrawRecoFromFragmnets::produce(Event& event) { size_t totalSize = 0; size_t numTrkFrags = 0; - std::vector> fragmentHandles; -#if ART_HEX_VERSION < 0x30900 - evt.getManyByType(fragmentHandles); -#else - fragmentHandles = evt.getMany>(); -#endif + std::vector> fragmentHandles = + event.getMany>(); for (const auto& handle : fragmentHandles) { if (!handle.isValid() || handle->empty()) { continue; } - if (handle->front().type() == detail::FragmentType::MU2EEVENT) { + if (handle->front().type() == mu2e::detail::FragmentType::MU2EEVENT) { for (const auto& cont : *handle) { mu2e::Mu2eEventFragment mef(cont); for (size_t ii = 0; ii < mef.tracker_block_count(); ++ii) { @@ -118,7 +115,7 @@ void art::StrawRecoFromFragmnets::produce(Event& event) { } } } else { - if (handle->front().type() == detail::FragmentType::TRK) { + if (handle->front().type() == mu2e::detail::FragmentType::TRK) { for (auto frag : *handle) { mu2e::TrackerFragment cc(frag.dataBegin(), frag.dataSizeBytes()); analyze_tracker_(cc, straw_digis, straw_digi_adcs); @@ -210,19 +207,19 @@ void art::StrawRecoFromFragmnets::analyze_tracker_( if (diagLevel_ > 1) { - std::cout << "timestamp: " << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) + std::cout << "timestamp: " << static_cast(hdr->GetEventWindowTag().GetEventWindowTag(true)) << std::endl; - std::cout << "hdr->SubsystemID: " << static_cast(hdr.GetSubsystemID()) << std::endl; - std::cout << "dtcID: " << static_cast(hdr.GetID()) << std::endl; - std::cout << "rocID: " << static_cast(hdr.GetLinkID()) << std::endl; - std::cout << "packetCount: " << static_cast(hdr.GetPacketCount()) << std::endl; - std::cout << "EVB mode: " << static_cast(hdr.GetEVBMode()) << std::endl; + std::cout << "hdr->SubsystemID: " << static_cast(hdr->GetSubsystemID()) << std::endl; + std::cout << "dtcID: " << static_cast(hdr->GetID()) << std::endl; + std::cout << "rocID: " << static_cast(hdr->GetLinkID()) << std::endl; + std::cout << "packetCount: " << static_cast(hdr->GetPacketCount()) << std::endl; + std::cout << "EVB mode: " << static_cast(hdr->GetEVBMode()) << std::endl; std::cout << std::endl; } // Parse phyiscs information from TRK packets - if (hdr.GetPacketCount() > 0 ) { + if (hdr->GetPacketCount() > 0) { // Create the StrawDigi data products auto trkDataVec = cc.GetTrackerData(curBlockIdx, useTrkADC_); @@ -284,13 +281,14 @@ void art::StrawRecoFromFragmnets::analyze_tracker_( } std::cout << std::endl; - std::cout << "LOOP: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << " " << curBlockIdx + std::cout << "LOOP: " << hdr->GetEventWindowTag().GetEventWindowTag(true) << " " + << curBlockIdx << std::endl; // Text format: timestamp strawidx tdc0 tdc1 nsamples sample0-11 // Example: 1 1113 36978 36829 12 1423 1390 1411 1354 2373 2392 2342 2254 1909 1611 1525 // 1438 - std::cout << "GREPMETRK: " << hdr.GetEventWindowTag().GetEventWindowTag(true) << " "; + std::cout << "GREPMETRK: " << hdr->GetEventWindowTag().GetEventWindowTag(true) << " "; std::cout << sid.asUint16() << " "; std::cout << tdc[0] << " "; std::cout << tdc[1] << " "; @@ -310,7 +308,7 @@ void art::StrawRecoFromFragmnets::analyze_tracker_( } } - cc.ClearUpgradedPackets(); + //cc.ClearUpgradedPackets(); } From 186c8ec423ca606be9c3429da55e2a22caafd982 Mon Sep 17 00:00:00 2001 From: gianipez Date: Fri, 18 Jun 2021 12:33:33 -0500 Subject: [PATCH 06/11] small fixes --- DAQ/src/CaloHitsFromFragments_module.cc | 11 +++++++---- DAQ/src/PrefetchDAQData_module.cc | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/DAQ/src/CaloHitsFromFragments_module.cc b/DAQ/src/CaloHitsFromFragments_module.cc index d074d34bf1..3d3e7d9c94 100644 --- a/DAQ/src/CaloHitsFromFragments_module.cc +++ b/DAQ/src/CaloHitsFromFragments_module.cc @@ -172,7 +172,7 @@ art::CaloHitsFromFragments::CaloHitsFromFragments(const art::EDProducer::Table(); + produces("calo"); produces("caphri"); } @@ -196,6 +196,9 @@ void art::CaloHitsFromFragments::produce(Event& event) { continue; } + if (diagLevel_ > 1) { + std::cout << "[CaloHitsFromFragments::produce] Fragment type of first Fragment in handle: " << static_cast(handle->front().type()) << std::endl; + } if (handle->front().type() == mu2e::detail::FragmentType::MU2EEVENT) { for (const auto& cont : *handle) { mu2e::Mu2eEventFragment mef(cont); @@ -223,8 +226,8 @@ void art::CaloHitsFromFragments::produce(Event& event) { if (numCalFrags == 0) { std::cout << "[CaloHitsFromFragments::produce] found no Calorimeter fragments!" << std::endl; - event.put(std::move(calo_hits)); - event.put(std::move(caphri_hits)); + event.put(std::move(calo_hits), "calo"); + event.put(std::move(caphri_hits), "caphri"); return; } @@ -242,7 +245,7 @@ void art::CaloHitsFromFragments::produce(Event& event) { } // Store the calo hits in the event - event.put(std::move(calo_hits)); + event.put(std::move(calo_hits), "calo"); event.put(std::move(caphri_hits), "caphri"); } // produce() diff --git a/DAQ/src/PrefetchDAQData_module.cc b/DAQ/src/PrefetchDAQData_module.cc index 63c2942d5c..b642afee2e 100644 --- a/DAQ/src/PrefetchDAQData_module.cc +++ b/DAQ/src/PrefetchDAQData_module.cc @@ -41,7 +41,7 @@ namespace mu2e { int _fetchStrawDigis; int _fetchCaloFragments; int _fetchTrkFragments; - int _fetchAllFragments; + int _fetchAllFragments; art::InputTag _cdTag; art::InputTag _sdTag; @@ -63,7 +63,7 @@ namespace mu2e { _fetchStrawDigis (pset.get ("fetchStrawDigis")), _fetchCaloFragments(pset.get ("fetchCaloFragments")), _fetchTrkFragments (pset.get ("fetchTrkFragments")), - _fetchAllFragments(pset.get("fetchAllFragments")), + _fetchAllFragments (pset.get ("fetchAllFragments")), _cdTag (pset.get("caloDigiCollectionTag")), _sdTag (pset.get("strawDigiCollectionTag")), _cfTag (pset.get("caloFragmentTag")), From a96ecad5c0829ad2e982894d10f4488f9660a620 Mon Sep 17 00:00:00 2001 From: gianipez Date: Fri, 18 Jun 2021 14:07:57 -0500 Subject: [PATCH 07/11] fixed env variables --- ups_install/install.sh | 2 +- ups_install/installTableFile.sh | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ups_install/install.sh b/ups_install/install.sh index 2feb953788..c6b29eb8a2 100644 --- a/ups_install/install.sh +++ b/ups_install/install.sh @@ -11,7 +11,7 @@ export ${MU2E_SETUP_BUILDOPTS} export DEBUG_LEVEL=${MUSE_BUILD} export PACKAGE_NAME=offline export PACKAGE_SOURCE=${MUSE_WORK_DIR}/Offline -export PACKAGE_VERSION=v10_00_00 +export PACKAGE_VERSION=v10_01_00 # Check that the installation directoy has been defined. if [ "${PRODUCTS_INSTALL}" = '' ];then diff --git a/ups_install/installTableFile.sh b/ups_install/installTableFile.sh index 2032ed7c52..b050956862 100755 --- a/ups_install/installTableFile.sh +++ b/ups_install/installTableFile.sh @@ -26,10 +26,10 @@ mu2e_artdaq_core_ver=`ups active | awk '$1 == "mu2e_artdaq_core" {print $2}'` # Define them all here and use them in the right spots in the table file. # Value of the "Qualifiers " keyword, excluding trig and debug/prof/opt -qualifiers_value=${COMPILER_CODE}:${MU2E_ART_SQUALIFIER} +qualifiers_value=${COMPILER_CODE}:${MUSE_ART} # Value that will be put into OFFLINE_FQ, excluding trig and debug/prof/opt -offline_fq_value=${COMPILER_CODE}.${MU2E_ART_SQUALIFIER} +offline_fq_value=${COMPILER_CODE}.${MUSE_ART} # Value that will be put into MU2E_UPS_QUALFIERS, which is used # to specify qualifiers for many of the ups products on which @@ -57,8 +57,8 @@ Qualifiers = "${qualifiers_value}:debug" envSet (OFFLINE_FQ, \${\${UPS_PROD_NAME_UC}_FS}.${offline_fq_value}.debug) envSet (MU2E_UPS_QUALIFIERS, +${mu2e_ups_qualifiers}:+debug ) setupRequired( art ${art_ver} -q +${mu2e_ups_qualifiers}:+debug ) - setupRequired( BTrk ${btrk_ver} -q +${mu2e_ups_qualifiers}:+debug:+p383b ) - setupRequired( KinKal ${kinkal_ver} -q +${mu2e_ups_qualifiers}:+debug:+p383b ) + setupRequired( BTrk ${btrk_ver} -q +${mu2e_ups_qualifiers}:+debug:+p392 ) + setupRequired( KinKal ${kinkal_ver} -q +${mu2e_ups_qualifiers}:+debug:+p392 ) setupRequired( heppdt ${heppdt_ver} -q +${mu2e_ups_qualifiers}:+debug ) setupRequired( xerces_c ${xerces_ver} -q +${mu2e_ups_qualifiers}:+debug ) @@ -72,8 +72,8 @@ Qualifiers = "${qualifiers_value}:prof" envSet (OFFLINE_FQ, \${\${UPS_PROD_NAME_UC}_FS}.${offline_fq_value}.prof) envSet (MU2E_UPS_QUALIFIERS, +\${mu2e_ups_qualifiers}:+prof ) setupRequired( art ${art_ver} -q +${mu2e_ups_qualifiers}:+prof ) - setupRequired( BTrk ${btrk_ver} -q +${mu2e_ups_qualifiers}:+prof:+p383b ) - setupRequired( KinKal ${kinkal_ver} -q +${mu2e_ups_qualifiers}:+prof:+p383b ) + setupRequired( BTrk ${btrk_ver} -q +${mu2e_ups_qualifiers}:+prof:+p392 ) + setupRequired( KinKal ${kinkal_ver} -q +${mu2e_ups_qualifiers}:+prof:+p392 ) setupRequired( heppdt ${heppdt_ver} -q +${mu2e_ups_qualifiers}:+prof ) setupRequired( xerces_c ${xerces_ver} -q +${mu2e_ups_qualifiers}:+prof ) @@ -87,11 +87,11 @@ Qualifiers = "${qualifiers_value}:trig:debug" envSet (OFFLINE_FQ, \${\${UPS_PROD_NAME_UC}_FS}.${offline_fq_value}.trig.debug) envSet (MU2E_UPS_QUALIFIERS, +${mu2e_ups_qualifiers}:+debug ) setupRequired( art ${art_ver} -q +${mu2e_ups_qualifiers}:+debug ) - setupRequired( BTrk ${btrk_ver} -q +${mu2e_ups_qualifiers}:+debug:+p383b ) - setupRequired( KinKal ${kinkal_ver} -q +${mu2e_ups_qualifiers}:+debug:+p383b ) + setupRequired( BTrk ${btrk_ver} -q +${mu2e_ups_qualifiers}:+debug:+p392 ) + setupRequired( KinKal ${kinkal_ver} -q +${mu2e_ups_qualifiers}:+debug:+p392 ) setupRequired( heppdt ${heppdt_ver} -q +${mu2e_ups_qualifiers}:+debug ) setupRequired( xerces_c ${xerces_ver} -q +${mu2e_ups_qualifiers}:+debug ) - setupRequired( mu2e_artdaq_core ${mu2e_artdaq_core_ver} -q ${mu2e_ups_qualifiers}:+${MU2E_ART_SQUALIFIER}:+debug ) + setupRequired( mu2e_artdaq_core ${mu2e_artdaq_core_ver} -q ${mu2e_ups_qualifiers}:+${MUSE_ART}:+debug ) Flavor = ANY Qualifiers = "${qualifiers_value}:trig:prof" @@ -103,11 +103,11 @@ Qualifiers = "${qualifiers_value}:trig:prof" envSet (OFFLINE_FQ, \${\${UPS_PROD_NAME_UC}_FS}.${offline_fq_value}.trig.prof) envSet (MU2E_UPS_QUALIFIERS, +\${mu2e_ups_qualifiers}:+prof ) setupRequired( art ${art_ver} -q +${mu2e_ups_qualifiers}:+prof ) - setupRequired( BTrk ${btrk_ver} -q +${mu2e_ups_qualifiers}:+prof:+p383b ) - setupRequired( KinKal ${kinkal_ver} -q +${mu2e_ups_qualifiers}:+prof:+p383b ) + setupRequired( BTrk ${btrk_ver} -q +${mu2e_ups_qualifiers}:+prof:+p392 ) + setupRequired( KinKal ${kinkal_ver} -q +${mu2e_ups_qualifiers}:+prof:+p392 ) setupRequired( heppdt ${heppdt_ver} -q +${mu2e_ups_qualifiers}:+prof ) setupRequired( xerces_c ${xerces_ver} -q +${mu2e_ups_qualifiers}:+prof ) - setupRequired( mu2e_artdaq_core ${mu2e_artdaq_core_ver} -q ${mu2e_ups_qualifiers}:+${MU2E_ART_SQUALIFIER}:+prof ) + setupRequired( mu2e_artdaq_core ${mu2e_artdaq_core_ver} -q ${mu2e_ups_qualifiers}:+${MUSE_ART}:+prof ) Common: Action = setup From 3374bca41ff22fb3997de13238a145b73d55b4d6 Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Tue, 13 Jul 2021 10:55:57 -0500 Subject: [PATCH 08/11] Fix a few header accesses --- DAQ/src/StrawHitRecoFromFragments_module.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/DAQ/src/StrawHitRecoFromFragments_module.cc b/DAQ/src/StrawHitRecoFromFragments_module.cc index 8467dd32e0..089d0ac9e4 100644 --- a/DAQ/src/StrawHitRecoFromFragments_module.cc +++ b/DAQ/src/StrawHitRecoFromFragments_module.cc @@ -288,13 +288,13 @@ void art::StrawHitRecoFromFragments::analyze_tracker_( if (_diagLevel > 1) { - std::cout << "timestamp: " << static_cast(hdr.GetEventWindowTag().GetEventWindowTag(true)) + std::cout << "timestamp: " << static_cast(hdr->GetEventWindowTag().GetEventWindowTag(true)) << std::endl; - std::cout << "hdr->SubsystemID: " << static_cast(hdr.GetSubsystemID()) << std::endl; - std::cout << "dtcID: " << static_cast(hdr.GetID()) << std::endl; - std::cout << "rocID: " << static_cast(hdr.GetLinkID()) << std::endl; - std::cout << "packetCount: " << static_cast(hdr.GetPacketCount()) << std::endl; - std::cout << "EVB mode: " << static_cast(hdr.GetEVBMode()) << std::endl; + std::cout << "hdr->SubsystemID: " << static_cast(hdr->GetSubsystemID()) << std::endl; + std::cout << "dtcID: " << static_cast(hdr->GetID()) << std::endl; + std::cout << "rocID: " << static_cast(hdr->GetLinkID()) << std::endl; + std::cout << "packetCount: " << static_cast(hdr->GetPacketCount()) << std::endl; + std::cout << "EVB mode: " << static_cast(hdr->GetEVBMode()) << std::endl; std::cout << std::endl; } @@ -303,7 +303,7 @@ void art::StrawHitRecoFromFragments::analyze_tracker_( if (_fittype != mu2e::TrkHitReco::FitType::firmwarepmp) getADC = true; // Parse phyiscs information from TRK packets - if (hdr.GetPacketCount() > 0) { + if (hdr->GetPacketCount() > 0) { // Create the StrawDigi data products auto trkDataVec = cc.GetTrackerData(curBlockIdx,getADC); From 2575e7ccdbb7c7d84a8da9604d3828c57ca29bb6 Mon Sep 17 00:00:00 2001 From: eflumerf <61473357+eflumerf@users.noreply.github.com> Date: Mon, 19 Jul 2021 12:14:57 -0500 Subject: [PATCH 09/11] Update .muse --- .muse | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.muse b/.muse index 4e520ab6ad..cadd337409 100644 --- a/.muse +++ b/.muse @@ -1,5 +1,5 @@ # prefer to build with this environment -ENVSET p008 +ENVSET p010 # add these to python path PYTHONPATH TrackerAlignment/scripts PYTHONPATH Trigger/python From 2100a431f9b9ebde56288647b9b35cd7b49cae48 Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Mon, 19 Jul 2021 14:38:10 -0500 Subject: [PATCH 10/11] Add Offline/ prefix to local includes --- DAQ/src/ArtBinaryPacketsFromDigis_module.cc | 2 +- DAQ/src/CaloRecoFromFragments_module.cc | 8 ++++---- DAQ/src/StrawAndCaloDigisFromFragments_module.cc | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DAQ/src/ArtBinaryPacketsFromDigis_module.cc b/DAQ/src/ArtBinaryPacketsFromDigis_module.cc index 001247f2cc..19c39879e7 100644 --- a/DAQ/src/ArtBinaryPacketsFromDigis_module.cc +++ b/DAQ/src/ArtBinaryPacketsFromDigis_module.cc @@ -42,7 +42,7 @@ #include "Offline/RecoDataProducts/inc/CrvDigiCollection.hh" #include "Offline/RecoDataProducts/inc/StrawDigiCollection.hh" #include "Offline/RecoDataProducts/inc/StrawHitCollection.hh" -//#include "DAQDataProducts/inc/DataBlockCollection.hh" +//#include "Offline/DAQDataProducts/inc/DataBlockCollection.hh" #include "Offline/ProditionsService/inc/ProditionsHandle.hh" #include "Offline/CaloConditions/inc/CaloDAQMap.hh" diff --git a/DAQ/src/CaloRecoFromFragments_module.cc b/DAQ/src/CaloRecoFromFragments_module.cc index cbcab35852..20f2906787 100644 --- a/DAQ/src/CaloRecoFromFragments_module.cc +++ b/DAQ/src/CaloRecoFromFragments_module.cc @@ -16,12 +16,12 @@ #include "mu2e-artdaq-core/Overlays/FragmentType.hh" //-- insert calls to proditions ..for calodmap----- -#include "CaloConditions/inc/CaloDAQMap.hh" -#include "ProditionsService/inc/ProditionsHandle.hh" +#include "Offline/CaloConditions/inc/CaloDAQMap.hh" +#include "Offline/ProditionsService/inc/ProditionsHandle.hh" //------------------------------------------------- -#include "DAQ/inc/CaloDAQUtilities.hh" -#include "RecoDataProducts/inc/CaloDigi.hh" +#include "Offline/DAQ/inc/CaloDAQUtilities.hh" +#include "Offline/RecoDataProducts/inc/CaloDigi.hh" #include diff --git a/DAQ/src/StrawAndCaloDigisFromFragments_module.cc b/DAQ/src/StrawAndCaloDigisFromFragments_module.cc index 700d8167fe..5bae698dd8 100644 --- a/DAQ/src/StrawAndCaloDigisFromFragments_module.cc +++ b/DAQ/src/StrawAndCaloDigisFromFragments_module.cc @@ -16,10 +16,10 @@ #include "mu2e-artdaq-core/Overlays/Mu2eEventFragment.hh" #include "mu2e-artdaq-core/Overlays/TrackerFragment.hh" -#include "DataProducts/inc/TrkTypes.hh" -#include "RecoDataProducts/inc/CaloDigi.hh" -#include "RecoDataProducts/inc/ProtonBunchTime.hh" -#include "RecoDataProducts/inc/StrawDigiCollection.hh" +#include "Offline/DataProducts/inc/TrkTypes.hh" +#include "Offline/RecoDataProducts/inc/CaloDigi.hh" +#include "Offline/RecoDataProducts/inc/ProtonBunchTime.hh" +#include "Offline/RecoDataProducts/inc/StrawDigiCollection.hh" #include From 3469a971f7d316ae5fe314e8d8d0ebdff1739cc6 Mon Sep 17 00:00:00 2001 From: Eric Flumerfelt Date: Wed, 21 Jul 2021 08:50:04 -0500 Subject: [PATCH 11/11] Update Fragment retreival for StrawHitRecoFromFragments. --- DAQ/src/StrawHitRecoFromFragments_module.cc | 66 +++++++++++++++++---- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/DAQ/src/StrawHitRecoFromFragments_module.cc b/DAQ/src/StrawHitRecoFromFragments_module.cc index 089d0ac9e4..62b8a78685 100644 --- a/DAQ/src/StrawHitRecoFromFragments_module.cc +++ b/DAQ/src/StrawHitRecoFromFragments_module.cc @@ -41,6 +41,7 @@ #include "mu2e-artdaq-core/Overlays/CalorimeterFragment.hh" #include "mu2e-artdaq-core/Overlays/FragmentType.hh" #include "mu2e-artdaq-core/Overlays/TrackerFragment.hh" +#include "mu2e-artdaq-core/Overlays/Mu2eEventFragment.hh" #include #include "TH1F.h" @@ -116,7 +117,7 @@ class art::StrawHitRecoFromFragments : public art::EDProducer { TH1F* _maxiter; // helper function // - void analyze_tracker_(const artdaq::Fragment& f, std::unique_ptr const& shCol, + void analyze_tracker_(const mu2e::TrackerFragment& cc, std::unique_ptr const& shCol, std::unique_ptr const& chCol, mu2e::StrawHitRecoUtils &shrUtils, mu2e::TrackerStatus const& trackerStatus, mu2e::StrawResponse const& srep, const mu2e::CaloClusterCollection* caloClusters, mu2e::Tracker const& tt ); @@ -194,8 +195,33 @@ void art::StrawHitRecoFromFragments::produce(art::Event& event) auto const& srep = _strawResponse_h.get(event.id()); //_tfTag = art::InputTag("test"); - art::Handle trkFragments; - event.getByLabel(_tfTag, trkFragments); + + size_t numTrkFrags = 0; + std::vector> fragmentHandles = + event.getMany>(); + + for (const auto& handle : fragmentHandles) { + if (!handle.isValid() || handle->empty()) { + continue; + } + + if (handle->front().type() == mu2e::detail::FragmentType::MU2EEVENT) { + for (const auto& cont : *handle) { + mu2e::Mu2eEventFragment mef(cont); + for (size_t ii = 0; ii < mef.tracker_block_count(); ++ii) { + numTrkFrags++; + } + } + } + else { + if (handle->front().type() == mu2e::detail::FragmentType::TRK) { + for (auto frag : *handle) { + numTrkFrags++; + } + } + } + } + //auto sdH = event.getValidHandle(_sdctoken); //const StrawDigiCollection& sdcol(*sdH); @@ -223,14 +249,13 @@ void art::StrawHitRecoFromFragments::produce(art::Event& event) } std::unique_ptr chCol(new mu2e::ComboHitCollection()); - if (!trkFragments.isValid()) { + if (numTrkFrags == 0) { std::cout << "[StrawAndCaloDigisFromFragments::produce] found no Tracker fragments!" << std::endl; if(_writesh)event.put(std::move(shCol)); event.put(std::move(chCol)); return; } - size_t numTrkFrags = trkFragments->size(); if(_writesh){ shCol->reserve(numTrkFrags); @@ -241,9 +266,29 @@ void art::StrawHitRecoFromFragments::produce(art::Event& event) _diagLevel, _maxiter, _mask, nplanes, npanels, _writesh, _minT, _maxT, _minE, _maxE, _filter, _flagXT, _ctE, _ctMinT, _ctMaxT, _usecc, _clusterDt, numTrkFrags); + for (const auto& handle : fragmentHandles) { + if (!handle.isValid() || handle->empty()) { + continue; + } - for (size_t idx = 0; idx < numTrkFrags; ++idx) { - analyze_tracker_((*trkFragments)[idx], shCol, chCol, shrUtils, trackerStatus, srep, caloClusters, tt); + if (handle->front().type() == mu2e::detail::FragmentType::MU2EEVENT) { + for (const auto& cont : *handle) { + mu2e::Mu2eEventFragment mef(cont); + for (size_t ii = 0; ii < mef.tracker_block_count(); ++ii) { + auto pair = mef.trackerAtPtr(ii); + mu2e::TrackerFragment cc(pair); + analyze_tracker_(cc, shCol, chCol, shrUtils, trackerStatus, srep, caloClusters, tt); + } + } + } + else { + if (handle->front().type() == mu2e::detail::FragmentType::TRK) { + for (auto frag : *handle) { + mu2e::TrackerFragment cc(frag.dataBegin(), frag.dataSizeBytes()); + analyze_tracker_(cc, shCol, chCol, shrUtils, trackerStatus, srep, caloClusters, tt); + } + } + } } if(_writesh)event.put(std::move(shCol)); @@ -252,19 +297,16 @@ void art::StrawHitRecoFromFragments::produce(art::Event& event) void art::StrawHitRecoFromFragments::analyze_tracker_( - const artdaq::Fragment& f, std::unique_ptr const& shCol, + const mu2e::TrackerFragment& cc, std::unique_ptr const& shCol, std::unique_ptr const& chCol, mu2e::StrawHitRecoUtils &shrUtils, mu2e::TrackerStatus const& trackerStatus, mu2e::StrawResponse const& srep, const mu2e::CaloClusterCollection* caloClusters, mu2e::Tracker const& tt ) { - mu2e::TrackerFragment cc(f); - if (_diagLevel > 1) { std::cout << std::endl; std::cout << "TrackerFragment: "; std::cout << "\tBlock Count: " << std::dec << cc.block_count() << std::endl; - std::cout << "\tByte Count: " << f.dataSizeBytes() << std::endl; std::cout << std::endl; std::cout << "\t" << "====== Example Block Sizes ======" << std::endl; @@ -333,7 +375,7 @@ void art::StrawHitRecoFromFragments::analyze_tracker_( } } } - cc.ClearUpgradedPackets(); + //cc.ClearUpgradedPackets(); }