diff --git a/Det/LHCbDet/tests/options/interaction_region.py b/Det/LHCbDet/tests/options/interaction_region.py index a34096dc2e45762c43218dc1c3344443202f6469..2d77f37ba342b491d70c45c0d820de2672ec53eb 100644 --- a/Det/LHCbDet/tests/options/interaction_region.py +++ b/Det/LHCbDet/tests/options/interaction_region.py @@ -9,7 +9,7 @@ # or submit itself to any jurisdiction. # ############################################################################### from PyConf.application import (configure, setup_component, ComponentConfig, - ApplicationOptions, default_raw_event) + ApplicationOptions) from PyConf.control_flow import CompositeNode, NodeLogic from PyConf.Algorithms import InteractionRegionExample from GaudiKernel.Constants import DEBUG diff --git a/Det/VPDet/tests/scripts/velo_motion_from_yaml.py b/Det/VPDet/tests/scripts/velo_motion_from_yaml.py index 4d2cb94879ce7593ebed631e41e01610752782a8..41f062d81a4771e6c1b8f8bb169c9ef36db9042b 100644 --- a/Det/VPDet/tests/scripts/velo_motion_from_yaml.py +++ b/Det/VPDet/tests/scripts/velo_motion_from_yaml.py @@ -9,8 +9,7 @@ # or submit itself to any jurisdiction. # ############################################################################### import os -from PyConf.application import (configure_input, configure, ApplicationOptions, - default_raw_event) +from PyConf.application import (configure_input, configure, ApplicationOptions) from PyConf.control_flow import CompositeNode, NodeLogic from PyConf.Algorithms import (LHCb__DetDesc__TestBeamSpot as TestBeamSpot, LHCb__Tests__FakeRunNumberProducer as diff --git a/Event/EventPacker/CMakeLists.txt b/Event/EventPacker/CMakeLists.txt index bd58fc8f55f4894565e623fa8bce34b7bea4b74e..3be4cb53e2b691af1a3c07d7a04ac1a69137a58b 100644 --- a/Event/EventPacker/CMakeLists.txt +++ b/Event/EventPacker/CMakeLists.txt @@ -67,12 +67,10 @@ gaudi_add_module(EventPacker src/component/DumpTracks.cpp src/component/PackMCParticle.cpp src/component/PackMCVertex.cpp - src/component/UnpackCaloHypo.cpp src/component/UnpackMCParticle.cpp src/component/UnpackMCVertex.cpp src/component/UnpackProtoParticle.cpp src/component/UnpackRecVertex.cpp - src/component/UnpackTrack.cpp src/component/MCPackers.cpp src/component/Unpackers.cpp src/component/PackedDataChecksum.cpp diff --git a/Event/EventPacker/include/Event/PackedMCCaloHit.h b/Event/EventPacker/include/Event/PackedMCCaloHit.h index 038a04205fb26bb484ee0fedf00eb39e40bf12e1..b863fb9356f14728bcb13601739b870a60f9015d 100644 --- a/Event/EventPacker/include/Event/PackedMCCaloHit.h +++ b/Event/EventPacker/include/Event/PackedMCCaloHit.h @@ -100,6 +100,9 @@ namespace LHCb { typedef LHCb::MCCaloHits DataVector; typedef LHCb::PackedMCCaloHits PackedDataVector; + static const std::string packedLocation() { return {}; } + static const std::string unpackedLocation() { return {}; } + using PackerBase::PackerBase; /// Pack MCCaloHits diff --git a/Event/EventPacker/include/Event/PackedMCHit.h b/Event/EventPacker/include/Event/PackedMCHit.h index f749327b5cef6cb35f80fc1d2cb580091e0209e9..fd3bb4bc51cac86e7412d5926c36e0d418b39a9b 100644 --- a/Event/EventPacker/include/Event/PackedMCHit.h +++ b/Event/EventPacker/include/Event/PackedMCHit.h @@ -114,6 +114,9 @@ namespace LHCb { using PackerBase::PackerBase; + static const std::string packedLocation() { return {}; } + static const std::string unpackedLocation() { return {}; } + /// Pack MCHits void pack( const DataVector& hits, PackedDataVector& phits ) const; diff --git a/Event/EventPacker/src/component/UnpackCaloHypo.cpp b/Event/EventPacker/src/component/UnpackCaloHypo.cpp deleted file mode 100644 index 2289cb75641855590cdc0c39a4dd7176d7cd1b96..0000000000000000000000000000000000000000 --- a/Event/EventPacker/src/component/UnpackCaloHypo.cpp +++ /dev/null @@ -1,49 +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. * -\*****************************************************************************/ - -#include "Event/CaloHypo.h" -#include "Event/PackedCaloHypo.h" - -#include "LHCbAlgs/Consumer.h" - -namespace LHCb { - - /** - * Unpacker for CaloHypo - * - * FIXME : despite this looks functional, the input and output is still handled the - * old way and read/written from/to the TES via getOrCreate/put. - * This should be fixed but requires that the algorithm consuming the data is able - * to deal with an empty list of CaloHypos and does not seg fault in such a case as - * it is the case now and also that DaVinci configuration does not try to unpack non - * existing input (Tesla.default_2015 test) - */ - struct UnpackCaloHypo : Algorithm::Consumer<void()> { - - UnpackCaloHypo( const std::string& name, ISvcLocator* pSvcLocator ) : Consumer( name, pSvcLocator ) {} - - void operator()() const override; - DataObjectReadHandle<PackedCaloHypos> m_packedHypos{this, "InputName", PackedCaloHypoLocation::Electrons}; - DataObjectWriteHandle<CaloHypos> m_hypos{this, "OutputName", CaloHypoLocation::Electrons}; - }; - -} // namespace LHCb - -DECLARE_COMPONENT_WITH_ID( LHCb::UnpackCaloHypo, "UnpackCaloHypo" ) - -void LHCb::UnpackCaloHypo::operator()() const { - // If input does not exist, and we aren't making the output regardless, just return - if ( !m_packedHypos.exist() ) return; - const auto* dst = m_packedHypos.getOrCreate(); - if ( msgLevel( MSG::DEBUG ) ) debug() << "Size of PackedCaloHypos = " << dst->data().size() << endmsg; - auto* newCaloHypos = m_hypos.put( std::make_unique<CaloHypos>() ); - CaloHypoPacker{this}.unpack( *dst, *newCaloHypos ); -} diff --git a/Event/EventPacker/src/component/UnpackMCParticle.cpp b/Event/EventPacker/src/component/UnpackMCParticle.cpp index 74ca4a28d8a87a6ac4feb040393d484077df0c14..b320b8172d95b327ef47e3c9b394cfbb181cc18c 100644 --- a/Event/EventPacker/src/component/UnpackMCParticle.cpp +++ b/Event/EventPacker/src/component/UnpackMCParticle.cpp @@ -68,10 +68,6 @@ void LHCb::UnpackMCParticle::operator()() const { // Packing version const char pVer = dst->packingVersion(); - // random generator for private tests of flags. - // static std::default_random_engine gen; - // static std::uniform_real_distribution<float> uniform(0,1); - newMCParticles->reserve( dst->mcParts().size() ); for ( const auto& src : dst->mcParts() ) { diff --git a/Event/EventPacker/src/component/UnpackTrack.cpp b/Event/EventPacker/src/component/UnpackTrack.cpp deleted file mode 100644 index f89613bb5e73d9eae00ee0faee3f9e637fa374bd..0000000000000000000000000000000000000000 --- a/Event/EventPacker/src/component/UnpackTrack.cpp +++ /dev/null @@ -1,45 +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. * -\*****************************************************************************/ - -#include "Event/PackedTrack.h" -#include "Event/StandardPacker.h" -#include "Event/Track.h" - -#include "LHCbAlgs/Transformer.h" - -namespace LHCb { - - /** - * Unpack the PackedTrack - * - * @author Olivier Callot - * @date 2008-11-14 - */ - struct UnpackTrack final : Algorithm::Transformer<Tracks( PackedTracks const& )> { - - UnpackTrack( std::string const& name, ISvcLocator* pSvcLocator ) - : Transformer( name, pSvcLocator, KeyValue{"InputName", PackedTrackLocation::Default}, - KeyValue{"OutputName", TrackLocation::Default} ) {} - - Tracks operator()( PackedTracks const& in ) const override { - Tracks out; - TrackPacker{this}.unpack( in, out ); - m_unpackedTracks += out.size(); - return out; - } - - mutable Gaudi::Accumulators::AveragingCounter<unsigned long> m_unpackedTracks{this, "# Unpacked Tracks"}; - }; - -} // namespace LHCb - -// Declaration of the Algorithm Factory -DECLARE_COMPONENT_WITH_ID( LHCb::UnpackTrack, "UnpackTrack" ) diff --git a/Event/EventPacker/src/component/UnpackerBaseAlg.h b/Event/EventPacker/src/component/UnpackerBaseAlg.h index c20bbb50413213e416cabbcba14b7a2472105f47..dab61673fe70ae1a790a1426a92ce0507ade40b1 100644 --- a/Event/EventPacker/src/component/UnpackerBaseAlg.h +++ b/Event/EventPacker/src/component/UnpackerBaseAlg.h @@ -35,24 +35,14 @@ namespace DataPacking { public: using Consumer::Consumer; - StatusCode initialize() override; - void operator()() const override; + void operator()() const override; private: DataObjectReadHandle<typename PACKER::PackedDataVector> m_pdata{this, "InputName", PACKER::packedLocation()}; DataObjectWriteHandle<typename PACKER::DataVector> m_data{this, "OutputName", PACKER::unpackedLocation()}; mutable Gaudi::Accumulators::StatCounter<> m_unpackedData{this, "# UnPackedData"}; - const PACKER m_packer{this}; }; - template <class PACKER> - StatusCode Unpack<PACKER>::initialize() { - return Consumer::initialize().andThen( [&] { - if ( this->msgLevel( MSG::DEBUG ) ) - this->debug() << "Input " << m_pdata.fullKey() << " Output " << m_data.fullKey() << "" << endmsg; - } ); - } - template <class PACKER> void Unpack<PACKER>::operator()() const { // create empty output @@ -64,7 +54,7 @@ namespace DataPacking { data->setVersion( pdata->version() ); // Fill unpacked data - m_packer.unpack( *pdata, *data ); + PACKER{this}.unpack( *pdata, *data ); if ( this->msgLevel( MSG::DEBUG ) ) { this->debug() << "Created " << data->size() << " data objects at " << m_data.fullKey() << endmsg; this->debug() << " Packed Data Version = " << (unsigned int)pdata->version() << endmsg; diff --git a/Event/EventPacker/src/component/Unpackers.cpp b/Event/EventPacker/src/component/Unpackers.cpp index 68090587b54a791e8cdbf817d07ce2a2592caa47..301b5d655d4410b24eac6091028f3aa781802e1b 100644 --- a/Event/EventPacker/src/component/Unpackers.cpp +++ b/Event/EventPacker/src/component/Unpackers.cpp @@ -46,6 +46,10 @@ namespace DataPacking { // MC Packers don't serialize data so we keep the ones taking packed objects + DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::MCHitPacker>, + "UnpackMCHit" ) // note: different naming convention _on purpose_ -- this one type should + // be used instead of all the MCXYZHitUnpacker eventually... + DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::MCCaloHitPacker>, "UnpackMCCaloHit" ) DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::MCRichHitPacker>, "MCRichHitUnpacker" ) DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::MCRichOpticalPhotonPacker>, "MCRichOpticalPhotonUnpacker" ) DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::MCRichSegmentPacker>, "MCRichSegmentUnpacker" ) @@ -75,6 +79,8 @@ namespace DataPacking { DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::RichPIDPacker>, "UnpackRichPIDs" ) DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::MuonPIDPacker>, "UnpackMuonPIDs" ) DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::WeightsVectorPacker>, "UnpackWeightsVector" ) + DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::TrackPacker>, "UnpackTrack" ) + DECLARE_COMPONENT_WITH_ID( Unpack<LHCb::CaloHypoPacker>, "UnpackCaloHypo" ) namespace Buffer { // These packers take one data buffer location and produce unpacked object diff --git a/Ex/IOExample/tests/refs/MC10dst.ref b/Ex/IOExample/tests/refs/MC10dst.ref index b16c03ac7d41268a68df517e559f9c061a9499bd..2d1c0f05c3c7dd01ec982cae3e67b457f5110c1e 100644 --- a/Ex/IOExample/tests/refs/MC10dst.ref +++ b/Ex/IOExample/tests/refs/MC10dst.ref @@ -2442,4 +2442,4 @@ DumpTracks INFO Number of counters : 1 | "#Tracks" | 5 | 824 | 164.80 | 46.258 | 118.00 | 252.00 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 824 | 164.80 | + | "# UnPackedData" | 5 | 824 | 164.80 | diff --git a/Ex/IOExample/tests/refs/Reco08dst.ref b/Ex/IOExample/tests/refs/Reco08dst.ref index 8aa277e3ba774a6ed3f1f6c75e56e07ce3b99a77..90bec5445d1a0b7589c3ca38f735398126c47388 100644 --- a/Ex/IOExample/tests/refs/Reco08dst.ref +++ b/Ex/IOExample/tests/refs/Reco08dst.ref @@ -2024,4 +2024,4 @@ PrintHeader INFO Number of counters : 1 | "EventCount" | 5 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 994 | 198.80 | + | "# UnPackedData" | 5 | 994 | 198.80 | diff --git a/Ex/IOExample/tests/refs/Reco08dsttoroot.ref b/Ex/IOExample/tests/refs/Reco08dsttoroot.ref index 0e4f9bc8ad5747155e689a705c496b8871c3be22..3f266624e63b9e66f454ec38123a18149fba099b 100644 --- a/Ex/IOExample/tests/refs/Reco08dsttoroot.ref +++ b/Ex/IOExample/tests/refs/Reco08dsttoroot.ref @@ -2008,4 +2008,4 @@ DumpTracks INFO Number of counters : 1 | "#Tracks" | 5 | 994 | 198.80 | 56.989 | 112.00 | 270.00 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 994 | 198.80 | + | "# UnPackedData" | 5 | 994 | 198.80 | diff --git a/Ex/IOExample/tests/refs/Reco08dsttoroot.ref.detdesc b/Ex/IOExample/tests/refs/Reco08dsttoroot.ref.detdesc index 0ec8ec86ad941a8571da5863c741019ca560e16f..1ecdcb3c026212d486039b0fae378ff609121ee7 100644 --- a/Ex/IOExample/tests/refs/Reco08dsttoroot.ref.detdesc +++ b/Ex/IOExample/tests/refs/Reco08dsttoroot.ref.detdesc @@ -2021,4 +2021,4 @@ PrintHeader INFO Number of counters : 1 | "EventCount" | 5 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 994 | 198.80 | + | "# UnPackedData" | 5 | 994 | 198.80 | diff --git a/Ex/IOExample/tests/refs/reco12stripping17dst.ref b/Ex/IOExample/tests/refs/reco12stripping17dst.ref index 1b37cf4c789b476378393384782f6e4a29bc1513..e0029d31c7ac556494fe6cc9ce037aac8facd7b2 100644 --- a/Ex/IOExample/tests/refs/reco12stripping17dst.ref +++ b/Ex/IOExample/tests/refs/reco12stripping17dst.ref @@ -1900,4 +1900,4 @@ PrintHeader INFO Number of counters : 1 | "EventCount" | 5 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 990 | 198.00 | + | "# UnPackedData" | 5 | 990 | 198.00 | diff --git a/Ex/IOExample/tests/refs/reco12stripping17dsttoroot.ref b/Ex/IOExample/tests/refs/reco12stripping17dsttoroot.ref index 6487d73cb497c62cb5e12e64fab3ab8139234309..8c11de9487f63cf4ca513ddccefe2f0074c2fd54 100644 --- a/Ex/IOExample/tests/refs/reco12stripping17dsttoroot.ref +++ b/Ex/IOExample/tests/refs/reco12stripping17dsttoroot.ref @@ -1884,4 +1884,4 @@ DumpTracks INFO Number of counters : 1 | "#Tracks" | 5 | 990 | 198.00 | 58.764 | 139.00 | 273.00 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 990 | 198.00 | + | "# UnPackedData" | 5 | 990 | 198.00 | diff --git a/Ex/IOExample/tests/refs/reco12stripping17dsttoroot.ref.detdesc b/Ex/IOExample/tests/refs/reco12stripping17dsttoroot.ref.detdesc index c52c95195c4c18eadd1745b5f0786a56225fe65e..fd5d366e428503be2f0be09fc84dfaedc7ae5e60 100644 --- a/Ex/IOExample/tests/refs/reco12stripping17dsttoroot.ref.detdesc +++ b/Ex/IOExample/tests/refs/reco12stripping17dsttoroot.ref.detdesc @@ -1897,4 +1897,4 @@ PrintHeader INFO Number of counters : 1 | "EventCount" | 5 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 990 | 198.00 | + | "# UnPackedData" | 5 | 990 | 198.00 | diff --git a/Ex/IOExample/tests/refs/reco14stripping20dst.ref b/Ex/IOExample/tests/refs/reco14stripping20dst.ref index fc64be8074a5e27e6c652c6df7a352796fd0820e..4e137830baa9fe078845ca163fa06b1e8e9601e1 100644 --- a/Ex/IOExample/tests/refs/reco14stripping20dst.ref +++ b/Ex/IOExample/tests/refs/reco14stripping20dst.ref @@ -1483,4 +1483,4 @@ PrintHeader INFO Number of counters : 1 | "EventCount" | 5 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 1233 | 246.60 | + | "# UnPackedData" | 5 | 1233 | 246.60 | diff --git a/Ex/IOExample/tests/refs/reco14stripping20dsttoroot.ref b/Ex/IOExample/tests/refs/reco14stripping20dsttoroot.ref index 858aa0bbfd4ae9c47e57d379bbb47ef8013e678e..b88414992e852ad02f2a80594e637251ec4811ff 100644 --- a/Ex/IOExample/tests/refs/reco14stripping20dsttoroot.ref +++ b/Ex/IOExample/tests/refs/reco14stripping20dsttoroot.ref @@ -1467,4 +1467,4 @@ DumpTracks INFO Number of counters : 1 | "#Tracks" | 5 | 1233 | 246.60 | 111.33 | 65.000 | 364.00 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 1233 | 246.60 | + | "# UnPackedData" | 5 | 1233 | 246.60 | diff --git a/Ex/IOExample/tests/refs/reco14stripping20dsttoroot.ref.detdesc b/Ex/IOExample/tests/refs/reco14stripping20dsttoroot.ref.detdesc index 5d5f7eb736e5fa82ab9074be8a0bf16bf7450ae5..9b8bca31e484580dfa1239dec0d5d6e0b86933ed 100644 --- a/Ex/IOExample/tests/refs/reco14stripping20dsttoroot.ref.detdesc +++ b/Ex/IOExample/tests/refs/reco14stripping20dsttoroot.ref.detdesc @@ -1480,4 +1480,4 @@ PrintHeader INFO Number of counters : 1 | "EventCount" | 5 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 5 | 1233 | 246.60 | + | "# UnPackedData" | 5 | 1233 | 246.60 | diff --git a/Ex/IOExample/tests/refs/testUnpackTrack.ref b/Ex/IOExample/tests/refs/testUnpackTrack.ref index 6f7f5c087fe237dec0e718543ed753a73811373e..27462326a486831dbe5549c630e6f51948e219fc 100644 --- a/Ex/IOExample/tests/refs/testUnpackTrack.ref +++ b/Ex/IOExample/tests/refs/testUnpackTrack.ref @@ -21,7 +21,6 @@ DumpTracks INFO There are 5161 tracks in /Event/Rec/Track/Best EventLoopMgr INFO No more events in event selection ApplicationMgr INFO Application Manager Stopped successfully EventLoopMgr INFO Histograms converted successfully according to request. -ToolSvc INFO Removing all tools created by ToolSvc ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully DumpTracks INFO Number of counters : 1 @@ -29,4 +28,4 @@ DumpTracks INFO Number of counters : 1 | "#Tracks" | 10 | 8025 | 802.50 | 1462.1 | 52.000 | 5161.0 | UnpackTrack INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# Unpacked Tracks" | 10 | 8025 | 802.50 | + | "# UnPackedData" | 10 | 8025 | 802.50 | 1462.1 | 52.000 | 5161.0 | diff --git a/GaudiConf/python/GaudiConf/reading.py b/GaudiConf/python/GaudiConf/reading.py index 43fba67e43a5516f321e3ffab4dc3b31359849ce..bcb5d1edbdc8e38ec81b5bc56676fe921d32adb5 100644 --- a/GaudiConf/python/GaudiConf/reading.py +++ b/GaudiConf/python/GaudiConf/reading.py @@ -256,7 +256,7 @@ def bank_location(input_process="Hlt2", if input_process == "Spruce" or input_process == "Turbo": bank_location = make_data_with_FetchDataFromFile( - f'/Event/{stream}/RawEvent') + f'/Event/{stream}/RawEvent', force_type='LHCb::RawEvent') else: bank_location = default_raw_event([bank], raw_event_format=raw_event_format) diff --git a/Hlt/HltDAQ/tests/options/lumi_decoding.py b/Hlt/HltDAQ/tests/options/lumi_decoding.py index b49c58cdc6c833904fb6697537e0407e60d9990b..5f4cdbebe1995e2754eb348f7808fed21d5d7cfe 100644 --- a/Hlt/HltDAQ/tests/options/lumi_decoding.py +++ b/Hlt/HltDAQ/tests/options/lumi_decoding.py @@ -33,7 +33,7 @@ configure_input(options) # must call this before calling default_raw_event odin = make_odin() default_raw_event.bind(raw_event_format=0.5) -rb_bank = default_raw_banks('HltRoutingBits', default_raw_event) +rb_bank = default_raw_banks('HltRoutingBits') rb_filter = HltRoutingBitsFilter( name="RequireLumiRoutingBit", diff --git a/Kernel/LHCbAlgs/tests/scripts/test_ODIN_decoding.py b/Kernel/LHCbAlgs/tests/scripts/test_ODIN_decoding.py index c1ad1f3d8da1b0639f4f910611ec3f0315c9b219..cd2c0f1709120cd149f3e5d338b58f72f5fc8dc1 100644 --- a/Kernel/LHCbAlgs/tests/scripts/test_ODIN_decoding.py +++ b/Kernel/LHCbAlgs/tests/scripts/test_ODIN_decoding.py @@ -12,7 +12,7 @@ from PyConf import configurable from PyConf.components import Algorithm, force_location from PyConf.application import ApplicationOptions, configure, configure_input from PyConf.control_flow import CompositeNode -from PyConf.application import make_odin, default_raw_event, make_data_with_FetchDataFromFile, default_raw_banks +from PyConf.application import make_odin, default_raw_banks from PyConf.Algorithms import PrintHeader from Configurables import Gaudi__Hive__FetchDataFromFile diff --git a/PyConf/python/PyConf/application.py b/PyConf/python/PyConf/application.py index 50c7988901ab76ca4b04929e3bf16f562406e909..385adc975d9c90638560eda1c10ce9f3e4f8e758 100644 --- a/PyConf/python/PyConf/application.py +++ b/PyConf/python/PyConf/application.py @@ -577,7 +577,7 @@ class ComponentConfig(dict): self.add(c) -def make_data_with_FetchDataFromFile(location, bank_type=None, **kwargs): +def make_data_with_FetchDataFromFile(location, force_type, **kwargs): """Return input data read using `FetchDataFromFile`. `FetchDataFromFile` preloads data on the transient event store for @@ -587,6 +587,7 @@ def make_data_with_FetchDataFromFile(location, bank_type=None, **kwargs): Args: location (str): Location to be fetched from input data. + force_type (str): The type of data(handle) to be fetched (returned) extra_inputs (list, optional): Additional dependencies for `Gaudi::Hive::FetchDataFromFile`. Defaults to []. .. note: The 'extra_inputs' is a hack to set the dependencies in `FetchDataFromFile', which can be used to ensure that the data is fetched in the correct order. @@ -597,11 +598,13 @@ def make_data_with_FetchDataFromFile(location, bank_type=None, **kwargs): location = ensure_event_prefix(location) if 'name' not in kwargs: kwargs['name'] = 'Fetch_{}'.format(location.replace('/', '_')) - return Gaudi__Hive__FetchDataFromFile( + out = Gaudi__Hive__FetchDataFromFile( outputs={'Output': force_location(location)}, output_transform=lambda Output: {"DataKeys": [location]}, **kwargs ).Output + out.force_type(force_type) + return out def make_raw_event_with_IOAlg(location, @@ -637,7 +640,7 @@ def make_raw_event_with_Online(location, bank_type=""): @configurable def default_raw_event(bank_types=[], raw_event_format=None, - maker=make_data_with_FetchDataFromFile, + maker=None, stream=None): """Return a raw event that contains a given set of banks. @@ -693,7 +696,9 @@ def default_raw_event(bank_types=[], raise NotImplementedError( 'Alternatives are not supported ({} -> {})'.format( bank_types, location)) - return maker(location[0], bank_type=bank_types[0]) + if maker: return maker(location[0], bank_type=bank_types[0]) + return make_data_with_FetchDataFromFile( + location[0], force_type='LHCb::RawEvent') @configurable diff --git a/PyConf/python/PyConf/reading.py b/PyConf/python/PyConf/reading.py index 33c990c391d52bfd07d6be3b142d76cf7ed4f094..f2279aa707064c3223b5288be34749324b024852 100644 --- a/PyConf/python/PyConf/reading.py +++ b/PyConf/python/PyConf/reading.py @@ -135,7 +135,8 @@ def get_mc_particles(location, mc_vertices: DataHandle = None): return UnpackMCParticle( name='Unpack_{}'.format(location.replace('/', '_')), - InputName=make_data_with_FetchDataFromFile(sim_location), + InputName=make_data_with_FetchDataFromFile( + sim_location, force_type='LHCb::PackedMCParticles'), outputs={ "OutputName": force_location(location) }, @@ -157,7 +158,8 @@ def get_mc_vertices(location): return UnpackMCVertex( name='Unpack_{}'.format(location.replace('/', '_')), - InputName=make_data_with_FetchDataFromFile(sim_location), + InputName=make_data_with_FetchDataFromFile( + sim_location, force_type='LHCb::PackedMCVertices'), outputs={ "OutputName": force_location(location) }, @@ -194,9 +196,8 @@ def get_rec_summary(): def get_mc_track_info(): - mc_track_info = make_data_with_FetchDataFromFile('/Event/MC/TrackInfo') - mc_track_info.force_type('LHCb::MCProperty') - return mc_track_info + return make_data_with_FetchDataFromFile( + '/Event/MC/TrackInfo', force_type='LHCb::MCProperty') def get_mc_header(*, location='/Event/MC/Header', extra_inputs: list = []): @@ -220,10 +221,7 @@ def get_mc_header(*, location='/Event/MC/Header', extra_inputs: list = []): extra_inputs = [mc_particles] mc_header = make_data_with_FetchDataFromFile( - location, - ExtraInputs=extra_inputs, - name='FetchDataFromFile_GetMCHeader') - mc_header.force_type('LHCb::MCHeader') + location, ExtraInputs=extra_inputs, force_type='LHCb::MCHeader') return mc_header @@ -236,9 +234,8 @@ def get_generator_header(*, location='/Event/Gen/Header'): Returns: DataHandle: DataHandle of the `LHCb::GenHeader`. """ - gen_header = make_data_with_FetchDataFromFile(location) - gen_header.force_type('LHCb::GenHeader') - return gen_header + return make_data_with_FetchDataFromFile( + location, force_type='LHCb::GenHeader') def get_odin(): diff --git a/PyConf/python/PyConf/utils.py b/PyConf/python/PyConf/utils.py index 63d5302bc290782923533b4600b224bc31456900..4a693b0700bb2d231b8a51498cd7dc8211bafe67 100644 --- a/PyConf/python/PyConf/utils.py +++ b/PyConf/python/PyConf/utils.py @@ -14,7 +14,7 @@ import os def load_file(fname): if not fname: return None - if fname.startswith("root://eoslhcb.cern.ch//"): + if fname.startswith("root:"): import XRootD.client with XRootD.client.File() as f: status, _ = f.open(str(fname))