diff --git a/core/base/CMakeLists.txt b/core/base/CMakeLists.txt index 567c4c3a0ed1f3ff957e67b2b0d2a9fdecf1b8af..04e2bcd435ad75bd9fdd55dff36d7c05d87f3ee6 100644 --- a/core/base/CMakeLists.txt +++ b/core/base/CMakeLists.txt @@ -17,11 +17,11 @@ set(SRCS CbmMatchRecoToMC.cxx CbmTrackingDetectorInterfaceBase.cxx draw/CbmDrawHist.cxx - report/CbmReport.cxx + report/CbmReport.cxx report/CbmStudyReport.cxx report/CbmSimulationReport.cxx report/CbmTextReportElement.cxx - report/CbmHtmlReportElement.cxx + report/CbmHtmlReportElement.cxx report/CbmLatexReportElement.cxx utils/CbmUtils.cxx utils/CbmGeometryUtils.cxx @@ -32,22 +32,24 @@ set(SRCS set(LIBRARY_NAME CbmBase) set(LINKDEF ${LIBRARY_NAME}LinkDef.h) -set(PUBLIC_DEPENDENCIES - CbmData + +set(PUBLIC_DEPENDENCIES + CbmData FairRoot::Base - ROOT::Core - ROOT::Gpad + GSL + ROOT::Core + ROOT::Gpad ROOT::Hist ) -set(PRIVATE_DEPENDENCIES - FairLogger::FairLogger - FairRoot::GeoBase +set(PRIVATE_DEPENDENCIES + FairLogger::FairLogger + FairRoot::GeoBase Boost::filesystem - ROOT::Geom - ROOT::Graf - ROOT::MathCore - ROOT::RIO + ROOT::Geom + ROOT::Graf + ROOT::MathCore + ROOT::RIO ROOT::Tree ) diff --git a/core/base/CbmDigiManager.h b/core/base/CbmDigiManager.h index 29e8062610a33a123a86df21f69f326536d6ab1b..6a88c15bf95e229733b9c50612e17694ef6e4028 100644 --- a/core/base/CbmDigiManager.h +++ b/core/base/CbmDigiManager.h @@ -23,6 +23,7 @@ #include <boost/any.hpp> // for any_cast, bad_any_cast (ptr... #include <boost/exception/exception.hpp> // for clone_impl, error_info_inje... +#include <gsl/span> #include <iosfwd> // for string #include <map> // for map, map<>::mapped_type #include <vector> // for vector @@ -69,6 +70,25 @@ public: return nullptr; } + template<class Digi> + gsl::span<const Digi> GetArray() const + { + assert(fIsInitialised); + ECbmModuleId system = Digi::GetSystem(); + + auto branch = fBranches.find(system); + if (branch == fBranches.end()) { + LOG(error) << "Failed to find branch for Digi of type " << Digi::GetClassName(); + return {}; + } + + boost::any container = branch->second->GetBranchContainer(); + LOG_IF(fatal, container.type() != typeid(const std::vector<Digi>*)) + << "Digis of type " << Digi::GetClassName() << " not stored with std::vector"; + + return *boost::any_cast<const std::vector<Digi>*>(container); + } + /** @brief Access to a digi branch ** @param system System identifier ** @return Digi branch diff --git a/reco/detectors/sts/CbmRecoSts.cxx b/reco/detectors/sts/CbmRecoSts.cxx index 1ed7eb1ab49d818f73313a11ef259ffbf8319b65..d9df65037620226d4e4ca246a120c856bb2e551c 100644 --- a/reco/detectors/sts/CbmRecoSts.cxx +++ b/reco/detectors/sts/CbmRecoSts.cxx @@ -518,14 +518,13 @@ void CbmRecoSts::ProcessData(CbmEvent* event) // --- Number of input digis fTimer.Start(); Int_t nDigis = (event ? event->GetNofData(ECbmDataType::kStsDigi) : fDigiManager->GetNofDigis(ECbmModuleId::kSts)); - + auto digis = fDigiManager->GetArray<CbmStsDigi>(); // --- Distribute digis to modules //#pragma omp parallel for schedule(static) if(fParallelism_enabled) for (Int_t iDigi = 0; iDigi < nDigis; iDigi++) { Int_t digiIndex = (event ? event->GetIndex(ECbmDataType::kStsDigi, iDigi) : iDigi); - const CbmStsDigi* digi = fDigiManager->Get<const CbmStsDigi>(digiIndex); - assert(digi); + const CbmStsDigi* digi = &digis[digiIndex]; // Check system ID. There are pulser digis in which will be ignored here. Int_t systemId = CbmAddress::GetSystemId(digi->GetAddress());