From 619e7553ebaa013a93398ff9b490c97aa5b82869 Mon Sep 17 00:00:00 2001 From: Roel Aaij Date: Tue, 16 Jun 2020 12:26:38 +0200 Subject: [PATCH 1/5] Allow raw banks to come from different raw event locations DumpRawBanks split into TransposeRawBanks and DumpRawBanks. --- Dumpers/BinaryDumpers/options/dump_banks.py | 14 +- Dumpers/BinaryDumpers/src/DumpRawBanks.cpp | 205 ++++++----------- Dumpers/BinaryDumpers/src/DumpRawBanks.h | 84 ------- .../BinaryDumpers/src/TransposeRawBanks.cpp | 212 ++++++++++++++++++ Rec/Allen/options/run_allen_in_gaudi.py | 14 +- 5 files changed, 291 insertions(+), 238 deletions(-) delete mode 100644 Dumpers/BinaryDumpers/src/DumpRawBanks.h create mode 100644 Dumpers/BinaryDumpers/src/TransposeRawBanks.cpp diff --git a/Dumpers/BinaryDumpers/options/dump_banks.py b/Dumpers/BinaryDumpers/options/dump_banks.py index 95f37bd13da..1106de77dd9 100644 --- a/Dumpers/BinaryDumpers/options/dump_banks.py +++ b/Dumpers/BinaryDumpers/options/dump_banks.py @@ -19,7 +19,7 @@ from Configurables import DumpUTGeometry from Configurables import RootHistCnv__PersSvc from Configurables import (VPClus, createODIN, DumpRawBanks, DumpUTHits, DumpFTHits, DumpMuonCoords, DumpMuonCommonHits, - MuonRec, PrepareMuonHits) + MuonRec, PrepareMuonHits, TransposeRawBanks) # new MC in tmp/ #DDDBtag = "dddb-20171010" @@ -59,14 +59,12 @@ dec_seq.Members = [ ApplicationMgr().ExtSvc += [DumpUTGeometry()] # Dump raw banks and UT, FT and muon hits -dump_banks = DumpRawBanks(BankTypes=["VP", "UT", "FTCluster", "Muon"]) -#dump_banks.OutputDirectory = "/eos/lhcb/wg/rta/WP6/Allen/binary_input_2019-07/minbias/mag_down/banks" -dump_muon_coords = DumpMuonCoords() -#dump_muon_coords.OutputDirectory = "/eos/lhcb/wg/rta/WP6/Allen/binary_input_2019-07/minbias/mag_down/muon_coords" -dump_muon_hits = DumpMuonCommonHits() -#dump_muon_hits.OutputDirectory = "/eos/lhcb/wg/rta/WP6/Allen/binary_input_2019-07/minbias/mag_down/muon_common_hits" +transpose_banks = TransposeRawBanks( + BankTypes=["VP", "UT", "FTCluster", "Muon", "ODIN"], + RawEventLocations=["DAQ/RawEvent"]) +dump_banks = DumpRawBanks() dump_seq = GaudiSequencer("DumpSeq") -dump_seq.Members += [dump_banks] +dump_seq.Members += [transpose_banks, dump_banks] ApplicationMgr().TopAlg = [dec_seq, dump_seq] diff --git a/Dumpers/BinaryDumpers/src/DumpRawBanks.cpp b/Dumpers/BinaryDumpers/src/DumpRawBanks.cpp index b46c2bc82e3..9b21d257136 100644 --- a/Dumpers/BinaryDumpers/src/DumpRawBanks.cpp +++ b/Dumpers/BinaryDumpers/src/DumpRawBanks.cpp @@ -8,17 +8,20 @@ * granted to it by virtue of its status as an Intergovernmental Organization * * or submit itself to any jurisdiction. * \*****************************************************************************/ -#include +#include +#include +#include +#include +#include #include -#include - +#include +#include #include -#include -#include +#include +#include -#include "DumpRawBanks.h" #include "Utils.h" namespace { @@ -27,152 +30,78 @@ namespace { namespace fs = boost::filesystem; } // namespace -// Parsers are in namespace LHCb for ADL to work. -namespace LHCb { - - StatusCode parse(std::set& s, const std::string& in) - { - std::set ss; - using Gaudi::Parsers::parse; - auto sc = parse(ss, in); - if (!sc) return sc; - s.clear(); - try { - std::transform(begin(ss), end(ss), std::inserter(s, begin(s)), [](const std::string& s) { - RawBank::BankType t {}; - auto sc = parse(t, s); - if (!sc) throw GaudiException("Bad Parse", "", sc); - return t; - }); - } catch (const GaudiException& ge) { - return ge.code(); - } - return StatusCode::SUCCESS; - } - - StatusCode parse(RawBank::BankType& result, const std::string& in) - { - static std::unordered_map types; - if (types.empty()) { - for (int t = 0; t < RawBank::LastType; ++t) { - auto bt = static_cast(t); - types.emplace(RawBank::typeName(bt), bt); - } - } - - // This takes care of quoting - std::string input; - using Gaudi::Parsers::parse; - auto sc = parse(input, in); - if (!sc) return sc; - - auto it = types.find(input); - if (it != end(types)) { - result = it->second; - return StatusCode::SUCCESS; - } - else { - return StatusCode::FAILURE; - } - } - - inline std::ostream& toStream(const RawBank::BankType& bt, std::ostream& s) - { - return s << "'" << RawBank::typeName(bt) << "'"; - } -} // namespace LHCb - -// Declaration of the Algorithm Factory -DECLARE_COMPONENT(DumpRawBanks) - -DumpRawBanks::DumpRawBanks(const std::string& name, ISvcLocator* pSvcLocator) : - Transformer( - name, - pSvcLocator, - // Inputs - {KeyValue {"RawEventLocation", LHCb::RawEventLocation::Default}, - KeyValue {"ODINLocation", LHCb::ODINLocation::Default}}, - // Output - KeyValue {"AllenRawInput", "Allen/Raw/Input"}) -{} - -StatusCode DumpRawBanks::initialize() -{ - info() << "Dumping RawBank Types:"; - for (const auto bankType : m_bankTypes) { - auto tn = LHCb::RawBank::typeName(bankType); - info() << " " << tn; - if (!DumpUtils::createDirectory(outputDirectory(bankType))) { - error() << "Failed to create directory " << m_outputDirectory.value() << endmsg; - return StatusCode::FAILURE; - } - m_histos[tn] = book1D(tn, -0.5, 603.5, 151); - } - info() << endmsg; - return StatusCode::SUCCESS; -} - -std::array, LHCb::RawBank::LastType> DumpRawBanks::operator()( - const LHCb::RawEvent& rawEvent, - const LHCb::ODIN& odin) const -{ +/** @class DumpRawBanks DumpRawBanks.h + * Algorithm that dumps raw banks to binary files. + * + * @author Roel Aaij + * @date 2018-08-27 + */ +class DumpRawBanks : public Gaudi::Functional::Consumer, LHCb::RawBank::LastType> const&, LHCb::ODIN const& )> { +public: + /// Standard constructor + DumpRawBanks( const std::string& name, ISvcLocator* pSvcLocator ); - std::array, LHCb::RawBank::LastType> output; + StatusCode initialize() override; - for (const auto bankType : m_bankTypes) { - auto tBanks = rawEvent.banks(bankType); - const uint32_t number_of_rawbanks = tBanks.size(); - uint32_t offset = 0; + void operator()( std::array, LHCb::RawBank::LastType> const& banks, + LHCb::ODIN const& odin ) const override; - std::vector bankOffsets; - std::vector bankData; - bankOffsets.push_back(0); +private: + std::string outputDirectory( LHCb::RawBank::BankType bankType ) const; - for (auto& bank : tBanks) { - const uint32_t sourceID = static_cast(bank->sourceID()); - bankData.push_back(sourceID); + mutable bool m_createdDirectories{false}; + mutable std::mutex m_dirMutex; - offset++; + Gaudi::Property m_outputDirectory{this, "OutputDirectory", "banks"}; +}; - auto bStart = bank->begin(); - auto bEnd = bank->end(); +DumpRawBanks::DumpRawBanks( const std::string& name, ISvcLocator* pSvcLocator ) + : Consumer( + name, pSvcLocator, + // Inputs + {KeyValue{"BanksLocation", "Allen/Raw/Input"}, KeyValue{"ODINLocation", LHCb::ODINLocation::Default}} ) {} - // Debug/testing histogram with the sizes of the binary data per bank - auto tn = LHCb::RawBank::typeName(bankType); - auto hit = m_histos.find(tn); - if (UNLIKELY(hit == end(m_histos))) { - warning() << "No histogram booked for bank type " << tn << endmsg; - } - else { - hit->second->fill((bEnd - bStart) * sizeof(uint32_t)); - } - - while (bStart != bEnd) { - const uint32_t raw_data = *(bStart); - bankData.push_back(raw_data); +StatusCode DumpRawBanks::initialize() { + debug() << endmsg; + return StatusCode::SUCCESS; +} - bStart++; - offset++; +void DumpRawBanks::operator()( std::array, LHCb::RawBank::LastType> const& banks, + LHCb::ODIN const& odin ) const { + if ( !m_createdDirectories ) { + std::lock_guard{m_dirMutex}; + if ( !m_createdDirectories ) { + for ( int bt = 0; bt != LHCb::RawBank::LastType; ++bt ) { + auto bankType = static_cast( bt ); + if ( !banks[bankType].empty() ) { + auto tn = LHCb::RawBank::typeName( bankType ); + if ( !DumpUtils::createDirectory( outputDirectory( bankType ) ) ) { + throw GaudiException{"Failed to create directory " + m_outputDirectory.value(), name(), + StatusCode::FAILURE}; + } + } } - bankOffsets.push_back(offset * sizeof(uint32_t)); + m_createdDirectories = true; } + } - // Dumping number_of_rawbanks + 1 offsets! - DumpUtils::Writer bank_buffer; - bank_buffer.write(number_of_rawbanks, bankOffsets, bankData); - output[bankType] = bank_buffer.buffer(); - if (m_dumpToFile) { - DumpUtils::FileWriter outfile = - outputDirectory(bankType) + "/" + to_string(odin.runNumber()) + "_" + to_string(odin.eventNumber()) + ".bin"; - outfile.write(bank_buffer.buffer()); + for ( int bt = 0; bt != LHCb::RawBank::LastType; ++bt ) { + auto bankType = static_cast( bt ); + auto const& rawBanks = banks[bankType]; + if ( !rawBanks.empty() ) { + DumpUtils::FileWriter outfile = outputDirectory( bankType ) + "/" + to_string( odin.runNumber() ) + "_" + + to_string( odin.eventNumber() ) + ".bin"; + outfile.write( rawBanks ); } } - return output; } -std::string DumpRawBanks::outputDirectory(LHCb::RawBank::BankType bankType) const -{ - auto tn = LHCb::RawBank::typeName(bankType); - auto dir = fs::path {m_outputDirectory.value()} / tn; +std::string DumpRawBanks::outputDirectory( LHCb::RawBank::BankType bankType ) const { + auto tn = LHCb::RawBank::typeName( bankType ); + auto dir = fs::path{m_outputDirectory.value()} / tn; return dir.string(); } + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT( DumpRawBanks ) diff --git a/Dumpers/BinaryDumpers/src/DumpRawBanks.h b/Dumpers/BinaryDumpers/src/DumpRawBanks.h deleted file mode 100644 index e1b3b0b3d87..00000000000 --- a/Dumpers/BinaryDumpers/src/DumpRawBanks.h +++ /dev/null @@ -1,84 +0,0 @@ -/*****************************************************************************\ -* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * -* * -* This software is distributed under the terms of the GNU General Public * -* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef DUMPRAWBANKS_H -#define DUMPRAWBANKS_H 1 - -#include -#include -#include -#include -#include - -// Include files -#include "GaudiAlg/Transformer.h" -#include -#include -#include -#include -#include - -// Parsers for the bank type property are put in namespace LHCb for -// ADL to work. -namespace LHCb { - - StatusCode parse(RawBank::BankType& result, const std::string& in); - StatusCode parse(std::set& s, const std::string& in); -} // namespace LHCb - -// Raw bank format: -// ----------------------------------------------------------------------------- -// name | type | size [bytes] | array_size -// ============================================================================= -// Once -// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// number_of_rawbanks | uint32_t | 4 -// ----------------------------------------------------------------------------- -// raw_bank_offset | uint32_t | number_of_rawbanks * 4 -// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// for each raw bank: -// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// sourceID | uint32_t | 4 | -// ------------------------------------------------------------------------------ -// bank_data | char | variable -// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -/** @class DumpRawBanks DumpRawBanks.h - * Algorithm that dumps raw banks to binary files. - * - * @author Roel Aaij - * @date 2018-08-27 - */ -class DumpRawBanks : public Gaudi::Functional::Transformer< - std::array, LHCb::RawBank::LastType>(const LHCb::RawEvent&, const LHCb::ODIN&), - Gaudi::Functional::Traits::BaseClass_t> { -public: - /// Standard constructor - DumpRawBanks(const std::string& name, ISvcLocator* pSvcLocator); - - StatusCode initialize() override; - - std::array, LHCb::RawBank::LastType> operator()( - const LHCb::RawEvent& rawEvent, - const LHCb::ODIN& odin) const override; - -private: - std::string outputDirectory(LHCb::RawBank::BankType bankType) const; - - Gaudi::Property m_outputDirectory {this, "OutputDirectory", "banks"}; - Gaudi::Property> m_bankTypes { - this, - "BankTypes", - {LHCb::RawBank::VP, LHCb::RawBank::UT, LHCb::RawBank::FTCluster, LHCb::RawBank::Muon, LHCb::RawBank::ODIN}}; - Gaudi::Property m_dumpToFile {this, "DumpToFile", true}; - - std::unordered_map m_histos; -}; -#endif // DUMPRAWBANKS_H diff --git a/Dumpers/BinaryDumpers/src/TransposeRawBanks.cpp b/Dumpers/BinaryDumpers/src/TransposeRawBanks.cpp new file mode 100644 index 00000000000..fcd31e50673 --- /dev/null +++ b/Dumpers/BinaryDumpers/src/TransposeRawBanks.cpp @@ -0,0 +1,212 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "Utils.h" + +// Parsers are in namespace LHCb for ADL to work. +namespace LHCb { + + StatusCode parse(RawBank::BankType& result, const std::string& in) + { + static std::unordered_map types; + if (types.empty()) { + for (int t = 0; t < RawBank::LastType; ++t) { + auto bt = static_cast(t); + types.emplace(RawBank::typeName(bt), bt); + } + } + + // This takes care of quoting + std::string input; + using Gaudi::Parsers::parse; + auto sc = parse(input, in); + if (!sc) return sc; + + auto it = types.find(input); + if (it != end(types)) { + result = it->second; + return StatusCode::SUCCESS; + } + else { + return StatusCode::FAILURE; + } + } + + StatusCode parse(std::set& s, const std::string& in) + { + std::set ss; + using Gaudi::Parsers::parse; + auto sc = parse(ss, in); + if (!sc) return sc; + s.clear(); + try { + std::transform(begin(ss), end(ss), std::inserter(s, begin(s)), [](const std::string& s) { + RawBank::BankType t {}; + auto sc = parse(t, s); + if (!sc) throw GaudiException("Bad Parse", "", sc); + return t; + }); + } catch (const GaudiException& ge) { + return ge.code(); + } + return StatusCode::SUCCESS; + } + + + inline std::ostream& toStream(const RawBank::BankType& bt, std::ostream& s) + { + return s << "'" << RawBank::typeName(bt) << "'"; + } +} // namespace LHCb + +template +using VOC = Gaudi::Functional::vector_of_const_; + +// Raw bank format: +// ----------------------------------------------------------------------------- +// name | type | size [bytes] | array_size +// ============================================================================= +// Once +// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// number_of_rawbanks | uint32_t | 4 +// ----------------------------------------------------------------------------- +// raw_bank_offset | uint32_t | number_of_rawbanks * 4 +// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// for each raw bank: +// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// sourceID | uint32_t | 4 | +// ------------------------------------------------------------------------------ +// bank_data | char | variable +// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +/** @class TransposeRawBanks TransposeRawBanks.h + * Algorithm that dumps raw banks to binary files. + * + * @author Roel Aaij + * @date 2018-08-27 + */ +class TransposeRawBanks : public Gaudi::Functional::MergingTransformer< + std::array, LHCb::RawBank::LastType>(VOC const&), + Gaudi::Functional::Traits::BaseClass_t> { +public: + /// Standard constructor + TransposeRawBanks(const std::string& name, ISvcLocator* pSvcLocator); + + StatusCode initialize() override; + + std::array, LHCb::RawBank::LastType> operator()( + VOC const& rawEvents) const override; + +private: + Gaudi::Property> m_bankTypes { + this, + "BankTypes", + {LHCb::RawBank::VP, LHCb::RawBank::UT, LHCb::RawBank::FTCluster, LHCb::RawBank::Muon, LHCb::RawBank::ODIN}}; + Gaudi::Property m_dumpToFile {this, "DumpToFile", true}; + + std::unordered_map m_histos; +}; + +TransposeRawBanks::TransposeRawBanks(const std::string& name, ISvcLocator* pSvcLocator) : + MergingTransformer( + name, + pSvcLocator, + // Inputs + KeyValues {"RawEventLocations", {LHCb::RawEventLocation::Default}}, + // Output + KeyValue {"AllenRawInput", "Allen/Raw/Input"}) +{} + +StatusCode TransposeRawBanks::initialize() +{ + for (const auto bankType : m_bankTypes) { + auto tn = LHCb::RawBank::typeName(bankType); + m_histos[tn] = book1D(tn, -0.5, 603.5, 151); + } + return StatusCode::SUCCESS; +} + +std::array, LHCb::RawBank::LastType> TransposeRawBanks::operator()( + VOC const& rawEvents) const +{ + + std::array, LHCb::RawBank::LastType> output; + + std::unordered_map> rawBanks; + + for (auto const* rawEvent : rawEvents) { + std::for_each(m_bankTypes.begin(), m_bankTypes.end(), [rawEvent, &rawBanks] (auto bt) { + auto banks = rawEvent->banks(bt); + if (!banks.empty()) { + rawBanks.emplace(bt, std::move(banks)); + }}); + } + + for (auto const& [bankType, banks] : rawBanks) { + const uint32_t number_of_rawbanks = banks.size(); + uint32_t offset = 0; + + std::vector bankOffsets; + std::vector bankData; + bankOffsets.push_back(0); + + for (auto& bank : banks) { + const uint32_t sourceID = static_cast(bank->sourceID()); + bankData.push_back(sourceID); + + offset++; + + auto bStart = bank->begin(); + auto bEnd = bank->end(); + + // Debug/testing histogram with the sizes of the binary data per bank + auto tn = LHCb::RawBank::typeName(bankType); + auto hit = m_histos.find(tn); + if (UNLIKELY(hit == end(m_histos))) { + warning() << "No histogram booked for bank type " << tn << endmsg; + } + else { + hit->second->fill((bEnd - bStart) * sizeof(uint32_t)); + } + + while (bStart != bEnd) { + const uint32_t raw_data = *(bStart); + bankData.push_back(raw_data); + + bStart++; + offset++; + } + bankOffsets.push_back(offset * sizeof(uint32_t)); + } + + // Dumping number_of_rawbanks + 1 offsets! + DumpUtils::Writer bank_buffer; + bank_buffer.write(number_of_rawbanks, bankOffsets, bankData); + output[bankType] = bank_buffer.buffer(); + } + return output; +} + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT(TransposeRawBanks) diff --git a/Rec/Allen/options/run_allen_in_gaudi.py b/Rec/Allen/options/run_allen_in_gaudi.py index 28c002df1dd..bb670a34ed9 100644 --- a/Rec/Allen/options/run_allen_in_gaudi.py +++ b/Rec/Allen/options/run_allen_in_gaudi.py @@ -15,7 +15,7 @@ from Configurables import (TrackSys, GaudiSequencer) from Configurables import FTRawBankDecoder from Configurables import NTupleSvc from Gaudi.Configuration import appendPostConfigAction -from Configurables import (VPClus, createODIN, DumpRawBanks, DumpUTHits, +from Configurables import (VPClus, createODIN, TransposeRawBanks, DumpUTHits, DumpFTHits, DumpMuonCoords, DumpMuonCommonHits, MuonRec, PrepareMuonHits) from Configurables import RunAllen, AllenUpdater, AllenForwardToV2Tracks, AllenVeloToV2Tracks, AllenUTToV2Tracks @@ -33,8 +33,7 @@ from Configurables import HltDecReportsDecoder, HltANNSvc, AllenDecReportsToTES import json import os -conf_path = os.path.expandvars( - "$ALLEN_PROJECT_ROOT/configuration/constants/DefaultSequence.json") +conf_path = os.path.expandvars("$ALLEN_INSTALL_DIR/constants/Sequence.json") lines = [] with open(conf_path, 'r') as f: j = json.load(f) @@ -156,12 +155,11 @@ NTupleSvc().Output = ["FILE1 DATAFILE='velo_states.root' TYP='ROOT' OPT='NEW'"] # Save raw banks in Allen format on the TES outputdirectory = "dump/" -dump_banks = DumpRawBanks( +transpose_banks = TransposeRawBanks( BankTypes=["VP", "UT", "FTCluster", "Muon", "ODIN"], - DumpToFile=False, - OutputDirectory=outputdirectory + "banks") + RawEventLocations=["DAQ/RawEvent"]) dump_seq = GaudiSequencer("RecoAllenPrepareSeq") -dump_seq.Members += [dump_banks] +dump_seq.Members += [transpose_banks] # call Allen allen_seq = GaudiSequencer("RecoAllenSeq") @@ -264,7 +262,7 @@ def addPrCheckerCutsAndPlots(): allenReports = AllenDecReportsToTES() reports = HltDecReportsDecoder() - reports.RawEventLocations = "Allen/Out/DecReports" + reports.RawEventLocations = "Allen/Out/RawDecReports" reports.SourceID = 1 GaudiSequencer("CheckAllenReportsSeq", Members=[allenReports, reports]) ProcessPhase("Check").DetectorList += ["AllenReports"] -- GitLab From 554ea0e4f7ef06eec12c26eca3eb631283173e28 Mon Sep 17 00:00:00 2001 From: Roel Aaij Date: Tue, 16 Jun 2020 13:19:16 +0200 Subject: [PATCH 2/5] Fix compiler warnings --- Dumpers/BinaryDumpers/src/DumpGeometry.h | 7 +++++-- Dumpers/BinaryDumpers/src/DumpMuonGeometry.cpp | 4 +--- Dumpers/BinaryDumpers/src/TestMuonTable.cpp | 5 ++++- Dumpers/RootDumpers/src/DumpVeloUTState.cpp | 6 +++--- Rec/Allen/src/RunAllen.cpp | 16 ++++++++-------- main/include/TESProvider.h | 5 +++-- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Dumpers/BinaryDumpers/src/DumpGeometry.h b/Dumpers/BinaryDumpers/src/DumpGeometry.h index 619cb4138fd..b9bf719bb3b 100644 --- a/Dumpers/BinaryDumpers/src/DumpGeometry.h +++ b/Dumpers/BinaryDumpers/src/DumpGeometry.h @@ -219,7 +219,10 @@ StatusCode DumpGeometry::initialize() } // m_buffer will be filled and identifiers known - updMgrSvc->update(this); + sc = updMgrSvc->update(this); + if (!sc) { + return sc; + } auto svc = service(m_updaterName, true); if (!svc) { @@ -243,7 +246,7 @@ StatusCode DumpGeometry::initialize() } }); } - + return sc; } diff --git a/Dumpers/BinaryDumpers/src/DumpMuonGeometry.cpp b/Dumpers/BinaryDumpers/src/DumpMuonGeometry.cpp index cfe58a7c425..bc15bbb26ba 100644 --- a/Dumpers/BinaryDumpers/src/DumpMuonGeometry.cpp +++ b/Dumpers/BinaryDumpers/src/DumpMuonGeometry.cpp @@ -32,9 +32,7 @@ StatusCode DumpMuonGeometry::registerConditions(IUpdateManagerSvc* updMgrSvc) info() << "Registering " << path << endmsg; updMgrSvc->registerCondition(&m_daqHelper, path, &MuonDAQHelper::updateLUT); } - updMgrSvc->update(&m_daqHelper); - - return StatusCode::SUCCESS; + return updMgrSvc->update(&m_daqHelper); } DumpUtils::Dumps DumpMuonGeometry::dumpGeometry() const diff --git a/Dumpers/BinaryDumpers/src/TestMuonTable.cpp b/Dumpers/BinaryDumpers/src/TestMuonTable.cpp index 06adf86a203..8ec9de57301 100644 --- a/Dumpers/BinaryDumpers/src/TestMuonTable.cpp +++ b/Dumpers/BinaryDumpers/src/TestMuonTable.cpp @@ -218,7 +218,10 @@ void TestMuonTable::operator()(const LHCb::MuonCoords& muonCoords) const for (auto coord : muonCoords) { - m_det->Tile2XYZ(coord->key(), xp, dxp, yp, dyp, zp, dzp); + auto sc = m_det->Tile2XYZ(coord->key(), xp, dxp, yp, dyp, zp, dzp); + if (sc.isFailure()) { + error() << "Failed to get position for coord with key " << coord->key() << endmsg; + } coord_position(coord->key(), m_pad, m_stripX, m_stripY, coord->uncrossed(), xt, dxt, yt, dyt, zt); diff --git a/Dumpers/RootDumpers/src/DumpVeloUTState.cpp b/Dumpers/RootDumpers/src/DumpVeloUTState.cpp index 6341d0e3cda..7b646303bc0 100644 --- a/Dumpers/RootDumpers/src/DumpVeloUTState.cpp +++ b/Dumpers/RootDumpers/src/DumpVeloUTState.cpp @@ -29,7 +29,7 @@ StatusCode DumpVeloUTState::initialize() { auto sc = Consumer::initialize(); if (!sc.isSuccess()) return sc; - if (sc) m_tupleTool.retrieve(); + if (sc) sc = m_tupleTool.retrieve(); return sc; } @@ -40,8 +40,8 @@ void DumpVeloUTState::operator()(const std::vector& utTr for (auto loc : {LHCb::State::Location::AtTT, LHCb::State::Location::EndVelo}) { if (track.hasStateAt(loc)) { auto const* state = track.stateAt(loc); - tup->column("qop", state->qOverP()); - tup->write(); + tup->column("qop", state->qOverP()).ignore(); + tup->write().ignore(); break; } } diff --git a/Rec/Allen/src/RunAllen.cpp b/Rec/Allen/src/RunAllen.cpp index 05b3b48aa2c..a769a56875f 100644 --- a/Rec/Allen/src/RunAllen.cpp +++ b/Rec/Allen/src/RunAllen.cpp @@ -94,7 +94,7 @@ StatusCode RunAllen::initialize() // Initialize stream const bool print_memory_usage = false; - const uint start_event_offset = 0; + const unsigned start_event_offset = 0; const size_t reserve_mb = 10; // to do: how much do we need maximally for one event? m_stream_wrapper.reset(new StreamWrapper()); @@ -122,7 +122,7 @@ StatusCode RunAllen::initialize() // Get HLT1 selection names from configuration and initialize rate counters m_line_names = configuration_reader.params()["configured_lines"]; m_hlt1_line_rates.reserve(m_stream_wrapper->number_of_hlt1_lines); - for (uint i = 0; i < m_stream_wrapper->number_of_hlt1_lines; ++i) { + for (unsigned i = 0; i < m_stream_wrapper->number_of_hlt1_lines; ++i) { const auto it = m_line_names.find(std::to_string(i)); const std::string name = "Hlt1" + it->second + "Decision"; m_hlt1_line_rates.emplace_back(this, "Selected by " + name); @@ -147,8 +147,8 @@ std::tuple RunAllen::operator()( } // initialize RuntimeOptions - const uint event_start = 0; - const uint event_end = 1; + const unsigned event_start = 0; + const unsigned event_end = 1; const size_t slice_index = 0; const bool mep_layout = false; RuntimeOptions runtime_options( @@ -160,8 +160,8 @@ std::tuple RunAllen::operator()( m_cpu_offload, mep_layout); - const uint buf_idx = m_n_buffers - 1; - const uint stream_index = m_number_of_streams - 1; + const unsigned buf_idx = m_n_buffers - 1; + const unsigned stream_index = m_number_of_streams - 1; cudaError_t cuda_rv = m_stream_wrapper->run_stream(stream_index, buf_idx, runtime_options); if (cuda_rv != cudaSuccess) { error() << "Allen exited with errorCode " << rv << endmsg; @@ -178,7 +178,7 @@ std::tuple RunAllen::operator()( LHCb::HltDecReports reports {}; reports.reserve(buffer->host_number_of_hlt1_lines); uint32_t dec_mask = HltDecReport::decReportMasks::decisionMask; - for (int i = 0; i < buffer->host_number_of_hlt1_lines; i++) { + for (unsigned i = 0; i < buffer->host_number_of_hlt1_lines; i++) { const uint32_t line_report = buffer->host_dec_reports[2 + i]; const bool dec = line_report & dec_mask; const auto it = m_line_names.find(std::to_string(i)); @@ -191,7 +191,7 @@ std::tuple RunAllen::operator()( reports.insert(name, {dec, 0, 0, 0, dec_rep_index}).ignore(/* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */); } - if (msgLevel(MSG::DEBUG)) debug() << "Event selected by Allen: " << uint(filter) << endmsg; + if (msgLevel(MSG::DEBUG)) debug() << "Event selected by Allen: " << unsigned(filter) << endmsg; return std::make_tuple(filter, *buffer, reports); } diff --git a/main/include/TESProvider.h b/main/include/TESProvider.h index 00749062b1b..1ba84934c6f 100644 --- a/main/include/TESProvider.h +++ b/main/include/TESProvider.h @@ -60,8 +60,9 @@ public: // bank content using data_span = gsl::span; - auto data_size = static_cast(banks[bank].size()); - span b {banks[bank].data(), data_size}; + auto data_size = banks[bank].size(); + auto span_size = static_cast(data_size); + span b {banks[bank].data(), span_size}; m_banks_and_offsets[allen_bank_index] = {{std::move(b)}, data_size, std::move(offsets)}; } -- GitLab From 087517e47e94e65eb50330d222b653d56f33f6d6 Mon Sep 17 00:00:00 2001 From: Roel Aaij Date: Fri, 3 Jul 2020 16:29:58 +0200 Subject: [PATCH 3/5] Remove unused property. --- Dumpers/BinaryDumpers/src/TransposeRawBanks.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Dumpers/BinaryDumpers/src/TransposeRawBanks.cpp b/Dumpers/BinaryDumpers/src/TransposeRawBanks.cpp index fcd31e50673..7547c71ad8f 100644 --- a/Dumpers/BinaryDumpers/src/TransposeRawBanks.cpp +++ b/Dumpers/BinaryDumpers/src/TransposeRawBanks.cpp @@ -123,7 +123,6 @@ private: this, "BankTypes", {LHCb::RawBank::VP, LHCb::RawBank::UT, LHCb::RawBank::FTCluster, LHCb::RawBank::Muon, LHCb::RawBank::ODIN}}; - Gaudi::Property m_dumpToFile {this, "DumpToFile", true}; std::unordered_map m_histos; }; -- GitLab From 30c55dc58e305713f0447b14a6e1d56c57fe6e65 Mon Sep 17 00:00:00 2001 From: Roel Aaij Date: Mon, 6 Jul 2020 13:20:15 +0200 Subject: [PATCH 4/5] Fix test. --- Dumpers/BinaryDumpers/options/dump.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Dumpers/BinaryDumpers/options/dump.py b/Dumpers/BinaryDumpers/options/dump.py index aa6b45c3209..66c628c27d1 100644 --- a/Dumpers/BinaryDumpers/options/dump.py +++ b/Dumpers/BinaryDumpers/options/dump.py @@ -20,10 +20,10 @@ from Configurables import (DumpUTGeometry, DumpFTGeometry, DumpMuonTable, DumpVPGeometry) from Configurables import RootHistCnv__PersSvc from Configurables import IODataManager -from Configurables import (VPClus, createODIN, DumpRawBanks, DumpUTHits, +from Configurables import (VPClus, createODIN, TransposeRawBanks, DumpRawBanks, DumpFTHits, DumpMuonCoords, DumpMuonCommonHits, DumpMagneticField, DumpBeamline, MuonRec, - PrepareMuonHits) + PrepareMuonHits, DumpUTHits) from Configurables import TestMuonTable app = LHCbApp( @@ -63,7 +63,9 @@ ApplicationMgr().ExtSvc += [ ] # Dump raw banks and UT, FT and muon hits -dump_banks = DumpRawBanks(BankTypes=["VP", "UT", "FTCluster", "Muon"]) +transpose_banks = TransposeRawBanks(BankTypes=["VP", "UT", "FTCluster", + "Muon", "ODIN"]) +dump_banks = DumpRawBanks() dump_ut = DumpUTHits() dump_ft = DumpFTHits() dump_muon_coords = DumpMuonCoords() @@ -71,8 +73,8 @@ dump_muon_hits = DumpMuonCommonHits() dump_seq = GaudiSequencer("DumpSeq") dump_seq.Members += [ - dump_banks, dump_ut, dump_ft, dump_muon_coords, dump_muon_hits, - TestMuonTable() + transpose_banks, dump_banks, dump_ut, dump_ft, + dump_muon_coords, dump_muon_hits, TestMuonTable() ] ApplicationMgr().TopAlg = [dec_seq, dump_seq] -- GitLab From 8c0c2f3840dcf5a8ab065975d8e8e49795ecf3ce Mon Sep 17 00:00:00 2001 From: Dorothea vom Bruch Date: Mon, 6 Jul 2020 15:45:15 +0200 Subject: [PATCH 5/5] only detect CPU architecture in standalone build --- CMakeLists.txt | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a1de471b55..8664418f3e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -420,30 +420,32 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") string(APPEND CMAKE_CXX_FLAGS " -Wno-gnu-zero-variadic-macro-arguments") endif() -#Detect target CPU architecture -include(TargetArch) -set(TARGET_CPU_ARCHITECTURE "") -target_architecture(TARGET_CPU_ARCHITECTURE) -message(STATUS "Detected CPU architecture: ${TARGET_CPU_ARCHITECTURE}") - -#Specific optimizations for different architectures -if(TARGET_CPU_ARCHITECTURE STREQUAL "x86_64" OR TARGET_CPU_ARCHITECTURE STREQUAL "i386" +if(STANDALONE) + #Detect target CPU architecture + include(TargetArch) + set(TARGET_CPU_ARCHITECTURE "") + target_architecture(TARGET_CPU_ARCHITECTURE) + message(STATUS "Detected CPU architecture: ${TARGET_CPU_ARCHITECTURE}") + + #Specific optimizations for different architectures + if(TARGET_CPU_ARCHITECTURE STREQUAL "x86_64" OR TARGET_CPU_ARCHITECTURE STREQUAL "i386" OR TARGET_CPU_ARCHITECTURE STREQUAL "ia64") -#x86 family - string(APPEND CMAKE_CXX_FLAGS " -march=${CPU_ARCH}") -elseif(TARGET_CPU_ARCHITECTURE STREQUAL "ppc" OR TARGET_CPU_ARCHITECTURE STREQUAL "ppc64") -#PowerPC family -#More options on : https: // developer.ibm.com/linuxonpower/compiler-options-table/ - string(APPEND CMAKE_CXX_FLAGS " -mcpu=${CPU_ARCH}") -elseif(TARGET_CPU_ARCHITECTURE STREQUAL "arm" OR TARGET_CPU_ARCHITECTURE STREQUAL "armv5" + #x86 family + string(APPEND CMAKE_CXX_FLAGS " -march=${CPU_ARCH}") + elseif(TARGET_CPU_ARCHITECTURE STREQUAL "ppc" OR TARGET_CPU_ARCHITECTURE STREQUAL "ppc64") + #PowerPC family + #More options on : https: // developer.ibm.com/linuxonpower/compiler-options-table/ + string(APPEND CMAKE_CXX_FLAGS " -mcpu=${CPU_ARCH}") + elseif(TARGET_CPU_ARCHITECTURE STREQUAL "arm" OR TARGET_CPU_ARCHITECTURE STREQUAL "armv5" OR TARGET_CPU_ARCHITECTURE STREQUAL "armv6" OR TARGET_CPU_ARCHITECTURE STREQUAL "armv7") -#ARM family - string(APPEND CMAKE_CXX_FLAGS " -march=${CPU_ARCH}") -elseif(TARGET_CPU_ARCHITECTURE STREQUAL "aarch64") -#ARM64 family -#Options from : http: // www.prace-ri.eu/IMG/pdf/Best-Practice-Guide-ARM64.pdf - string(APPEND CMAKE_CXX_FLAGS " -march=${CPU_ARCH} -floop-optimize \ --falign-loops -falign-labels -falign-functions -falign-jumps -fomit-frame-pointer") + #ARM family + string(APPEND CMAKE_CXX_FLAGS " -march=${CPU_ARCH}") + elseif(TARGET_CPU_ARCHITECTURE STREQUAL "aarch64") + #ARM64 family + #Options from : http: // www.prace-ri.eu/IMG/pdf/Best-Practice-Guide-ARM64.pdf + string(APPEND CMAKE_CXX_FLAGS " -march=${CPU_ARCH} -floop-optimize \ + -falign-loops -falign-labels -falign-functions -falign-jumps -fomit-frame-pointer") + endif() endif() find_package(ZLIB REQUIRED) -- GitLab