From 4b5e7d7b704f1ab61c87a3a261cec5400d7401b7 Mon Sep 17 00:00:00 2001 From: Roel Aaij <roel.aaij@cern.ch> Date: Sat, 15 Jun 2019 23:38:06 +0200 Subject: [PATCH] Add BinaryDumpers from Rec to Allen as Dumpers and allow to build as a Gaudi project. --- CMakeLists.txt | 111 +++-- Dumpers/CMakeLists.txt | 50 +++ Dumpers/Dumpers/IUpdater.h | 112 +++++ Dumpers/Dumpers/Identifiers.h | 83 ++++ Dumpers/Dumpers/PyAllenHelper.h | 22 + Dumpers/Dumpers/TestUTBoards.h | 35 ++ Dumpers/options/dump.py | 92 ++++ Dumpers/options/dump_MC_info.py | 85 ++++ Dumpers/options/dump_banks.py | 82 ++++ Dumpers/options/interactive.py | 27 ++ .../upgrade-JPsiMuMu-scifi_v5_local.py | 129 ++++++ ...upgrade-bsphiphi-magdown-scifi-v5-local.py | 24 + Dumpers/options/upgrade-minbias-ldst.py | 19 + .../options/upgrade-minbias-magdown-local.py | 33 ++ .../upgrade-minbias-magdown-scifi-v5-local.py | 25 ++ Dumpers/options/upgrade-minbias-magdown.py | 47 ++ Dumpers/options/upgrade-minbias-magdown.xml | 81 ++++ Dumpers/src/AllenUpdater.cpp | 83 ++++ Dumpers/src/AllenUpdater.h | 66 +++ Dumpers/src/DumpBeamline.cpp | 32 ++ Dumpers/src/DumpBeamline.h | 33 ++ Dumpers/src/DumpFTGeometry.cpp | 130 ++++++ Dumpers/src/DumpFTGeometry.h | 33 ++ Dumpers/src/DumpFTHits.cpp | 90 ++++ Dumpers/src/DumpFTHits.h | 42 ++ Dumpers/src/DumpForwardTracks.cpp | 69 +++ Dumpers/src/DumpForwardTracks.h | 43 ++ Dumpers/src/DumpGeometry.h | 269 ++++++++++++ Dumpers/src/DumpMagneticField.cpp | 27 ++ Dumpers/src/DumpMagneticField.h | 33 ++ Dumpers/src/DumpMuonCommonHits.cpp | 96 ++++ Dumpers/src/DumpMuonCommonHits.h | 45 ++ Dumpers/src/DumpMuonCoords.cpp | 77 ++++ Dumpers/src/DumpMuonCoords.h | 43 ++ Dumpers/src/DumpMuonGeometry.cpp | 74 ++++ Dumpers/src/DumpMuonGeometry.h | 34 ++ Dumpers/src/DumpMuonTable.cpp | 158 +++++++ Dumpers/src/DumpMuonTable.h | 30 ++ Dumpers/src/DumpRawBanks.cpp | 152 +++++++ Dumpers/src/DumpRawBanks.h | 78 ++++ Dumpers/src/DumpUTGeometry.cpp | 157 +++++++ Dumpers/src/DumpUTGeometry.h | 37 ++ Dumpers/src/DumpUTHits.cpp | 91 ++++ Dumpers/src/DumpUTHits.h | 44 ++ Dumpers/src/DumpUTLookupTables.cpp | 35 ++ Dumpers/src/DumpUTLookupTables.h | 33 ++ Dumpers/src/DumpVPGeometry.cpp | 41 ++ Dumpers/src/DumpVPGeometry.h | 33 ++ Dumpers/src/PVDumper.cpp | 92 ++++ Dumpers/src/PVDumper.h | 48 ++ Dumpers/src/TestMuonTable.cpp | 211 +++++++++ Dumpers/src/TestMuonTable.h | 74 ++++ Dumpers/src/Utils.cpp | 39 ++ Dumpers/src/Utils.h | 121 ++++++ Dumpers/src/lib/PyAllenHelper.cpp | 16 + Dumpers/src/lib/TestUTBoards.cpp | 60 +++ Dumpers/tests/options/make_ref.py | 29 ++ Dumpers/tests/options/test_geometry.py | 15 + .../options/upgrade-minbias-testfiledb.py | 16 + Dumpers/tests/qmtest/dumpers.qms/dump.qmt | 62 +++ Dumpers/tests/refs/dump.ref | 410 ++++++++++++++++++ bindings/.gaudi_project_ignore | 0 checker/.gaudi_project_ignore | 0 checker/pv/CMakeLists.txt | 2 +- checker/selections/CMakeLists.txt | 2 +- checker/tracking/CMakeLists.txt | 2 +- configuration/.gaudi_project_ignore | 0 cuda/.gaudi_project_ignore | 0 cuda/PV/beamlinePV/CMakeLists.txt | 2 +- .../beamlinePV/src/pv_beamline_monitoring.cpp | 2 +- cuda/PV/patPV/CMakeLists.txt | 4 +- integration/.gaudi_project_ignore | 0 integration/non_event_data/CMakeLists.txt | 2 +- main/.gaudi_project_ignore | 0 mdf/.gaudi_project_ignore | 0 stream/.gaudi_project_ignore | 0 stream/CMakeLists.txt | 4 +- tests/.gaudi_project_ignore | 0 x86/.gaudi_project_ignore | 0 x86/SciFi/PrForward/CMakeLists.txt | 2 +- x86/muon/decoding/CMakeLists.txt | 2 +- 81 files changed, 4423 insertions(+), 59 deletions(-) create mode 100644 Dumpers/CMakeLists.txt create mode 100644 Dumpers/Dumpers/IUpdater.h create mode 100644 Dumpers/Dumpers/Identifiers.h create mode 100644 Dumpers/Dumpers/PyAllenHelper.h create mode 100644 Dumpers/Dumpers/TestUTBoards.h create mode 100644 Dumpers/options/dump.py create mode 100644 Dumpers/options/dump_MC_info.py create mode 100644 Dumpers/options/dump_banks.py create mode 100644 Dumpers/options/interactive.py create mode 100644 Dumpers/options/upgrade-JPsiMuMu-scifi_v5_local.py create mode 100644 Dumpers/options/upgrade-bsphiphi-magdown-scifi-v5-local.py create mode 100644 Dumpers/options/upgrade-minbias-ldst.py create mode 100644 Dumpers/options/upgrade-minbias-magdown-local.py create mode 100644 Dumpers/options/upgrade-minbias-magdown-scifi-v5-local.py create mode 100644 Dumpers/options/upgrade-minbias-magdown.py create mode 100644 Dumpers/options/upgrade-minbias-magdown.xml create mode 100644 Dumpers/src/AllenUpdater.cpp create mode 100644 Dumpers/src/AllenUpdater.h create mode 100644 Dumpers/src/DumpBeamline.cpp create mode 100644 Dumpers/src/DumpBeamline.h create mode 100644 Dumpers/src/DumpFTGeometry.cpp create mode 100644 Dumpers/src/DumpFTGeometry.h create mode 100644 Dumpers/src/DumpFTHits.cpp create mode 100644 Dumpers/src/DumpFTHits.h create mode 100644 Dumpers/src/DumpForwardTracks.cpp create mode 100644 Dumpers/src/DumpForwardTracks.h create mode 100644 Dumpers/src/DumpGeometry.h create mode 100644 Dumpers/src/DumpMagneticField.cpp create mode 100644 Dumpers/src/DumpMagneticField.h create mode 100644 Dumpers/src/DumpMuonCommonHits.cpp create mode 100644 Dumpers/src/DumpMuonCommonHits.h create mode 100644 Dumpers/src/DumpMuonCoords.cpp create mode 100644 Dumpers/src/DumpMuonCoords.h create mode 100644 Dumpers/src/DumpMuonGeometry.cpp create mode 100644 Dumpers/src/DumpMuonGeometry.h create mode 100644 Dumpers/src/DumpMuonTable.cpp create mode 100644 Dumpers/src/DumpMuonTable.h create mode 100644 Dumpers/src/DumpRawBanks.cpp create mode 100644 Dumpers/src/DumpRawBanks.h create mode 100644 Dumpers/src/DumpUTGeometry.cpp create mode 100644 Dumpers/src/DumpUTGeometry.h create mode 100644 Dumpers/src/DumpUTHits.cpp create mode 100644 Dumpers/src/DumpUTHits.h create mode 100644 Dumpers/src/DumpUTLookupTables.cpp create mode 100644 Dumpers/src/DumpUTLookupTables.h create mode 100644 Dumpers/src/DumpVPGeometry.cpp create mode 100644 Dumpers/src/DumpVPGeometry.h create mode 100644 Dumpers/src/PVDumper.cpp create mode 100644 Dumpers/src/PVDumper.h create mode 100644 Dumpers/src/TestMuonTable.cpp create mode 100644 Dumpers/src/TestMuonTable.h create mode 100644 Dumpers/src/Utils.cpp create mode 100644 Dumpers/src/Utils.h create mode 100644 Dumpers/src/lib/PyAllenHelper.cpp create mode 100644 Dumpers/src/lib/TestUTBoards.cpp create mode 100644 Dumpers/tests/options/make_ref.py create mode 100644 Dumpers/tests/options/test_geometry.py create mode 100644 Dumpers/tests/options/upgrade-minbias-testfiledb.py create mode 100755 Dumpers/tests/qmtest/dumpers.qms/dump.qmt create mode 100644 Dumpers/tests/refs/dump.ref create mode 100644 bindings/.gaudi_project_ignore create mode 100644 checker/.gaudi_project_ignore create mode 100644 configuration/.gaudi_project_ignore create mode 100644 cuda/.gaudi_project_ignore create mode 100644 integration/.gaudi_project_ignore create mode 100644 main/.gaudi_project_ignore create mode 100644 mdf/.gaudi_project_ignore create mode 100644 stream/.gaudi_project_ignore create mode 100644 tests/.gaudi_project_ignore create mode 100644 x86/.gaudi_project_ignore diff --git a/CMakeLists.txt b/CMakeLists.txt index b7c94c6d4fc..5e1242ca4a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,74 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) # Workaround 1/2 for shared cuda runtime set(CMAKE_CUDA_FLAGS "" CACHE STRING "") -if (CMAKE_CUDA_FLAGS) +if(CMAKE_CUDA_FLAGS) list(REMOVE_ITEM CMAKE_CUDA_FLAGS "-cudart static") endif() string(APPEND CMAKE_CUDA_FLAGS "-cudart shared") + +find_package(GaudiProject QUIET) + +if(GaudiProject_FOUND) +# Declare project name and version +gaudi_project(Allen v0r6 + USE Rec v30r4) +set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER}) +enable_language(CUDA) + +find_package(ROOT COMPONENTS Core Hist Tree RIO) +find_package(TBB REQUIRED) +get_filename_component(TBB_LIBDIR ${TBB_LIBRARIES} DIRECTORY) +message(STATUS "Compiling with ROOT: " ${ROOT_INCLUDE_DIRS}) +set(ALLEN_ROOT_LIBRARIES ${ROOT_LIBRARIES} -L${TBB_LIBDIR} -ltbb) +set(ALLEN_ROOT_DEFINITIONS WITH_ROOT ROOT_CXX17) +else() project(Allen C CXX CUDA) +list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) # for find_package +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # for find_package + +option(USE_ROOT "Build with ROOT" OFF) + +if ((EXISTS $ENV{ROOTSYS}) AND (USE_ROOT)) + if(EXISTS $ENV{ROOTSYS}/cmake/ROOTConfig.cmake) # ROOT was compiled with cmake + set(ALLEN_ROOT_CMAKE $ENV{ROOTSYS}) + else() # ROOT was compiled with configure/make + set(ALLEN_ROOT_CMAKE $ENV{ROOTSYS}/etc) + endif() + find_package(ROOT QUIET HINTS ${ALLEN_ROOT_CMAKE} NO_DEFAULT_PATH COMPONENTS Core Hist Tree) + if ( ROOT_FOUND ) + message(STATUS "Compiling with ROOT: " ${ROOT_INCLUDE_DIRS}) + + # If ROOT is built with C++17 support, everything that includes ROOT + # headers must be built with C++17 support. CUDA doesn't support + # that, so we have to factor that out. + execute_process(COMMAND root-config --has-cxx17 OUTPUT_VARIABLE ROOT_HAS_CXX17 ERROR_QUIET) + string(REGEX REPLACE "\n$" "" ROOT_HAS_CXX17 "${ROOT_HAS_CXX17}") + message(STATUS "ROOT built with c++17: ${ROOT_HAS_CXX17}") + if (${ROOT_HAS_CXX17} STREQUAL "yes") + set(ALLEN_ROOT_DEFINITIONS WITH_ROOT ROOT_CXX17) + else() + set(ALLEN_ROOT_DEFINITIONS WITH_ROOT) + endif() + + set(ALLEN_ROOT_LIBRARIES -L$ENV{ROOTSYS}/lib -lTree -lCore -lCling -lHist) + + execute_process(COMMAND root-config --has-imt OUTPUT_VARIABLE ROOT_HAS_IMT ERROR_QUIET) + string(REGEX REPLACE "\n$" "" ROOT_HAS_IMT "${ROOT_HAS_IMT}") + message(STATUS "ROOT built with implicit multi-threading: ${ROOT_HAS_IMT}") + if (${ROOT_HAS_IMT} STREQUAL "yes") + find_package(TBB REQUIRED) + get_filename_component(TBB_LIBDIR ${TBB_LIBRARIES} DIRECTORY) + set(ALLEN_ROOT_LIBRARIES ${ALLEN_ROOT_LIBRARIES} -L${TBB_LIBDIR} -ltbb) + endif() + else() + message(STATUS "Compiling without ROOT") + endif() +else() + message(STATUS "Compiling without ROOT") +endif() + +endif() # Workaround 2/2 for shared cuda runtime if (CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES) @@ -17,9 +79,6 @@ if (CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES) list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "cudart_static" ) endif() -list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) # for find_package -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # for find_package - # Deal with build type if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo) @@ -52,7 +111,7 @@ endif() if (CUDA_ARCH STREQUAL "MIN" OR CUDA_ARCH STREQUAL "MAX" OR CUDA_ARCH STREQUAL "COMP") set(OUTPUTFILE ${PROJECT_BINARY_DIR}/cuda_arch) # No suffix required set(CUDAFILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils/cuda_arch.cu) - execute_process(COMMAND ${CMAKE_CUDA_COMPILER} -lcuda ${CUDAFILE} -o ${OUTPUTFILE}) + execute_process(COMMAND ${CMAKE_CUDA_COMPILER} -std=c++11 -lcuda ${CUDAFILE} -o ${OUTPUTFILE}) if(CUDA_ARCH STREQUAL "MAX") set(CHECK_ARGS "-l") endif() @@ -99,51 +158,9 @@ endif(USE_LZ4) option(USE_KALMAN_SINGLE_PRECISION "Use single precision Kalman filter" ON) -# find_package(CUDA REQUIRED) -#set(CUDA_HOST_COMPILER "g++") set(CUDA_SEPARABLE_COMPILATION ON) option(CUDA_PROPAGATE_HOST_FLAGS "Propagate CUDA host flags" OFF) -option(USE_ROOT "Build with ROOT" OFF) -if ((EXISTS $ENV{ROOTSYS}) AND (USE_ROOT)) - if(EXISTS $ENV{ROOTSYS}/cmake/ROOTConfig.cmake) # ROOT was compiled with cmake - set(ALLEN_ROOT_CMAKE $ENV{ROOTSYS}) - else() # ROOT was compiled with configure/make - set(ALLEN_ROOT_CMAKE $ENV{ROOTSYS}/etc) - endif() - find_package(ROOT QUIET HINTS ${ALLEN_ROOT_CMAKE} NO_DEFAULT_PATH COMPONENTS Core Hist Tree) - if ( ROOT_FOUND ) - message(STATUS "Compiling with ROOT: " ${ROOT_INCLUDE_DIRS}) - - # If ROOT is built with C++17 support, everything that includes ROOT - # headers must be built with C++17 support. CUDA doesn't support - # that, so we have to factor that out. - execute_process(COMMAND root-config --has-cxx17 OUTPUT_VARIABLE ROOT_HAS_CXX17 ERROR_QUIET) - string(REGEX REPLACE "\n$" "" ROOT_HAS_CXX17 "${ROOT_HAS_CXX17}") - message(STATUS "ROOT built with c++17: ${ROOT_HAS_CXX17}") - if (${ROOT_HAS_CXX17} STREQUAL "yes") - set(ALLEN_ROOT_DEFINITIONS WITH_ROOT ROOT_CXX17) - else() - set(ALLEN_ROOT_DEFINITIONS WITH_ROOT) - endif() - - set(ALLEN_ROOT_LIBRARIES -L$ENV{ROOTSYS}/lib -lTree -lCore -lCling -lHist) - - execute_process(COMMAND root-config --has-imt OUTPUT_VARIABLE ROOT_HAS_IMT ERROR_QUIET) - string(REGEX REPLACE "\n$" "" ROOT_HAS_IMT "${ROOT_HAS_IMT}") - message(STATUS "ROOT built with implicit multi-threading: ${ROOT_HAS_IMT}") - if (${ROOT_HAS_IMT} STREQUAL "yes") - find_package(TBB REQUIRED) - get_filename_component(TBB_LIBDIR ${TBB_LIBRARIES} DIRECTORY) - set(ALLEN_ROOT_LIBRARIES ${ALLEN_ROOT_LIBRARIES} -L${TBB_LIBDIR} -ltbb) - endif() - else() - message(STATUS "Compiling without ROOT") - endif() -else() - message(STATUS "Compiling without ROOT") -endif() - # Cuda: Deal with build type if(${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo) set(CMAKE_CUDA_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG --generate-line-info") diff --git a/Dumpers/CMakeLists.txt b/Dumpers/CMakeLists.txt new file mode 100644 index 00000000000..8f31b3cfa44 --- /dev/null +++ b/Dumpers/CMakeLists.txt @@ -0,0 +1,50 @@ +############################################################################### +# (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. # +############################################################################### +################################################################################ +# Package: BinaryDumpers +################################################################################ +gaudi_subdir(BinaryDumpers v1r0) + +gaudi_depends_on_subdirs(Det/FTDet + Det/VPDet + UT/UTDAQ + UT/UTKernel + Event/FTEvent + DAQ/DAQKernel + Event/DAQEvent + Event/DigiEvent + GaudiAlg + Pr/PrKernel + Muon/MuonID) + +find_package(Boost REQUIRED) +find_package(Rangev3 REQUIRED) +find_package(ROOT COMPONENTS Core) +include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${Rangev3_INCLUDE_DIRS}) + +gaudi_install_headers(Dumpers) + +gaudi_add_library(BinaryDumpersLib + NO_PUBLIC_HEADERS + src/lib/*.cpp + INCLUDE_DIRS Event/FTEvent Pr/PrPixel + LINK_LIBRARIES DAQEventLib DAQKernelLib GaudiAlgLib + PrKernel VPDetLib UTDetLib UTKernelLib + FTDetLib MuonIDLib) + +gaudi_add_module(BinaryDumpers + src/*.cpp + INCLUDE_DIRS Event/FTEvent Det/VPDet + LINK_LIBRARIES DAQEventLib DAQKernelLib GaudiAlgLib + PrKernel VPDetLib UTDetLib UTKernelLib + FTDetLib MuonIDLib) + +gaudi_add_test(QMTest QMTEST) diff --git a/Dumpers/Dumpers/IUpdater.h b/Dumpers/Dumpers/IUpdater.h new file mode 100644 index 00000000000..3a5f45a1fb0 --- /dev/null +++ b/Dumpers/Dumpers/IUpdater.h @@ -0,0 +1,112 @@ +/*****************************************************************************\ +* (c) Copyright 2019 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. * +\*****************************************************************************/ +#pragma once + +#include <functional> +#include <memory> +#include <optional> +#include <string> +#include <vector> + +#include "Identifiers.h" + +namespace Allen { + namespace NonEventData { + + struct Consumer { + /** + * @brief Consume binary non-event data to copy to an accelerator + * + * @param binary data to be consumed + * + * @return void + */ + virtual void consume( std::vector<char> const& data ) = 0; + virtual ~Consumer() = default; + }; + + /** + * @brief Producer type expected by IUpdater + * + */ + using Producer = std::function<std::optional<std::vector<char>>()>; + + /** @class IUpdater IUpdater.h Dumpers/IUpdater.h + * Interface - shared with Allen - to the manager of Producer and Consumer + * of binary non-event data. + * + * @author Roel Aaij + * @date 2019-05-27 + */ + class IUpdater { + public: + virtual ~IUpdater() {} + + /** + * @brief Register a consumer for that will consume binary non-event + * data; identified by identifier type C + * + * @param the consumer + * + * @return void + */ + template <typename C> + void registerConsumer( std::unique_ptr<Consumer> c ) { + registerConsumer( C::id, std::move( c ) ); + } + + /** + * @brief Register a producer that will produce binary non-event + * data; identified by identifier type P + * + * @param the producer + * + * @return void + */ + template <typename P> + void registerProducer( Producer p ) { + registerProducer( P::id, std::move( p ) ); + } + + /** + * @brief Update all registered non-event data by calling all + * registered Producer and Consumer + * + * @param run number or event time + * + * @return void + */ + virtual void update( unsigned long run ) = 0; + + /** + * @brief Register a consumer for that will consume binary non-event + * data; identified by string + * + * @param identifier string + * @param the consumer + * + * @return void + */ + virtual void registerConsumer( std::string const& id, std::unique_ptr<Consumer> c ) = 0; + + /** + * @brief Register a producer that will produce binary non-event + * data; identified by string + * + * @param identifier string + * @param the producer + * + * @return void + */ + virtual void registerProducer( std::string const& id, Producer p ) = 0; + }; + } // namespace NonEventData +} // namespace Allen diff --git a/Dumpers/Dumpers/Identifiers.h b/Dumpers/Dumpers/Identifiers.h new file mode 100644 index 00000000000..da6e2ff7b9e --- /dev/null +++ b/Dumpers/Dumpers/Identifiers.h @@ -0,0 +1,83 @@ +/*****************************************************************************\ +* (c) Copyright 2019 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. * +\*****************************************************************************/ +#pragma once + +#include <string> + +namespace Allen { + namespace NonEventData { + struct Identifier {}; + + /** @class VeloGeometry + * Identifier for the Velo Geometry non-event data for Allen + */ + struct VeloGeometry : Identifier { + inline static std::string const id = "VeloGeometry"; + }; + + /** @class UTGeometry + * Identifier for the UT Geometry non-event data for Allen + */ + struct UTGeometry : Identifier { + inline static std::string const id = "UTGeometry"; + }; + + /** @class UTBoards + * Identifier for the UT readout boards non-event data for Allen + */ + struct UTBoards : Identifier { + inline static std::string const id = "UTBoards"; + }; + + /** @class SciFiGeometry + * Identifier for the SciFi Geometry non-event data for Allen + */ + struct SciFiGeometry : Identifier { + inline static std::string const id = "SciFiGeometry"; + }; + + /** @class UTLookupTables + * Identifier for the UT lookup tables for Allen + */ + struct UTLookupTables : Identifier { + inline static std::string const id = "UTLookupTables"; + }; + + /** @class UTLookupTables + * Identifier for the beamline position for Allen + */ + struct Beamline : Identifier { + inline static std::string const id = "Beamline"; + }; + + /** @class UTLookupTables + * Identifier for the magnetic field non-event data for Allen + */ + struct MagneticField : Identifier { + inline static std::string const id = "MagneticField"; + }; + + /** @class MuonGeometry + * Identifier for the Muon geometry non-event data for Allen + */ + struct MuonGeometry : Identifier { + inline static std::string const id = "MuonGeometry"; + }; + + /** @class MuonLookupTables + * Identifier for the Muon lookup tables for Allen + */ + struct MuonLookupTables : Identifier { + inline static std::string const id = "MuonLookupTables"; + }; + + } // namespace NonEventData +} // namespace Allen diff --git a/Dumpers/Dumpers/PyAllenHelper.h b/Dumpers/Dumpers/PyAllenHelper.h new file mode 100644 index 00000000000..af00d2499e4 --- /dev/null +++ b/Dumpers/Dumpers/PyAllenHelper.h @@ -0,0 +1,22 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <Dumpers/IUpdater.h> +#include <GaudiKernel/Service.h> + +/** + * @brief Helper function to cast the LHCb-implementation of the Allen + * non-event data manager to its shared interface + * + * @param The Allen non-event data manager as an IService + * + * @return The Allen non-event data manager as an IUpdater + */ +Allen::NonEventData::IUpdater* cast_updater( IService* updater_svc ); diff --git a/Dumpers/Dumpers/TestUTBoards.h b/Dumpers/Dumpers/TestUTBoards.h new file mode 100644 index 00000000000..5226f47cf58 --- /dev/null +++ b/Dumpers/Dumpers/TestUTBoards.h @@ -0,0 +1,35 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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. * +\*****************************************************************************/ +#pragma once + +#include <string> +#include <vector> + +/** + * @brief Class to test reading UT boards non-event data + */ +struct UTBoards { + UTBoards( std::vector<char> data ); + + uint32_t number_of_boards; + uint32_t number_of_channels; + uint32_t* stripsPerHybrids; + uint32_t* stations; + uint32_t* layers; + uint32_t* detRegions; + uint32_t* sectors; + uint32_t* chanIDs; + +private: + std::vector<char> m_data; +}; + +UTBoards readBoards( std::string const& filename ); diff --git a/Dumpers/options/dump.py b/Dumpers/options/dump.py new file mode 100644 index 00000000000..96724cdc91c --- /dev/null +++ b/Dumpers/options/dump.py @@ -0,0 +1,92 @@ +############################################################################### +# (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. # +############################################################################### +from Configurables import LHCbApp, CondDB +from Configurables import GaudiSequencer +from Configurables import FTRawBankDecoder +from Configurables import (PrStoreUTHit, PrStoreFTHit) +from Configurables import ApplicationMgr +from Configurables import HistogramPersistencySvc +from Configurables import (AuditorSvc, SequencerTimerTool) +from Configurables import (DumpUTGeometry, DumpFTGeometry, DumpMuonTable, + DumpUTLookupTables, DumpMuonGeometry, + DumpVPGeometry) +from Configurables import RootHistCnv__PersSvc +from Configurables import IODataManager +from Configurables import (VPClus, createODIN, DumpRawBanks, DumpUTHits, + DumpFTHits, DumpMuonCoords, DumpMuonCommonHits, + DumpMagneticField, DumpBeamline, MuonRec, + PrepareMuonHits) +from Configurables import TestMuonTable + +app = LHCbApp( + DataType="Upgrade", + EvtMax=1000, + Simulation=True, + DDDBtag="dddb-20171122", + CondDBtag="sim-20180530-vc-md100") + +# Upgrade DBs +CondDB().Upgrade = True + +# Decode VP, UT, FT and muons +vp_decoder = VPClus("VPClustering") +store_ut = PrStoreUTHit() +ft_decoder = FTRawBankDecoder("createFTClusters", DecodingVersion=5) +store_ft = PrStoreFTHit() +decode_muon = MuonRec() +muon_hits = PrepareMuonHits() + +dec_seq = GaudiSequencer("DecodingSeq") +dec_seq.Members = [ + createODIN(), vp_decoder, store_ut, ft_decoder, store_ft, decode_muon, + muon_hits +] + +# Add the service that will dump the UT and FT geometry +ApplicationMgr().ExtSvc += [ + DumpMagneticField(), + DumpBeamline(), + DumpVPGeometry(), + DumpUTGeometry(), + DumpFTGeometry(), + DumpMuonGeometry(), + DumpMuonTable(), + DumpUTLookupTables() +] + +# Dump raw banks and UT, FT and muon hits +dump_banks = DumpRawBanks(BankTypes=["VP", "UT", "FTCluster", "Muon"]) +dump_ut = DumpUTHits() +dump_ft = DumpFTHits() +dump_muon_coords = DumpMuonCoords() +dump_muon_hits = DumpMuonCommonHits() +dump_seq = GaudiSequencer("DumpSeq") + +dump_seq.Members += [ + dump_banks, dump_ut, dump_ft, dump_muon_coords, dump_muon_hits, + TestMuonTable() +] + +ApplicationMgr().TopAlg = [dec_seq, dump_seq] + +# Some extra stuff for timing table +ApplicationMgr().ExtSvc += ['ToolSvc', 'AuditorSvc'] +ApplicationMgr().AuditAlgorithms = True +AuditorSvc().Auditors += ['TimingAuditor'] +SequencerTimerTool().OutputLevel = 4 + +# Some extra stuff to save histograms +ApplicationMgr().HistogramPersistency = "ROOT" +RootHistCnv__PersSvc('RootHistCnv').ForceAlphaIds = True +HistogramPersistencySvc().OutputFile = "dump-histos.root" + +# No error messages when reading MDF +IODataManager().DisablePFNWarning = True diff --git a/Dumpers/options/dump_MC_info.py b/Dumpers/options/dump_MC_info.py new file mode 100644 index 00000000000..35a2e910feb --- /dev/null +++ b/Dumpers/options/dump_MC_info.py @@ -0,0 +1,85 @@ +############################################################################### +# (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. # +############################################################################### +from Configurables import Brunel +from Configurables import (TrackSys, GaudiSequencer) +from Configurables import FTRawBankDecoder +from Configurables import NTupleSvc +from Gaudi.Configuration import appendPostConfigAction + +# DDDBtag = "dddb-20171010" +# CondDBtag = "sim-20170301-vc-md100" + +# For privately produced minbias and BsPhiPhi +# in /eos/lhcb/wg/SciFi/Simulation/MinBiasRawBankv5/ +# and /eos/lhcb/wg/SciFi/Simulation/RawBanksv5/ +DDDBtag = "dddb-20180815" +CondDBtag = "sim-20180530-vc-md100" + +Evts_to_Run = 1000 # set to -1 to process all + +mbrunel = Brunel( + DataType="Upgrade", + EvtMax=Evts_to_Run, + PrintFreq=1, + WithMC=True, + Simulation=True, + OutputType="None", + DDDBtag=DDDBtag, + CondDBtag=CondDBtag, + MainSequence=['ProcessPhase/Reco'], + RecoSequence=["Decoding", "TrFast"], + Detectors=["VP", "UT", "FT"], + InputType="DIGI") + +TrackSys().TrackingSequence = ["Decoding", "TrFast"] +TrackSys().TrackTypes = ["Velo", "Upstream", "Forward"] +mbrunel.MainSequence += ['ProcessPhase/MCLinks', 'ProcessPhase/Check'] + +FTRawBankDecoder("createFTClusters").DecodingVersion = 5 + +NTupleSvc().Output = ["FILE1 DATAFILE='velo_states.root' TYP='ROOT' OPT='NEW'"] + + +def modifySequences(): + try: + # empty the calo sequence + GaudiSequencer("MCLinksCaloSeq").Members = [] + # GaudiSequencer("MCLinksCaloSeq").Members = [] + from Configurables import TrackResChecker + GaudiSequencer("CheckPatSeq").Members.remove( + TrackResChecker("TrackResCheckerFast")) + from Configurables import VectorOfTracksFitter + GaudiSequencer("RecoTrFastSeq").Members.remove( + VectorOfTracksFitter("ForwardFitterAlgFast")) + from Configurables import PrTrackAssociator + GaudiSequencer("ForwardFastFittedExtraChecker").Members.remove( + PrTrackAssociator("ForwardFastFittedAssociator")) + from Configurables import MuonRec + GaudiSequencer("RecoDecodingSeq").Members.append(MuonRec()) + except ValueError: + None + + +appendPostConfigAction(modifySequences) + + +def AddDumpers(): + from Configurables import PrTrackerDumper, DumpVeloUTState, PVDumper + dump_mc = PrTrackerDumper( + "DumpMCInfo", DumpToBinary=True, DumpToROOT=False) + #dump_mc.OutputDirectory = "/afs/cern.ch/work/d/dovombru/public/gpu_input/minbias/TrackerDumper" + #dump_mc.MCOutputDirectory = "/afs/cern.ch/work/d/dovombru/public/gpu_input/minbias/MC_info/tracks" + dump_pvmc = PVDumper("DumpPVMCInfo") + #dump_pvmc.OutputDirectory = "/afs/cern.ch/work/d/dovombru/public/gpu_input/minbias/MC_info/PVs" + GaudiSequencer("MCLinksTrSeq").Members += [dump_mc, dump_pvmc] + + +appendPostConfigAction(AddDumpers) diff --git a/Dumpers/options/dump_banks.py b/Dumpers/options/dump_banks.py new file mode 100644 index 00000000000..f73af8954f0 --- /dev/null +++ b/Dumpers/options/dump_banks.py @@ -0,0 +1,82 @@ +############################################################################### +# (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. # +############################################################################### +from Configurables import LHCbApp, CondDB +from Configurables import GaudiSequencer +from Configurables import FTRawBankDecoder +from Configurables import (PrStoreUTHit, PrStoreFTHit) +from Configurables import ApplicationMgr +from Configurables import HistogramPersistencySvc +from Configurables import (AuditorSvc, SequencerTimerTool) +from Configurables import DumpUTGeometry +from Configurables import RootHistCnv__PersSvc +from Configurables import (VPClus, createODIN, DumpRawBanks, DumpUTHits, + DumpFTHits, DumpMuonCoords, DumpMuonCommonHits, + MuonRec, PrepareMuonHits) + +# new MC in tmp/ +#DDDBtag = "dddb-20171010" +#CondDBtag = "sim-20170301-vc-md100" + +# For privately produced minbias and BsPhiPhi +# in /eos/lhcb/wg/SciFi/Simulation/MinBiasRawBankv5/ +# and /eos/lhcb/wg/SciFi/Simulation/RawBanksv5/ +DDDBtag = "dddb-20180815" +CondDBtag = "sim-20180530-vc-md100" + +Evts_to_Run = 1000 # set to -1 to process all + +app = LHCbApp( + DataType="Upgrade", + EvtMax=Evts_to_Run, + Simulation=True, + DDDBtag=DDDBtag, + CondDBtag=CondDBtag) +CondDB().Upgrade = True + +# Decode VP, UT, FT and muons +vp_decoder = VPClus("VPClustering") +store_ut = PrStoreUTHit() +ft_decoder = FTRawBankDecoder("createFTClusters", DecodingVersion=5) +store_ft = PrStoreFTHit() +decode_muon = MuonRec() +muon_hits = PrepareMuonHits() + +dec_seq = GaudiSequencer("DecodingSeq") +dec_seq.Members = [ + createODIN(), vp_decoder, store_ut, ft_decoder, store_ft, decode_muon, + muon_hits +] + +# Add the service that will dump the UT geometry +ApplicationMgr().ExtSvc += [DumpUTGeometry()] + +# Dump raw banks and UT, FT and muon hits +dump_banks = DumpRawBanks(BankTypes=["VP", "UT", "FTCluster", "Muon"]) +#dump_banks.OutputDirectory = "/afs/cern.ch/work/d/dovombru/public/gpu_input/minbias/banks" +dump_muon_coords = DumpMuonCoords() +#dump_muon_coords.OutputDirectory = "/afs/cern.ch/work/d/dovombru/public/gpu_input/minbias/muon_coords" +dump_muon_hits = DumpMuonCommonHits() +#dump_muon_hits.OutputDirectory = "/afs/cern.ch/work/d/dovombru/public/gpu_input/minbias/muon_common_hits" +dump_seq = GaudiSequencer("DumpSeq") +dump_seq.Members += [dump_banks, dump_muon_coords, dump_muon_hits] + +ApplicationMgr().TopAlg = [dec_seq, dump_seq] + +# Some extra stuff for timing table +ApplicationMgr().ExtSvc += ['ToolSvc', 'AuditorSvc'] +ApplicationMgr().AuditAlgorithms = True +AuditorSvc().Auditors += ['TimingAuditor'] +SequencerTimerTool().OutputLevel = 4 + +# Some extra stuff to save histograms +ApplicationMgr().HistogramPersistency = "ROOT" +RootHistCnv__PersSvc('RootHistCnv').ForceAlphaIds = True +HistogramPersistencySvc().OutputFile = "dump-histos.root" diff --git a/Dumpers/options/interactive.py b/Dumpers/options/interactive.py new file mode 100644 index 00000000000..3ec87effaf7 --- /dev/null +++ b/Dumpers/options/interactive.py @@ -0,0 +1,27 @@ +############################################################################### +# (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. # +############################################################################### +from __future__ import print_function +from Gaudi.Configuration import importOptions + +importOptions("options.py") +importOptions("upgrade-minbias-magdown.py") + +from GaudiPython.Bindings import gbl, AppMgr + +gaudi = AppMgr() +gaudi.initialize() + +TES = gaudi.evtSvc() + +gaudi.run(1) + +coords = TES['Raw/Muon/Coords'].containedObjects() +print(coords[0]) diff --git a/Dumpers/options/upgrade-JPsiMuMu-scifi_v5_local.py b/Dumpers/options/upgrade-JPsiMuMu-scifi_v5_local.py new file mode 100644 index 00000000000..7a593dad8e8 --- /dev/null +++ b/Dumpers/options/upgrade-JPsiMuMu-scifi_v5_local.py @@ -0,0 +1,129 @@ +############################################################################### +# (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. # +############################################################################### +# -- GAUDI jobOptions generated on Mon Oct 30 12:18:44 2017 +# -- Contains event types : +# -- 30000000 - 77 files - 92213 events - 305.47 GBytes + +# -- Extra information about the data processing phases: + +# -- Processing Pass Step-132412 + +# -- StepId : 132412 +# -- StepName : Digi14b-Upgrade for Upgrade studies with spillover - 2017 Baseline NoRichSpillover - xdigi +# -- ApplicationName : Boole +# -- ApplicationVersion : v31r3 +# -- OptionFiles : $APPCONFIGOPTS/Boole/Default.py;$APPCONFIGOPTS/Boole/Boole-Upgrade-Baseline-20150522.py;$APPCONFIGOPTS/Boole/EnableSpillover.py;$APPCONFIGOPTS/Boole/Upgrade-RichMaPMT-NoSpilloverDigi.py;$APPCONFIGOPTS/Boole/xdigi.py +# -- DDDB : dddb-20171010 +# -- CONDDB : sim-20170301-vc-md100 +# -- ExtraPackages : AppConfig.v3r338 +# -- Visible : N +from GaudiConf import IOHelper +IOHelper('ROOT').inputFiles([ + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-0.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-10.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-11.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-12.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-13.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-14.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-15.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-16.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-17.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-18.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-19.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-1.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-20.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-21.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-22.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-23.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-24.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-25.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-26.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-27.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-28.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-29.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-30.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-31.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-32.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-33.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-35.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-36.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-37.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-38.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-39.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-3.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-40.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-41.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-42.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-43.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-44.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-45.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-46.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-47.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-48.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-49.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-4.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-50.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-51.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-52.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-53.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-54.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-55.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-56.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-57.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-58.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-59.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-5.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-60.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-61.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-62.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-63.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-64.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-65.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-66.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-67.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-68.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-69.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-6.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-70.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-71.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-72.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-73.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-74.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-75.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-76.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-77.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-78.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-79.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-7.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-80.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-81.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-82.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-83.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-84.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-85.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-86.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-87.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-88.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-89.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-8.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-90.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-91.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-92.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-93.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-94.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-95.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-96.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-97.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-98.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-99.digi', + '/afs/cern.ch/work/d/dovombru/public/MC/upgrade_JPsiMuMu/Boole-6x2-WithSpillover-24142000-50000-9.digi', +], + clear=True) diff --git a/Dumpers/options/upgrade-bsphiphi-magdown-scifi-v5-local.py b/Dumpers/options/upgrade-bsphiphi-magdown-scifi-v5-local.py new file mode 100644 index 00000000000..4d3af975f0d --- /dev/null +++ b/Dumpers/options/upgrade-bsphiphi-magdown-scifi-v5-local.py @@ -0,0 +1,24 @@ +############################################################################### +# (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. # +############################################################################### +# DDDBtag = "dddb-20171010" +# CondDBtag = "sim-20180530-vc-md100" + +from GaudiConf import IOHelper +IOHelper('ROOT').inputFiles( + [ + # SciFi v5, bsphiphi + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/RawBanksv5/Boole_0_evt1k_13104012_MagDown_v5_new.digi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/RawBanksv5/Boole_1_evt1k_13104012_MagDown_v5_new.digi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/RawBanksv5/Boole_2_evt1k_13104012_MagDown_v5_new.digi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/RawBanksv5/Boole_3_evt1k_13104012_MagDown_v5_new.digi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/RawBanksv5/Boole_4_evt1k_13104012_MagDown_v5_new.digi' + ], + clear=True) diff --git a/Dumpers/options/upgrade-minbias-ldst.py b/Dumpers/options/upgrade-minbias-ldst.py new file mode 100644 index 00000000000..8cf7767fb45 --- /dev/null +++ b/Dumpers/options/upgrade-minbias-ldst.py @@ -0,0 +1,19 @@ +############################################################################### +# (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. # +############################################################################### +from Configurables import LHCbApp +from PRConfig import TestFileDB +from Configurables import RecombineRawEvent + +sample = TestFileDB.test_file_db[ + 'upgrade-magdown-sim09c-up02-reco-up01-minbias-ldst'] +sample.run(configurable=LHCbApp(), withDB=True) + +RecombineRawEvent().Version = 4.1 diff --git a/Dumpers/options/upgrade-minbias-magdown-local.py b/Dumpers/options/upgrade-minbias-magdown-local.py new file mode 100644 index 00000000000..c3ec67ac468 --- /dev/null +++ b/Dumpers/options/upgrade-minbias-magdown-local.py @@ -0,0 +1,33 @@ +############################################################################### +# (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. # +############################################################################### +# -- GAUDI jobOptions generated on Mon Oct 30 12:18:44 2017 +# -- Contains event types : +# -- 30000000 - 77 files - 92213 events - 305.47 GBytes + +# -- Extra information about the data processing phases: + +# -- Processing Pass Step-132412 + +# -- StepId : 132412 +# -- StepName : Digi14b-Upgrade for Upgrade studies with spillover - 2017 Baseline NoRichSpillover - xdigi +# -- ApplicationName : Boole +# -- ApplicationVersion : v31r3 +# -- OptionFiles : $APPCONFIGOPTS/Boole/Default.py;$APPCONFIGOPTS/Boole/Boole-Upgrade-Baseline-20150522.py;$APPCONFIGOPTS/Boole/EnableSpillover.py;$APPCONFIGOPTS/Boole/Upgrade-RichMaPMT-NoSpilloverDigi.py;$APPCONFIGOPTS/Boole/xdigi.py +# -- DDDB : dddb-20171010 +# -- CONDDB : sim-20170301-vc-md100 +# -- ExtraPackages : AppConfig.v3r338 +# -- Visible : N +from GaudiConf import IOHelper +IOHelper('ROOT').inputFiles([ + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000013_1.xdigi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000020_1.xdigi' +], + clear=True) diff --git a/Dumpers/options/upgrade-minbias-magdown-scifi-v5-local.py b/Dumpers/options/upgrade-minbias-magdown-scifi-v5-local.py new file mode 100644 index 00000000000..17e864a070f --- /dev/null +++ b/Dumpers/options/upgrade-minbias-magdown-scifi-v5-local.py @@ -0,0 +1,25 @@ +############################################################################### +# (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. # +############################################################################### +# DDDBtag = "dddb-20171010" +# CondDBtag = "sim-20180530-vc-md100" + +from GaudiConf import IOHelper +IOHelper('ROOT').inputFiles( + [ + # SciFi v5, minbias + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/MinBiasRawBankv5/00067189_1.digi.digi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/MinBiasRawBankv5/00067189_2.digi.digi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/MinBiasRawBankv5/00067189_3.digi.digi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/MinBiasRawBankv5/00067189_4.digi.digi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/MinBiasRawBankv5/00067189_5.digi.digi', + 'PFN:root://eoslhcb.cern.ch//eos/lhcb/wg/SciFi/Simulation/MinBiasRawBankv5/00067189_6.digi.digi' + ], + clear=True) diff --git a/Dumpers/options/upgrade-minbias-magdown.py b/Dumpers/options/upgrade-minbias-magdown.py new file mode 100644 index 00000000000..cf2c7e98117 --- /dev/null +++ b/Dumpers/options/upgrade-minbias-magdown.py @@ -0,0 +1,47 @@ +############################################################################### +# (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. # +############################################################################### +# -- GAUDI jobOptions generated on Mon Oct 30 12:18:44 2017 +# -- Contains event types : +# -- 30000000 - 77 files - 92213 events - 305.47 GBytes + +# -- Extra information about the data processing phases: + +# -- Processing Pass Step-132412 + +# -- StepId : 132412 +# -- StepName : Digi14b-Upgrade for Upgrade studies with spillover - 2017 Baseline NoRichSpillover - xdigi +# -- ApplicationName : Boole +# -- ApplicationVersion : v31r3 +# -- OptionFiles : $APPCONFIGOPTS/Boole/Default.py;$APPCONFIGOPTS/Boole/Boole-Upgrade-Baseline-20150522.py;$APPCONFIGOPTS/Boole/EnableSpillover.py;$APPCONFIGOPTS/Boole/Upgrade-RichMaPMT-NoSpilloverDigi.py;$APPCONFIGOPTS/Boole/xdigi.py +# -- DDDB : dddb-20171010 +# -- CONDDB : sim-20170301-vc-md100 +# -- ExtraPackages : AppConfig.v3r338 +# -- Visible : N + +from Gaudi.Configuration import FileCatalog +from GaudiConf import IOHelper +IOHelper('ROOT').inputFiles([ + 'LFN:/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000013_1.xdigi', + 'LFN:/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000020_1.xdigi', + 'LFN:/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000034_1.xdigi', + 'LFN:/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000067_1.xdigi', + 'LFN:/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000076_1.xdigi', + 'LFN:/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000078_1.xdigi', + 'LFN:/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000083_1.xdigi', + 'LFN:/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000098_1.xdigi', +], + clear=True) + +import inspect +import os +py_path = os.path.abspath(inspect.stack()[0][1]) +catalog = os.path.join(os.path.dirname(py_path), 'upgrade-minbias-magdown.xml') +FileCatalog().Catalogs += ['xmlcatalog_file:' + catalog] diff --git a/Dumpers/options/upgrade-minbias-magdown.xml b/Dumpers/options/upgrade-minbias-magdown.xml new file mode 100644 index 00000000000..3158a45e52b --- /dev/null +++ b/Dumpers/options/upgrade-minbias-magdown.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<!-- + (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. +--> +<!-- Edited By PoolXMLCatalog.py --> +<!DOCTYPE POOLFILECATALOG SYSTEM "InMemory"> +<POOLFILECATALOG> + +<File ID="1E8D2EBC-31BD-E711-B2FC-FA163EFF0355"> + <physical> + <pfn filetype="ROOT_All" name="root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000098_1.xdigi" se="CERN_MC-DST-EOS"/> + </physical> + <logical> + <lfn name="/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000098_1.xdigi"/> + </logical> +</File> +<File ID="6E4F715E-42B5-E711-8D8E-0CC47A07FA22"> + <physical> + <pfn filetype="ROOT_All" name="root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000013_1.xdigi" se="CERN_MC-DST-EOS"/> + </physical> + <logical> + <lfn name="/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000013_1.xdigi"/> + </logical> +</File> +<File ID="1E9DF25D-D7B5-E711-B6BD-0CC47A544F58"> + <physical> + <pfn filetype="ROOT_All" name="root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000020_1.xdigi" se="CERN_MC-DST-EOS"/> + </physical> + <logical> + <lfn name="/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000020_1.xdigi"/> + </logical> +</File> +<File ID="E401FBE2-2CB7-E711-BA0B-001E67C9B44C"> + <physical> + <pfn filetype="ROOT_All" name="root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000034_1.xdigi" se="CERN_MC-DST-EOS"/> + </physical> + <logical> + <lfn name="/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000034_1.xdigi"/> + </logical> +</File> +<File ID="BA0EA13F-B2BA-E711-BE73-02163E0136BD"> + <physical> + <pfn filetype="ROOT_All" name="root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000083_1.xdigi" se="CERN_MC-DST-EOS"/> + </physical> + <logical> + <lfn name="/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000083_1.xdigi"/> + </logical> +</File> +<File ID="DA49B6BA-8ABA-E711-BC75-FA163E32D1A2"> + <physical> + <pfn filetype="ROOT_All" name="root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000076_1.xdigi" se="CERN_MC-DST-EOS"/> + </physical> + <logical> + <lfn name="/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000076_1.xdigi"/> + </logical> +</File> +<File ID="AC539ABF-D1B8-E711-BED3-FA163EDA8862"> + <physical> + <pfn filetype="ROOT_All" name="root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000067_1.xdigi" se="CERN_MC-DST-EOS"/> + </physical> + <logical> + <lfn name="/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000067_1.xdigi"/> + </logical> +</File> +<File ID="8407CDD3-98BA-E711-9ECB-0CC47A5450F8"> + <physical> + <pfn filetype="ROOT_All" name="root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000078_1.xdigi" se="CERN_MC-DST-EOS"/> + </physical> + <logical> + <lfn name="/lhcb/MC/Upgrade/XDIGI/00067189/0000/00067189_00000078_1.xdigi"/> + </logical> +</File> + +</POOLFILECATALOG> diff --git a/Dumpers/src/AllenUpdater.cpp b/Dumpers/src/AllenUpdater.cpp new file mode 100644 index 00000000000..940e6fa3b57 --- /dev/null +++ b/Dumpers/src/AllenUpdater.cpp @@ -0,0 +1,83 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <map> +#include <memory> +#include <optional> +#include <string> + +#include "AllenUpdater.h" +#include <Dumpers/Identifiers.h> + +namespace { + using std::map; + using std::optional; + using std::string; + using std::tuple; + using std::unique_ptr; + using std::vector; +} // namespace + +DECLARE_COMPONENT( AllenUpdater ) + +void AllenUpdater::registerConsumer( string const& id, unique_ptr<Allen::NonEventData::Consumer> c ) { + auto it = m_pairs.find( id ); + if ( it == m_pairs.end() ) { + vector<unique_ptr<Allen::NonEventData::Consumer>> consumers( 1 ); + consumers[0] = std::move( c ); + auto entry = tuple{Allen::NonEventData::Producer{}, std::move( consumers )}; + m_pairs.emplace( id, std::move( entry ) ); + } else { + std::get<1>( it->second ).emplace_back( std::move( c ) ); + } + if ( msgLevel( MSG::DEBUG ) ) { debug() << "Registered Consumer for " << id << endmsg; } +} + +void AllenUpdater::registerProducer( string const& id, Allen::NonEventData::Producer p ) { + auto it = m_pairs.find( id ); + if ( it == m_pairs.end() ) { + auto entry = tuple{std::move( p ), std::vector<std::unique_ptr<Allen::NonEventData::Consumer>>{}}; + m_pairs.emplace( id, std::move( entry ) ); + } else if ( !std::get<0>( it->second ) ) { + std::get<0>( it->second ) = std::move( p ); + } else { + throw GaudiException{string{"Producer for "} + id, name(), StatusCode::FAILURE}; + } + if ( msgLevel( MSG::DEBUG ) ) { debug() << "Registered Producer for " << id << endmsg; } +} + +void AllenUpdater::update( unsigned long time ) { + if ( msgLevel( MSG::DEBUG ) ) { debug() << "Running Update " << time << endmsg; } + for ( auto const& entry : m_pairs ) { + auto const& id = std::get<0>( entry ); + auto const& p = std::get<1>( entry ); + + if ( !std::get<0>( p ) ) { + throw GaudiException{string{"No producer for "} + id, name(), StatusCode::FAILURE}; + } else if ( msgLevel( MSG::DEBUG ) && std::get<1>( p ).empty() ) { + debug() << "No consumers for " << id << endmsg; + } + } + for ( auto const& [id, pairs] : m_pairs ) { + if ( msgLevel( MSG::DEBUG ) ) { debug() << "Updating " << id << endmsg; } + if ( std::get<1>( pairs ).empty() ) continue; + + // Produce update + auto update = std::get<0>( pairs )(); + if ( update ) { + try { + for ( auto& consumer : std::get<1>( pairs ) ) { consumer->consume( *update ); } + } catch ( const GaudiException& e ) { + error() << id << " update failed: " << e.message() << std::endl; + throw e; + } + } + } +} diff --git a/Dumpers/src/AllenUpdater.h b/Dumpers/src/AllenUpdater.h new file mode 100644 index 00000000000..754b4b6d4fb --- /dev/null +++ b/Dumpers/src/AllenUpdater.h @@ -0,0 +1,66 @@ +/*****************************************************************************\ +* (c) Copyright 2019 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. * +\*****************************************************************************/ +#pragma once + +#include <GaudiKernel/Service.h> +#include <map> +#include <memory> +#include <string> + +#include "Dumpers/IUpdater.h" + +/** @class AllenUpdater AllenUpdater.h + * LHCb implementation of the Allen non-event data manager + * + * @author Roel Aaij + * @date 2019-05-24 + */ +class AllenUpdater final : public Service, public Allen::NonEventData::IUpdater { +public: + AllenUpdater( std::string name, ISvcLocator* loc ) : Service{name, loc} {} + + /** + * @brief Update all registered non-event data by calling all + * registered Producer and Consumer + * + * @param run number or event time + * + * @return void + */ + void update( unsigned long run ) override; + + /** + * @brief Register a consumer for that will consume binary non-event + * data; identified by string + * + * @param identifier string + * @param the consumer + * + * @return void + */ + void registerConsumer( std::string const& id, std::unique_ptr<Allen::NonEventData::Consumer> c ) override; + + /** + * @brief Register a producer that will produce binary non-event + * data; identified by string + * + * @param identifier string + * @param the producer + * + * @return void + */ + void registerProducer( std::string const& id, Allen::NonEventData::Producer p ) override; + +private: + std::map<std::string, + std::tuple<Allen::NonEventData::Producer, std::vector<std::unique_ptr<Allen::NonEventData::Consumer>>>> + m_pairs; +}; diff --git a/Dumpers/src/DumpBeamline.cpp b/Dumpers/src/DumpBeamline.cpp new file mode 100644 index 00000000000..c45c381f24d --- /dev/null +++ b/Dumpers/src/DumpBeamline.cpp @@ -0,0 +1,32 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <tuple> +#include <vector> + +#include "DumpBeamline.h" + +DECLARE_COMPONENT( DumpBeamline ) + +DumpUtils::Dumps DumpBeamline::dumpGeometry() const { + + auto& cond = detector(); + + DumpUtils::Writer output{}; + + const float xRC = cond.paramAsDouble( "ResolPosRC" ); + const float xLA = cond.paramAsDouble( "ResolPosLA" ); + const float y = cond.paramAsDouble( "ResolPosY" ); + + float x = ( xRC + xLA ) / 2.f; + output.write( x, y ); + + return {{std::tuple{output.buffer(), "beamline", Allen::NonEventData::Beamline::id}}}; +} diff --git a/Dumpers/src/DumpBeamline.h b/Dumpers/src/DumpBeamline.h new file mode 100644 index 00000000000..c53b030c01d --- /dev/null +++ b/Dumpers/src/DumpBeamline.h @@ -0,0 +1,33 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 DUMPBEAMLINE_H +#define DUMPBEAMLINE_H 1 + +// Include files +#include "DumpGeometry.h" +#include <DetDesc/Condition.h> + +/** @class DumpBeamline + * Dump magnetic field. Implements DumpGeometry. + * + * @author Roel Aaij + * @date 2019-04-27 + */ +class DumpBeamline final : public DumpGeometry<Condition> { +public: + DumpBeamline( std::string name, ISvcLocator* loc ) + : DumpGeometry<Condition>{std::move( name ), loc, "/dd/Conditions/Online/Velo/MotionSystem"} {} + +protected: + DumpUtils::Dumps dumpGeometry() const override; +}; + +#endif // DUMPBEAMLINE_H diff --git a/Dumpers/src/DumpFTGeometry.cpp b/Dumpers/src/DumpFTGeometry.cpp new file mode 100644 index 00000000000..ee01e3b088b --- /dev/null +++ b/Dumpers/src/DumpFTGeometry.cpp @@ -0,0 +1,130 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <fstream> +#include <iostream> +#include <tuple> +#include <vector> + +#include "DumpFTGeometry.h" + +namespace { + using std::ios; + using std::ofstream; + using std::string; + using std::tuple; + using std::vector; +} // namespace + +DECLARE_COMPONENT( DumpFTGeometry ) + +DumpUtils::Dumps DumpFTGeometry::dumpGeometry() const { + // Detector and mat geometry + const auto& det = detector(); + const auto& stations = det.stations(); + const auto& layersFirstStation = stations[0]->layers(); + const auto& quartersFirstLayer = layersFirstStation[0]->quarters(); + uint32_t number_of_stations = stations.size(); + uint32_t number_of_layers_per_station = layersFirstStation.size(); + uint32_t number_of_layers = number_of_stations * number_of_layers_per_station; + uint32_t number_of_quarters_per_layer = quartersFirstLayer.size(); + uint32_t number_of_quarters = number_of_quarters_per_layer * number_of_layers; + vector<uint32_t> number_of_modules( det.nQuarters ); + uint32_t number_of_mats = 0; + uint32_t number_of_mats_per_module; + + vector<float> mirrorPointX; + vector<float> mirrorPointY; + vector<float> mirrorPointZ; + vector<float> ddxX; + vector<float> ddxY; + vector<float> ddxZ; + vector<float> uBegin; + vector<float> halfChannelPitch; + vector<float> dieGap; + vector<float> sipmPitch; + vector<float> dxdy; + vector<float> dzdy; + vector<float> globaldy; + + // First uniqueMat is 512, save space by subtracting + const uint32_t uniqueMatOffset = 512; + // PrStoreFTHit.h uses hardcoded 2<<11, which is too much. + uint32_t max_uniqueMat = ( 2 << 10 ) - uniqueMatOffset; + mirrorPointX.resize( max_uniqueMat ); + mirrorPointY.resize( max_uniqueMat ); + mirrorPointZ.resize( max_uniqueMat ); + ddxX.resize( max_uniqueMat ); + ddxY.resize( max_uniqueMat ); + ddxZ.resize( max_uniqueMat ); + uBegin.resize( max_uniqueMat ); + halfChannelPitch.resize( max_uniqueMat ); + dieGap.resize( max_uniqueMat ); + sipmPitch.resize( max_uniqueMat ); + dxdy.resize( max_uniqueMat ); + dzdy.resize( max_uniqueMat ); + globaldy.resize( max_uniqueMat ); + + for ( uint quarter = 0; quarter < det.nQuarters; quarter++ ) { + const auto& modules = det.quarter( quarter )->modules(); + number_of_modules[quarter] = modules.size(); + + for ( const auto& module : modules ) { + const auto& mats = module->mats(); + number_of_mats += mats.size(); + number_of_mats_per_module = mats.size(); + for ( const auto& mat : mats ) { + auto index = mat->elementID().uniqueMat() - uniqueMatOffset; + const auto& mirrorPoint = mat->mirrorPoint(); + const auto& ddx = mat->ddx(); + mirrorPointX[index] = mirrorPoint.x(); + mirrorPointY[index] = mirrorPoint.y(); + mirrorPointZ[index] = mirrorPoint.z(); + ddxX[index] = ddx.x(); + ddxY[index] = ddx.y(); + ddxZ[index] = ddx.z(); + uBegin[index] = mat->uBegin(); + halfChannelPitch[index] = mat->halfChannelPitch(); + dieGap[index] = mat->dieGap(); + sipmPitch[index] = mat->sipmPitch(); + dxdy[index] = mat->dxdy(); + dzdy[index] = mat->dzdy(); + globaldy[index] = mat->globaldy(); + } + } + } + + // Raw bank layout (from FTReadoutTool) + vector<uint32_t> bank_first_channel; + string conditionLocation = "/dd/Conditions/ReadoutConf/FT/ReadoutMap"; + Condition* rInfo = getDet<Condition>( conditionLocation ); + + std::vector<int> stations_ = rInfo->param<std::vector<int>>( "FTBankStation" ); + std::vector<int> layers = rInfo->param<std::vector<int>>( "FTBankLayer" ); + std::vector<int> quarters = rInfo->param<std::vector<int>>( "FTBankQuarter" ); + std::vector<int> firstModules = rInfo->param<std::vector<int>>( "FTBankFirstModule" ); + std::vector<int> firstMats = rInfo->param<std::vector<int>>( "FTBankFirstMat" ); + + // Construct the first channel attribute + uint32_t number_of_tell40s = stations_.size(); + bank_first_channel.reserve( number_of_tell40s ); + for ( unsigned int i = 0; i < number_of_tell40s; i++ ) { + bank_first_channel.push_back( static_cast<uint32_t>( + LHCb::FTChannelID( stations_[i], layers[i], quarters[i], firstModules[i], firstMats[i], 0u, 0u ) ) ); + } + + DumpUtils::Writer output{}; + output.write( number_of_stations, number_of_layers_per_station, number_of_layers, number_of_quarters_per_layer, + number_of_quarters, number_of_modules, number_of_mats_per_module, number_of_mats, number_of_tell40s, + bank_first_channel, max_uniqueMat, mirrorPointX, mirrorPointY, mirrorPointZ, ddxX, ddxY, ddxZ, uBegin, + halfChannelPitch, dieGap, sipmPitch, dxdy, dzdy, globaldy ); + + return {{tuple{output.buffer(), "ft_geometry", Allen::NonEventData::SciFiGeometry::id}}}; +} diff --git a/Dumpers/src/DumpFTGeometry.h b/Dumpers/src/DumpFTGeometry.h new file mode 100644 index 00000000000..9c06c413fc8 --- /dev/null +++ b/Dumpers/src/DumpFTGeometry.h @@ -0,0 +1,33 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 DUMPFTGEOMETRY_H +#define DUMPFTGEOMETRY_H 1 + +// Include files +#include "DumpGeometry.h" +#include <FTDet/DeFTDetector.h> + +/** @class DumpFTGeometry + * Dump geometry of the SciFi tracker. Implements DumpGeometry. + * + * @author Lars Funke + * @date 2018-09-03 + */ +class DumpFTGeometry final : public DumpGeometry<DeFTDetector> { +public: + DumpFTGeometry( std::string name, ISvcLocator* loc ) + : DumpGeometry<DeFTDetector>{std::move( name ), loc, DeFTDetectorLocation::Default} {} + +protected: + DumpUtils::Dumps dumpGeometry() const override; +}; + +#endif // DUMPUTGEOMETRY_H diff --git a/Dumpers/src/DumpFTHits.cpp b/Dumpers/src/DumpFTHits.cpp new file mode 100644 index 00000000000..c2a6cb416a7 --- /dev/null +++ b/Dumpers/src/DumpFTHits.cpp @@ -0,0 +1,90 @@ +/*****************************************************************************\ +* (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 <vector> + +#include <boost/filesystem.hpp> + +#include "Event/RawEvent.h" +#include "Event/VPLightCluster.h" + +#include "DumpFTHits.h" +#include "Utils.h" + +namespace fs = boost::filesystem; + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT( DumpFTHits ) + +DumpFTHits::DumpFTHits( const std::string& name, ISvcLocator* pSvcLocator ) + : Consumer( name, pSvcLocator, + {KeyValue{"ODINLocation", LHCb::ODINLocation::Default}, + KeyValue{"FTHitsLocation", PrFTInfo::FTHitsLocation}} ) {} + +StatusCode DumpFTHits::initialize() { + if ( !DumpUtils::createDirectory( m_outputDirectory.value() ) ) { + error() << "Failed to create directory " << m_outputDirectory.value() << endmsg; + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +void DumpFTHits::operator()( const LHCb::ODIN& odin, const PrFTHitHandler<PrHit>& hitHandler ) const { + + /*Write SciFi variables for GPU to binary file */ + DumpUtils::FileWriter outfile{m_outputDirectory.value() + "/" + std::to_string( odin.runNumber() ) + "_" + + std::to_string( odin.eventNumber() ) + ".bin"}; + + // SciFi + constexpr int n_layers_scifi = 24; + auto scifi_x = std::array<std::vector<float>, n_layers_scifi>{}; + auto scifi_z = std::array<std::vector<float>, n_layers_scifi>{}; + auto scifi_w = std::array<std::vector<float>, n_layers_scifi>{}; + auto scifi_dxdy = std::array<std::vector<float>, n_layers_scifi>{}; + auto scifi_dzdy = std::array<std::vector<float>, n_layers_scifi>{}; + auto scifi_YMin = std::array<std::vector<float>, n_layers_scifi>{}; + auto scifi_YMax = std::array<std::vector<float>, n_layers_scifi>{}; + auto scifi_LHCbID = std::array<std::vector<unsigned int>, n_layers_scifi>{}; + auto scifi_hitPlaneCode = std::array<std::vector<int>, n_layers_scifi>{}; + auto scifi_hitZone = std::array<std::vector<int>, n_layers_scifi>{}; + + for ( unsigned int zone = 0; PrFTInfo::nbZones() > zone; ++zone ) { + for ( const auto& hit : hitHandler.hits( zone ) ) { + // get the LHCbID from the PrHit + LHCb::LHCbID lhcbid = hit.id(); + + // Fill the info for the eventual binary + int code = 2 * hit.planeCode() + hit.zone(); + scifi_x[code].push_back( hit.x() ); + scifi_z[code].push_back( hit.z() ); + scifi_w[code].push_back( hit.w() ); + scifi_dxdy[code].push_back( hit.dxDy() ); + scifi_dzdy[code].push_back( hit.dzDy() ); + scifi_YMin[code].push_back( hit.yMin() ); + scifi_YMax[code].push_back( hit.yMax() ); + scifi_LHCbID[code].push_back( lhcbid.lhcbID() ); + scifi_hitPlaneCode[code].push_back( hit.planeCode() ); + scifi_hitZone[code].push_back( hit.zone() ); + } + } + + // first the number of hits per layer in each half as header + for ( int index = 0; index < n_layers_scifi; ++index ) { + uint32_t n_hits = (int)( scifi_x[index].size() ); + outfile.write( n_hits ); + } + + // then the vectors containing the variables + for ( int index = 0; index < n_layers_scifi; ++index ) { + outfile.write( scifi_x[index], scifi_z[index], scifi_w[index], scifi_dxdy[index], scifi_dzdy[index], + scifi_YMin[index], scifi_YMax[index], scifi_LHCbID[index], scifi_hitPlaneCode[index], + scifi_hitZone[index] ); + } +} diff --git a/Dumpers/src/DumpFTHits.h b/Dumpers/src/DumpFTHits.h new file mode 100644 index 00000000000..26cfeaf476b --- /dev/null +++ b/Dumpers/src/DumpFTHits.h @@ -0,0 +1,42 @@ +/*****************************************************************************\ +* (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 DUMPFTHITS_H +#define DUMPFTHITS_H 1 + +#include <cstring> +#include <fstream> +#include <string> +#include <vector> + +// Include files +#include "Event/ODIN.h" +#include "GaudiAlg/Consumer.h" +#include "PrKernel/PrFTHitHandler.h" + +/** @class DumpFTHits DumpFTHits.h + * Algorithm that dumps FT hit variables to binary files. + * + * @author Roel Aaij + * @date 2018-08-27 + */ +class DumpFTHits : public Gaudi::Functional::Consumer<void( const LHCb::ODIN&, const PrFTHitHandler<PrHit>& )> { +public: + /// Standard constructor + DumpFTHits( const std::string& name, ISvcLocator* pSvcLocator ); + + StatusCode initialize() override; + + void operator()( const LHCb::ODIN& odin, const PrFTHitHandler<PrHit>& hitHandler ) const override; + +private: + Gaudi::Property<std::string> m_outputDirectory{this, "OutputDirectory", "scifi_hits"}; +}; +#endif // DUMPFTHITS_H diff --git a/Dumpers/src/DumpForwardTracks.cpp b/Dumpers/src/DumpForwardTracks.cpp new file mode 100644 index 00000000000..1f4c78f7e23 --- /dev/null +++ b/Dumpers/src/DumpForwardTracks.cpp @@ -0,0 +1,69 @@ +/*****************************************************************************\ +* (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 <vector> + +#include <boost/filesystem.hpp> + +//#include "Event/RawEvent.h" +//#include "Event/VPLightCluster.h" + +#include "DumpForwardTracks.h" +#include "Utils.h" + +namespace fs = boost::filesystem; + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT( DumpForwardTracks ) + +DumpForwardTracks::DumpForwardTracks( const std::string& name, ISvcLocator* pSvcLocator ) + : Consumer( name, pSvcLocator, + {KeyValue{"ODINLocation", LHCb::ODINLocation::Default}, + KeyValue{"ForwardTracksLocation", "Rec/Track/ForwardFast"}} ) {} + +StatusCode DumpForwardTracks::initialize() { + if ( !DumpUtils::createDirectory( m_outputDirectory.value() ) ) { + error() << "Failed to create directory " << m_outputDirectory.value() << endmsg; + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +void DumpForwardTracks::operator()( const LHCb::ODIN& odin, const std::vector<LHCb::Event::v2::Track>& tracks ) const { + + /*Write LHCbIDs of forward tracks to binary file */ + DumpUtils::FileWriter outfile{m_outputDirectory.value() + "/" + std::to_string( odin.runNumber() ) + "_" + + std::to_string( odin.eventNumber() ) + ".bin"}; + + // first the number of tracks + const uint32_t n_tracks = (int)( tracks.size() ); + outfile.write( n_tracks ); + + // then the tracks themselves + for ( const auto& track : tracks ) { + const float eta = track.pseudoRapidity(); + outfile.write( eta ); + const float p = track.p(); + outfile.write( p ); + const float pt = track.pt(); + outfile.write( pt ); + + // first the number of IDs on this track + const uint32_t n_IDs = track.nLHCbIDs(); + outfile.write( n_IDs ); + + // then the IDs + const auto ids = track.lhcbIDs(); + for ( const auto& id : ids ) { + // const unsigned int id_int = id; + outfile.write( id ); + } + } +} diff --git a/Dumpers/src/DumpForwardTracks.h b/Dumpers/src/DumpForwardTracks.h new file mode 100644 index 00000000000..086c8b7fed7 --- /dev/null +++ b/Dumpers/src/DumpForwardTracks.h @@ -0,0 +1,43 @@ +/*****************************************************************************\ +* (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 DUMPFORWARDTRACKS_H +#define DUMPFORWARDTRACKS_H 1 + +#include <cstring> +#include <fstream> +#include <string> +#include <vector> + +// Include files +#include "Event/ODIN.h" +#include "Event/Track_v2.h" +#include "GaudiAlg/Consumer.h" + +/** @class DumpForwardTracks DumpForwardTracks.h + * Algorithm that dumps Forward track LHCbIDs to binary files + * + * @author Dorothea vom Bruch + * @date 2019-03-22 + */ +class DumpForwardTracks + : public Gaudi::Functional::Consumer<void( const LHCb::ODIN&, const std::vector<LHCb::Event::v2::Track>& )> { +public: + /// Standard constructor + DumpForwardTracks( const std::string& name, ISvcLocator* pSvcLocator ); + + StatusCode initialize() override; + + void operator()( const LHCb::ODIN& odin, const std::vector<LHCb::Event::v2::Track>& tracks ) const override; + +private: + Gaudi::Property<std::string> m_outputDirectory{this, "OutputDirectory", "forward_tracks"}; +}; +#endif // DUMPFORWARDTRACS_H diff --git a/Dumpers/src/DumpGeometry.h b/Dumpers/src/DumpGeometry.h new file mode 100644 index 00000000000..0df22c22859 --- /dev/null +++ b/Dumpers/src/DumpGeometry.h @@ -0,0 +1,269 @@ +/*****************************************************************************\ +* (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 DUMPGEOMETRY_H +#define DUMPGEOMETRY_H 1 + +#include <cstring> +#include <fstream> +#include <regex> +#include <string> +#include <vector> + +#include <boost/filesystem.hpp> + +#include <DetDesc/DetectorElement.h> +#include <Gaudi/Parsers/Factory.h> +#include <GaudiAlg/GetData.h> +#include <GaudiKernel/GaudiException.h> +#include <GaudiKernel/IDataProviderSvc.h> +#include <GaudiKernel/IUpdateManagerSvc.h> +#include <GaudiKernel/Service.h> +#include <Kernel/ICondDBInfo.h> + +#include "Utils.h" +#include <Dumpers/IUpdater.h> +#include <Dumpers/Identifiers.h> + +/** @class DumpGeometry + * Base class for a Service that dumps a subdetector's geometry + * + * @author Roel Aaij + * @date 2018-08-27 + */ +template <typename DETECTOR> +class DumpGeometry : public Service { +public: + DumpGeometry( std::string name, ISvcLocator* loc, std::string detLoc ) + : Service( name, loc ), m_location{std::move( detLoc )} {} + + StatusCode initialize() override; + + StatusCode dump(); + + inline void Assert( const bool ok, const std::string& message = "", + const StatusCode sc = StatusCode( StatusCode::FAILURE, true ) ) const { + if ( !ok ) throw GaudiException( this->name() + ":: " + message, "", sc ); + } + +protected: + virtual StatusCode registerConditions( IUpdateManagerSvc* ) { return StatusCode::SUCCESS; } + + virtual DumpUtils::Dumps dumpGeometry() const = 0; + + std::string outputDirectory() const { return m_outputDirectory.value(); } + std::string geometrySuffix() const; + + const DETECTOR& detector() const { return *m_det; } + + SmartIF<IDataProviderSvc> detSvc() const { return m_detSvc; } + + template <typename DET, std::enable_if_t<std::is_base_of<DetectorElement, DET>::value>* = nullptr> + void get( std::string location, IUpdateManagerSvc* updMgrSvc ) { + m_det = getDet<DETECTOR>( location ); + // Register our callback to trigger the actual dumping + updMgrSvc->registerCondition( this, m_det->geometry(), &DumpGeometry<DETECTOR>::dump ); + } + + template <typename DET, + std::enable_if_t<std::is_base_of<Condition, DET>::value || std::is_same<Condition, DET>::value>* = nullptr> + void get( std::string location, IUpdateManagerSvc* updMgrSvc ) { + m_det = getDet<DETECTOR>( location ); + // Register our callback to trigger the actual dumping + updMgrSvc->registerCondition( this, location, &DumpGeometry<DETECTOR>::dump ); + } + + template <typename DET, std::enable_if_t<std::is_base_of<IService, DET>::value>* = nullptr> + void get( std::string location, IUpdateManagerSvc* updMgrSvc ) { + m_det = service<DETECTOR>( location, true ); + // Register our callback to trigger the actual dumping + updMgrSvc->registerCondition( this, m_det, &DumpGeometry<DETECTOR>::dump ); + } + + template <typename DET, std::enable_if_t<std::is_base_of<IAlgTool, DET>::value>* = nullptr> + void get( std::string location, IUpdateManagerSvc* updMgrSvc ) { + m_det = tool<DETECTOR>( location, true ); + // Register our callback to trigger the actual dumping + updMgrSvc->registerCondition( this, m_det, &DumpGeometry<DETECTOR>::dump ); + } + + template <class TOOL> + inline TOOL* tool( const std::string& type, bool create = true ) const { + return tool<TOOL>( type, type, create ); + } + + template <class TOOL> + inline TOOL* tool( const std::string& type, const std::string& name, bool create = true ) const { + // for empty names delegate to another method + if ( name.empty() ) return tool<TOOL>( type, create ); + Assert( m_toolSvc.isValid(), "tool():: IToolSvc* points to NULL!" ); + // get the tool from Tool Service + TOOL* t = nullptr; + const auto sc = m_toolSvc->retrieveTool( type, name, t, m_toolSvc, create ); + if ( sc.isFailure() ) { + throw GaudiException( this->name() + ":: " + "tool():: Could not retrieve Tool '" + type + "'/'" + name + "'", "", + sc ); + } + if ( !t ) { + throw GaudiException( this->name() + ":: " + "tool():: Could not retrieve Tool '" + type + "'/'" + name + "'", "", + sc ); + } + return t; + } + + template <class T> + typename Gaudi::Utils::GetData<T>::return_type getDet( std::string location ) const { + Gaudi::Utils::GetData<T> getter{}; + auto info = getter( *this, m_detSvc, location ); + if ( !info ) { + error() << "Could not obtain detector data from " << location << endmsg; + return nullptr; + } else { + return info; + } + } + +private: + Gaudi::Property<std::string> m_outputDirectory{this, "OutputDirectory", "geometry"}; + Gaudi::Property<std::pair<std::string, std::string>> m_tagRegex{ + this, "TagRegex", make_pair( std::string{".*/(\\w+)\\.git"}, std::string{".*/([a-zA-Z0-9\\-]+)\\[(.*)\\]"} )}; + std::string m_location; + std::unordered_map<std::string, std::vector<char>> m_buffer; + + std::map<std::string, std::string> m_tags; + Gaudi::Property<bool> m_dumpToFile{this, "DumpToFile", true}; + Gaudi::Property<std::string> m_updaterName{this, "UpdaterName", "AllenUpdater"}; + + SmartIF<IDataProviderSvc> m_detSvc; + SmartIF<ICondDBInfo> m_condDBInfo; + SmartIF<IToolSvc> m_toolSvc; + + DETECTOR* m_det; +}; + +template <typename DETECTOR> +StatusCode DumpGeometry<DETECTOR>::initialize() { + if ( !DumpUtils::createDirectory( m_outputDirectory.value() ) ) { + error() << "Failed to create directory " << m_outputDirectory.value() << endmsg; + return StatusCode::FAILURE; + } + + // Facilitate derived services getting tools + m_toolSvc = service( "ToolSvc", true ); + + // Get the DB tags in use + m_condDBInfo = service( "XmlParserSvc", true ); + std::vector<LHCb::CondDBNameTagPair> tags; + m_condDBInfo->defaultTags( tags ); + std::regex partRegex( m_tagRegex.value().first ); + std::regex tagRegex( m_tagRegex.value().second ); + for ( auto&& entry : tags ) { + std::string partition = entry.first, tag = entry.second, commit; + std::smatch result; + auto r = std::regex_match( partition, result, partRegex ); + if ( r ) { partition = result[1].str(); } + r = std::regex_match( tag, result, tagRegex ); + if ( r && result[1].str() != "master" ) { + tag = result[1].str(); + } else if ( r ) { + // If the master tag is used, store the commit ID to pin it down. + tag = result[1].str() + "[" + result[2].str() + "]"; + } + auto e = m_tags.emplace( std::move( partition ), std::move( tag ) ); + if ( msgLevel( MSG::DEBUG ) ) { debug() << "tag: " << e.first->first << " " << e.first->second << endmsg; } + } + + // Get the requested detector + m_detSvc = service( "DetectorDataSvc", true ); + if ( !m_detSvc.isValid() ) { + error() << "Unable to obtain detector data service." << endmsg; + return StatusCode::FAILURE; + } + + auto updMgrSvc = service( "UpdateManagerSvc", true ).as<IUpdateManagerSvc>(); + + get<DETECTOR>( m_location, updMgrSvc ); + + auto sc = registerConditions( updMgrSvc ); + if ( !sc.isSuccess() ) { return sc; } + + // m_buffer will be filled and identifiers known + updMgrSvc->update( this ); + + if ( !m_dumpToFile.value() ) { + auto svc = service( m_updaterName, true ); + if ( !svc ) { + error() << "Failed get updater " << m_updaterName.value() << endmsg; + return StatusCode::FAILURE; + } + auto* updater = dynamic_cast<Allen::NonEventData::IUpdater*>( svc.get() ); + if ( !updater ) { + error() << "Failed cast updater " << m_updaterName.value() << " to Allen::NonEventData::IUpdater " << endmsg; + return StatusCode::FAILURE; + } + for ( auto const& entry : m_buffer ) { + auto const& id = std::get<0>( entry ); + updater->registerProducer( id, [this, id]() -> std::optional<std::vector<char>> { + auto it = m_buffer.find( id ); + if ( it == m_buffer.end() ) { + throw GaudiException{"Data for " + id + " not produced.", name(), StatusCode::FAILURE}; + } else { + return it->second; + } + } ); + } + } + + return sc; +} + +template <typename DETECTOR> +StatusCode DumpGeometry<DETECTOR>::dump() { + m_buffer.clear(); + try { + auto result = dumpGeometry(); + for ( auto const& [data, filename, id] : result ) { + if ( msgLevel( MSG::DEBUG ) ) { + debug() << std::setw( 20 ) << id << ": " << std::setw( 7 ) << data.size() << " bytes." << endmsg; + } + if ( m_dumpToFile.value() ) { + auto name = outputDirectory() + "/" + filename + "_" + geometrySuffix() + ".bin"; + std::ofstream output{name, std::ios::out | std::ios::binary}; + output.write( data.data(), data.size() ); + } else { + auto r = m_buffer.emplace( id, data ); + if ( !r.second ) { + error() << "Failed to insert data for " << id << " in buffer." << endmsg; + return StatusCode::FAILURE; + } + } + } + return StatusCode::SUCCESS; + } catch ( const GaudiException& e ) { + error() << e.message() << endmsg; + return e.code(); + } +} + +template <typename DETECTOR> +std::string DumpGeometry<DETECTOR>::geometrySuffix() const { + auto sit = m_tags.find( "SIMCOND" ); + auto dit = m_tags.find( "DDDB" ); + auto cit = m_tags.find( "LHCBCOND" ); + if ( dit == end( m_tags ) ) { + return "UNKOWN"; + } else if ( sit != end( m_tags ) ) { + return dit->second + "_" + sit->second; + } else { + return dit->second + "_" + cit->second; + } +} + +#endif // DUMPGEOMETRY_H diff --git a/Dumpers/src/DumpMagneticField.cpp b/Dumpers/src/DumpMagneticField.cpp new file mode 100644 index 00000000000..dea553e7b01 --- /dev/null +++ b/Dumpers/src/DumpMagneticField.cpp @@ -0,0 +1,27 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <tuple> +#include <vector> + +#include "DumpMagneticField.h" + +DECLARE_COMPONENT( DumpMagneticField ) + +DumpUtils::Dumps DumpMagneticField::dumpGeometry() const { + + auto& magnetSvc = detector(); + + DumpUtils::Writer output{}; + float polarity = magnetSvc.isDown() ? -1.f : 1.f; + output.write( polarity ); + + return {{std::tuple{output.buffer(), "polarity", Allen::NonEventData::MagneticField::id}}}; +} diff --git a/Dumpers/src/DumpMagneticField.h b/Dumpers/src/DumpMagneticField.h new file mode 100644 index 00000000000..e280bfc5c24 --- /dev/null +++ b/Dumpers/src/DumpMagneticField.h @@ -0,0 +1,33 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 DUMPMAGNETICFIELD_H +#define DUMPMAGNETICFIELD_H 1 + +// Include files +#include "DumpGeometry.h" +#include <Kernel/ILHCbMagnetSvc.h> + +/** @class DumpMagneticField + * Dump magnetic field. Implements DumpGeometry. + * + * @author Roel Aaij + * @date 2019-04-27 + */ +class DumpMagneticField final : public DumpGeometry<ILHCbMagnetSvc> { +public: + DumpMagneticField( std::string name, ISvcLocator* loc ) + : DumpGeometry<ILHCbMagnetSvc>{std::move( name ), loc, "MagneticFieldSvc"} {} + +protected: + DumpUtils::Dumps dumpGeometry() const override; +}; + +#endif // DUMPMAGNETICFIELD_H diff --git a/Dumpers/src/DumpMuonCommonHits.cpp b/Dumpers/src/DumpMuonCommonHits.cpp new file mode 100644 index 00000000000..f5a61d1937b --- /dev/null +++ b/Dumpers/src/DumpMuonCommonHits.cpp @@ -0,0 +1,96 @@ +/*****************************************************************************\ +* (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 <vector> + +#include <boost/filesystem.hpp> + +#include "DumpMuonCommonHits.h" +#include "Utils.h" + +namespace { + using std::string; + using std::to_string; + using std::vector; + + namespace fs = boost::filesystem; +} // namespace + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT( DumpMuonCommonHits ) + +DumpMuonCommonHits::DumpMuonCommonHits( const string& name, ISvcLocator* pSvcLocator ) + : Consumer( name, pSvcLocator, + {KeyValue{"ODINLocation", LHCb::ODINLocation::Default}, + KeyValue{"MuonHitHandler", MuonHitHandlerLocation::Default}} ) {} + +StatusCode DumpMuonCommonHits::initialize() { + if ( !DumpUtils::createDirectory( m_outputDirectory.value() ) ) { + error() << "Failed to create directory " << m_outputDirectory.value() << endmsg; + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +void DumpMuonCommonHits::operator()( const LHCb::ODIN& odin, const MuonHitHandler& hitHandler ) const { + + /*Write muon common hit variables for GPU to binary file */ + DumpUtils::FileWriter outfile{m_outputDirectory.value() + "/" + to_string( odin.runNumber() ) + "_" + + to_string( odin.eventNumber() ) + ".bin"}; + + const int n_stations = 4; + + auto tileID = std::array<vector<int>, n_stations>{}; + auto x = std::array<vector<float>, n_stations>{}; + auto dx = std::array<vector<float>, n_stations>{}; + auto y = std::array<vector<float>, n_stations>{}; + auto dy = std::array<vector<float>, n_stations>{}; + auto z = std::array<vector<float>, n_stations>{}; + auto dz = std::array<vector<float>, n_stations>{}; + auto uncrossed = std::array<vector<int>, n_stations>{}; + auto time = std::array<vector<unsigned int>, n_stations>{}; + auto deltaTime = std::array<vector<int>, n_stations>{}; + auto clusterSize = std::array<vector<int>, n_stations>{}; + auto region = std::array<vector<int>, n_stations>{}; + + // loop over the hits in every station + for ( int i_station = 0; i_station < n_stations; ++i_station ) { + const CommonMuonStation& station = hitHandler.station( i_station ); + for ( uint i_region = 0; i_region < station.nRegions(); ++i_region ) { + for ( const auto& hit : station.hits( i_region ) ) { + tileID[i_station].push_back( int( hit.tile() ) ); + x[i_station].push_back( hit.x() ); + dx[i_station].push_back( hit.dx() ); + y[i_station].push_back( hit.y() ); + dy[i_station].push_back( hit.dy() ); + z[i_station].push_back( hit.z() ); + dz[i_station].push_back( hit.dz() ); + uncrossed[i_station].push_back( (int)( hit.uncrossed() ) ); + time[i_station].push_back( hit.time() ); + deltaTime[i_station].push_back( hit.deltaTime() ); + clusterSize[i_station].push_back( hit.clusterSize() ); + region[i_station].push_back( (int)( hit.tile().region() ) ); + } + } + } + + // first the number of hits in every station + for ( int i_station = 0; i_station < n_stations; ++i_station ) { + uint32_t n_hits = (int)( tileID[i_station].size() ); + outfile.write( n_hits ); + } + + // then the vectors containing the variables + for ( int i_station = 0; i_station < n_stations; ++i_station ) { + outfile.write( tileID[i_station], x[i_station], dx[i_station], y[i_station], dy[i_station], z[i_station], + dz[i_station], uncrossed[i_station], time[i_station], deltaTime[i_station], clusterSize[i_station], + region[i_station] ); + } +} diff --git a/Dumpers/src/DumpMuonCommonHits.h b/Dumpers/src/DumpMuonCommonHits.h new file mode 100644 index 00000000000..fa655a893f6 --- /dev/null +++ b/Dumpers/src/DumpMuonCommonHits.h @@ -0,0 +1,45 @@ +/*****************************************************************************\ +* (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 DUMPMUONCOMMONHITS_H +#define DUMPMUONCOMMONHITS_H 1 + +#include <cstring> +#include <string> +#include <vector> + +// Include files +#include "Event/ODIN.h" +#include "GaudiAlg/Consumer.h" +#include "MuonDet/DeMuonDetector.h" +#include "MuonID/CommonMuonHit.h" +#include "MuonID/CommonMuonStation.h" +#include "MuonID/MuonHitHandler.h" + +/** @class DumpMuonCommonHits DumpMuonCommonHits.h + * Algorithm that dumps muon common hit variables to binary files. + * + * @author Dorothea vom Bruch + * @date 2018-09-06 + */ +class DumpMuonCommonHits : public Gaudi::Functional::Consumer<void( const LHCb::ODIN&, const MuonHitHandler& )> { +public: + /// Standard constructor + DumpMuonCommonHits( const std::string& name, ISvcLocator* pSvcLocator ); + + StatusCode initialize() override; + + void operator()( const LHCb::ODIN& odin, const MuonHitHandler& hitHandler ) const override; + +private: + Gaudi::Property<std::string> m_outputDirectory{this, "OutputDirectory", "muon_common_hits"}; +}; +#endif // DUMPMUONCOMMONHITS_H diff --git a/Dumpers/src/DumpMuonCoords.cpp b/Dumpers/src/DumpMuonCoords.cpp new file mode 100644 index 00000000000..d4b8d349f20 --- /dev/null +++ b/Dumpers/src/DumpMuonCoords.cpp @@ -0,0 +1,77 @@ +/*****************************************************************************\ +* (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 <vector> + +#include <boost/filesystem.hpp> + +#include "DumpMuonCoords.h" +#include "Utils.h" + +namespace { + using std::string; + using std::to_string; + using std::vector; + + namespace fs = boost::filesystem; +} // namespace + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT( DumpMuonCoords ) + +DumpMuonCoords::DumpMuonCoords( const string& name, ISvcLocator* pSvcLocator ) + : Consumer( name, pSvcLocator, + {KeyValue{"ODINLocation", LHCb::ODINLocation::Default}, + KeyValue{"MuonCoordsLocation", LHCb::MuonCoordLocation::MuonCoords}} ) {} + +StatusCode DumpMuonCoords::initialize() { + if ( !DumpUtils::createDirectory( m_outputDirectory.value() ) ) { + error() << "Failed to create directory " << m_outputDirectory.value() << endmsg; + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +void DumpMuonCoords::operator()( const LHCb::ODIN& odin, const LHCb::MuonCoords& muonCoords ) const { + + /*Write muon coord variables for GPU to binary file */ + DumpUtils::FileWriter outfile{m_outputDirectory.value() + "/" + to_string( odin.runNumber() ) + "_" + + to_string( odin.eventNumber() ) + ".bin"}; + constexpr int n_stations_muon = 4; + + auto uncrossed = std::array<std::vector<int>, n_stations_muon>{}; + // if uncrossed is true: digitTile contains one MuonTileID + // else if crossed pads were found: digitTile contains two MuonTileIDs + auto digitTile = std::array<std::vector<int>, n_stations_muon>{}; + auto digitTDC1 = std::array<std::vector<unsigned int>, n_stations_muon>{}; + auto digitTDC2 = std::array<std::vector<unsigned int>, n_stations_muon>{}; + + std::vector<std::vector<const LHCb::MuonCoord*>> sortedCoords( n_stations_muon ); + for ( auto coord : muonCoords ) { sortedCoords[coord->key().station()].emplace_back( coord ); } + + for ( int station = 0; station < n_stations_muon; station++ ) { + for ( const auto& coord : sortedCoords[station] ) { + uncrossed[station].push_back( (int)( coord->uncrossed() ) ); + for ( LHCb::MuonTileID tileID : coord->digitTile() ) { digitTile[station].push_back( int( tileID ) ); } + digitTDC1[station].push_back( coord->digitTDC1() ); + digitTDC2[station].push_back( coord->digitTDC2() ); + } + } + // first the number of hits per station + for ( int station = 0; station < n_stations_muon; ++station ) { + uint32_t n_hits = (int)( uncrossed[station].size() ); + outfile.write( n_hits ); + } + + // then the vectors containing the variables + for ( int station = 0; station < n_stations_muon; ++station ) { + outfile.write( uncrossed[station], digitTile[station], digitTDC1[station], digitTDC2[station] ); + } +} diff --git a/Dumpers/src/DumpMuonCoords.h b/Dumpers/src/DumpMuonCoords.h new file mode 100644 index 00000000000..ff37d604187 --- /dev/null +++ b/Dumpers/src/DumpMuonCoords.h @@ -0,0 +1,43 @@ +/*****************************************************************************\ +* (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 DUMPMUONCOORDS_H +#define DUMPMUONCOORDS_H 1 + +#include <cstring> +#include <fstream> +#include <string> +#include <vector> + +// Include files +#include "Event/MuonCoord.h" +#include "Event/ODIN.h" +#include "GaudiAlg/Consumer.h" + +/** @class DumpMuonCoords DumpMuonCoords.h + * Algorithm that dumps muon coord variables to binary files. + * + * @author Dorothea vom Bruch + * @date 2018-09-06 + */ +class DumpMuonCoords : public Gaudi::Functional::Consumer<void( const LHCb::ODIN&, const LHCb::MuonCoords& )> { +public: + /// Standard constructor + DumpMuonCoords( const std::string& name, ISvcLocator* pSvcLocator ); + + StatusCode initialize() override; + + void operator()( const LHCb::ODIN& odin, const LHCb::MuonCoords& ) const override; + +private: + Gaudi::Property<std::string> m_outputDirectory{this, "OutputDirectory", "muon_coords"}; +}; +#endif // DUMPMUONCOORDS_H diff --git a/Dumpers/src/DumpMuonGeometry.cpp b/Dumpers/src/DumpMuonGeometry.cpp new file mode 100644 index 00000000000..fc979919940 --- /dev/null +++ b/Dumpers/src/DumpMuonGeometry.cpp @@ -0,0 +1,74 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <array> +#include <fstream> +#include <iostream> +#include <tuple> +#include <vector> + +#include "DumpMuonGeometry.h" +#include "Utils.h" + +DECLARE_COMPONENT( DumpMuonGeometry ) + +StatusCode DumpMuonGeometry::registerConditions( IUpdateManagerSvc* updMgrSvc ) { + + const auto& det = detector(); + m_daqHelper.initSvc( detSvc(), msgSvc() ); + + for ( auto station = det.childBegin(); station != det.childEnd(); ++station ) { + if ( ( *station )->name().find( "/MF" ) != std::string::npos ) continue; // skip muon filters + std::string name = ( *station )->name(); + auto path = DeMuonLocation::Cabling + "/" + std::string{name.end() - 2, name.end()} + "/Cabling"; + info() << "Registering " << path << endmsg; + updMgrSvc->registerCondition( &m_daqHelper, path, &MuonDAQHelper::updateLUT ); + } + updMgrSvc->update( &m_daqHelper ); + + return StatusCode::SUCCESS; +} + +DumpUtils::Dumps DumpMuonGeometry::dumpGeometry() const { + + // Detector and mat geometry + const auto& det = detector(); + const int nStations = det.stations(); + assert( nStations == 4 ); + + std::array<float, 4> innerX{}, innerY{}, outerX{}, outerY{}, stationZ{}; + + DumpUtils::Writer output{}; + for ( int s = 0; s != nStations; ++s ) { + innerX[s] = det.getInnerX( s ); + innerY[s] = det.getInnerY( s ); + outerX[s] = det.getOuterX( s ); + outerY[s] = det.getOuterY( s ); + stationZ[s] = det.getStationZ( s ); + } + + output.write( innerX.size(), innerX, innerY.size(), innerY, outerX.size(), outerX, outerY.size(), outerY, + stationZ.size(), stationZ ); + + std::vector<unsigned int> nTiles( m_daqHelper.TotTellNumber(), 0 ); + for ( auto tell1 = 0u; tell1 < m_daqHelper.TotTellNumber(); ++tell1 ) { + nTiles[tell1] = m_daqHelper.getADDInTell1( tell1 ).size(); + } + + output.write( nTiles.size() ); + info() << "Number of tiles in tell1 table: " << std::accumulate( nTiles.begin(), nTiles.end(), 0u ) << endmsg; + for ( auto tell1 = 0u; tell1 < m_daqHelper.TotTellNumber(); ++tell1 ) { + auto const& tiles = m_daqHelper.getADDInTell1( tell1 ); + output.write( tiles.size() ); + for ( auto const& tile : tiles ) { output.write( unsigned{tile} ); } + } + + return {{std::tuple{output.buffer(), "muon_geometry", Allen::NonEventData::MuonGeometry::id}}}; +} diff --git a/Dumpers/src/DumpMuonGeometry.h b/Dumpers/src/DumpMuonGeometry.h new file mode 100644 index 00000000000..b7ab0f270e8 --- /dev/null +++ b/Dumpers/src/DumpMuonGeometry.h @@ -0,0 +1,34 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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. * +\*****************************************************************************/ +#pragma once + +// Include files +#include "DumpGeometry.h" +#include <MuonDet/DeMuonDetector.h> + +/** @class DumpMuonGeometry + * Dump muon geometry information + * + * @author Roel Aaij + * @date 2019-02-21 + */ +class DumpMuonGeometry final : public DumpGeometry<DeMuonDetector> { +public: + DumpMuonGeometry( std::string name, ISvcLocator* loc ) + : DumpGeometry<DeMuonDetector>{std::move( name ), loc, DeMuonLocation::Default} {} + +protected: + StatusCode registerConditions( IUpdateManagerSvc* updMgrSvc ) override; + DumpUtils::Dumps dumpGeometry() const override; + +private: + mutable MuonDAQHelper m_daqHelper; +}; diff --git a/Dumpers/src/DumpMuonTable.cpp b/Dumpers/src/DumpMuonTable.cpp new file mode 100644 index 00000000000..72cf5f51d09 --- /dev/null +++ b/Dumpers/src/DumpMuonTable.cpp @@ -0,0 +1,158 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <array> +#include <fstream> +#include <iostream> +#include <sstream> +#include <vector> + +#include <range/v3/algorithm/any_of.hpp> +#include <range/v3/algorithm/fill.hpp> +#include <range/v3/core.hpp> +#include <range/v3/numeric/accumulate.hpp> +#include <range/v3/view/cartesian_product.hpp> +#include <range/v3/view/concat.hpp> +#include <range/v3/view/iota.hpp> +#include <range/v3/view/take.hpp> + +#include <boost/format.hpp> +#include <boost/numeric/conversion/cast.hpp> + +#include "DumpMuonTable.h" +#include "Utils.h" + +namespace { + using boost::numeric_cast; + using std::array; + using std::ios; + using std::ofstream; + using std::string; + using std::tuple; + using std::vector; + using namespace ranges; + + constexpr array<int, 16> padGridX{48, 48, 48, 48, 48, 48, 48, 48, 12, 12, 12, 12, 12, 12, 12, 12}; + constexpr array<int, 16> padGridY{8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; + constexpr array<int, 16> stripXGridX{48, 48, 48, 48, 48, 48, 48, 48, 12, 12, 12, 12, 12, 12, 12, 12}; + constexpr array<int, 16> stripXGridY{1, 2, 2, 2, 1, 2, 2, 2, 8, 2, 2, 2, 8, 2, 2, 2}; + constexpr array<int, 16> stripYGridX{8, 4, 2, 2, 8, 4, 2, 2, 12, 4, 2, 2, 12, 4, 2, 2}; + constexpr array<int, 16> stripYGridY{8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; + +} // namespace + +DECLARE_COMPONENT( DumpMuonTable ) + +DumpUtils::Dumps DumpMuonTable::dumpGeometry() const { + + // Detector and mat geometry + const auto& det = detector(); + const int nStations = det.stations(); + assert( nStations == 4 ); + const int nRegions = det.regions() / nStations; + assert( nRegions == 4 ); + + vector<float> padSizeX{}, stripXSizeX{}, stripYSizeX{}, padSizeY{}, stripXSizeY{}, stripYSizeY{}; + array<unsigned int, 16> padOffset{}, stripXOffset{}, stripYOffset{}, padSizeOffset{}, stripXSizeOffset{}, + stripYSizeOffset{}; + array<vector<array<float, 3>>, 4> padTable{}, stripXTable{}, stripYTable{}; + + auto nChannels = []( size_t s, const auto& gridX, const auto& gridY ) { + return [s, &gridX, &gridY]( auto tot, const auto r ) { return tot + gridX[4 * s + r] * gridY[4 * s + r]; }; + }; + + for ( int s = 0; s < nStations; ++s ) { + padTable[s].resize( 48 * ( padGridX[s] * padGridY[s] ) ); + stripXTable[s].resize( 12 * accumulate( view::ints( 0, 4 ), 0, nChannels( s, stripXGridX, stripXGridY ) ) ); + stripYTable[s].resize( 12 * accumulate( view::ints( 0, 4 ), 0, nChannels( s, stripYGridX, stripYGridY ) ) ); + } + + for ( auto& [sizeX, sizeY, offset, gridY] : + {make_tuple( std::ref( padSizeX ), std::ref( padSizeY ), std::ref( padSizeOffset ), std::ref( padGridY ) ), + make_tuple( std::ref( stripXSizeX ), std::ref( stripXSizeY ), std::ref( stripXSizeOffset ), + std::ref( stripXGridY ) ), + make_tuple( std::ref( stripYSizeX ), std::ref( stripYSizeY ), std::ref( stripYSizeOffset ), + std::ref( stripYGridY ) )} ) { + sizeX.resize( 24 * accumulate( gridY, 0 ) ); + sizeY.resize( 24 * accumulate( gridY, 0 ) ); + for ( size_t i = 0; i < gridY.size() - 1; ++i ) { offset[i + 1] = offset[i] + 24 * gridY[i]; } + } + + StatusCode sc = StatusCode::SUCCESS; + + double xp = 0.f, dx = 0.f, yp = 0.f, dy = 0.f, zp = 0.f, dz = 0.f; + + string padType{"pad"}, stripXType{"stripX"}, stripYType{"stripY"}; + // Pads + auto pad = std::tie( padType, padGridX, padGridY, padSizeX, padSizeY, padOffset, padSizeOffset, padTable ); + // X strips + auto stripX = std::tie( stripXType, stripXGridX, stripXGridY, stripXSizeX, stripXSizeY, stripXOffset, + stripXSizeOffset, stripXTable ); + // Y strips + auto stripY = std::tie( stripYType, stripYGridX, stripYGridY, stripYSizeX, stripYSizeY, stripYOffset, + stripYSizeOffset, stripYTable ); + + boost::format info_output{"%|s| %|8d| %|d| %|d| %|d| " + "%|2d| %|2d| %|2d| %|2d| %|2d| " + "%|5d| %|9.3f| %|9.3f| %|9.3f| %|7.3f| %|7.3f| %|5d|"}; + + DumpUtils::Writer output{}; + for ( auto& [t, gridX, gridY, sizeX, sizeY, offset, sizeOffset, table] : {pad, stripX, stripY} ) { + for ( auto station : view::ints( 0, nStations ) ) { + size_t index = 0; + for ( auto region : view::ints( 0, nRegions ) ) { + size_t gidx = station * 4 + region; + offset[gidx] = index; + + auto yxRange = view::concat( + view::cartesian_product( view::ints( 0, gridY[gidx] ), view::ints( gridX[gidx], 2 * gridX[gidx] ) ), + view::cartesian_product( view::ints( gridY[gidx], 2 * gridY[gidx] ), view::ints( 0, 2 * gridX[gidx] ) ) ); + // loop over quarters + for ( auto [quarter, yx] : view::cartesian_product( view::ints( 0, 4 ), yxRange ) ) { + auto [y, x] = yx; + LHCb::MuonTileID tile{ + station, MuonLayout{static_cast<unsigned int>( gridX[gidx] ), static_cast<unsigned int>( gridY[gidx] )}, + region, quarter, + x, y}; + auto sc = det.Tile2XYZ( tile, xp, dx, yp, dy, zp, dz ); + if ( sc.isFailure() ) { + std::stringstream e; + e << t << " " << station << " " << region << " " << quarter << " " << gridX[gidx] << " " << gridY[gidx] + << " " << x << " " << y << "\n"; + throw GaudiException{e.str(), name(), sc}; + } else { + auto sizeIdx = MuonUtils::size_index( sizeOffset, gridX, gridY, tile ); + if ( UNLIKELY( msgLevel( MSG::VERBOSE ) ) ) { + verbose() << ( info_output % t % unsigned{tile} % station % region % quarter % gidx % gridX[gidx] % + gridY[gidx] % x % y % index % xp % yp % zp % dx % dy % sizeIdx ) + << endmsg; + } + + // positions are always indexed by station + table[station][index++] = {numeric_cast<float>( xp ), numeric_cast<float>( yp ), numeric_cast<float>( zp )}; + + // sizes are specially indexed + if ( dx > sizeX[sizeIdx] ) sizeX[sizeIdx] = dx; + if ( dy > sizeY[sizeIdx] ) sizeY[sizeIdx] = dy; + } + } + } + } + + output.write( gridX.size(), gridX, gridY.size(), gridY, sizeX.size(), sizeX, sizeY.size(), sizeY, offset.size(), + offset, table.size() ); + for ( const auto& station : table ) { + output.write( station.size() ); + for ( const auto& point : station ) { output.write( point ); } + } + } + + return {{std::tuple{output.buffer(), "muon_table", Allen::NonEventData::MuonLookupTables::id}}}; +} diff --git a/Dumpers/src/DumpMuonTable.h b/Dumpers/src/DumpMuonTable.h new file mode 100644 index 00000000000..11df26b6bb7 --- /dev/null +++ b/Dumpers/src/DumpMuonTable.h @@ -0,0 +1,30 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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. * +\*****************************************************************************/ +#pragma once + +// Include files +#include "DumpGeometry.h" +#include <MuonDet/DeMuonDetector.h> + +/** @class DumpMuonTable + * Dump muon position lookup table + * + * @author Roel Aaij + * @date 2019-02-21 + */ +class DumpMuonTable final : public DumpGeometry<DeMuonDetector> { +public: + DumpMuonTable( std::string name, ISvcLocator* loc ) + : DumpGeometry<DeMuonDetector>{std::move( name ), loc, "/dd/Structure/LHCb/DownstreamRegion/Muon"} {} + +protected: + DumpUtils::Dumps dumpGeometry() const override; +}; diff --git a/Dumpers/src/DumpRawBanks.cpp b/Dumpers/src/DumpRawBanks.cpp new file mode 100644 index 00000000000..06f2ca13efc --- /dev/null +++ b/Dumpers/src/DumpRawBanks.cpp @@ -0,0 +1,152 @@ +/*****************************************************************************\ +* (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 <vector> + +#include <boost/filesystem.hpp> + +#include <GaudiKernel/ParsersFactory.h> + +#include <Event/RawBank.h> +#include <Event/RawEvent.h> +#include <Event/VPLightCluster.h> + +#include "DumpRawBanks.h" +#include "Utils.h" + +namespace { + using std::to_string; + + namespace fs = boost::filesystem; +} // namespace + +// Parsers are in namespace LHCb for ADL to work. +namespace LHCb { + + StatusCode parse( std::set<RawBank::BankType>& s, const std::string& in ) { + std::set<std::string> 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<std::string, RawBank::BankType> types; + if ( types.empty() ) { + for ( int t = 0; t < RawBank::LastType; ++t ) { + auto bt = static_cast<RawBank::BankType>( 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 ) + : Consumer( name, pSvcLocator, + {KeyValue{"RawEventLocation", LHCb::RawEventLocation::Default}, + KeyValue{"ODINLocation", LHCb::ODINLocation::Default}} ) {} + +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; +} + +void DumpRawBanks::operator()( const LHCb::RawEvent& rawEvent, const LHCb::ODIN& odin ) const { + + for ( const auto bankType : m_bankTypes ) { + DumpUtils::FileWriter outfile{outputDirectory( bankType ) + "/" + to_string( odin.runNumber() ) + "_" + + to_string( odin.eventNumber() ) + ".bin"}; + + auto tBanks = rawEvent.banks( bankType ); + uint32_t number_of_rawbanks = tBanks.size(); + uint32_t offset = 0; + std::vector<uint32_t> raw_bank_data; + std::vector<uint32_t> raw_bank_offsets; + + raw_bank_offsets.push_back( 0 ); + + for ( auto& bank : tBanks ) { + const uint32_t sourceID = static_cast<uint32_t>( bank->sourceID() ); + raw_bank_data.push_back( sourceID ); + + offset++; + + auto bStart = bank->begin<uint32_t>(); + auto bEnd = bank->end<uint32_t>(); + + // 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 ); + raw_bank_data.push_back( raw_data ); + + bStart++; + offset++; + } + raw_bank_offsets.push_back( offset * sizeof( uint32_t ) ); + } + // Dumping number_of_rawbanks + 1 offsets! + outfile.write( number_of_rawbanks, raw_bank_offsets, raw_bank_data ); + } +} + +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(); +} diff --git a/Dumpers/src/DumpRawBanks.h b/Dumpers/src/DumpRawBanks.h new file mode 100644 index 00000000000..e16098122b9 --- /dev/null +++ b/Dumpers/src/DumpRawBanks.h @@ -0,0 +1,78 @@ +/*****************************************************************************\ +* (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 <cstring> +#include <fstream> +#include <string> +#include <unordered_map> +#include <vector> + +// Include files +#include <AIDA/IHistogram1D.h> +#include <Event/ODIN.h> +#include <Event/RawBank.h> +#include <Event/RawEvent.h> +#include <GaudiAlg/Consumer.h> +#include <GaudiAlg/GaudiHistoAlg.h> + +// 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<RawBank::BankType>& 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::Consumer<void( const LHCb::RawEvent&, const LHCb::ODIN& ), + Gaudi::Functional::Traits::BaseClass_t<GaudiHistoAlg>> { +public: + /// Standard constructor + DumpRawBanks( const std::string& name, ISvcLocator* pSvcLocator ); + + StatusCode initialize() override; + + void operator()( const LHCb::RawEvent& rawEvent, const LHCb::ODIN& odin ) const override; + +private: + std::string outputDirectory( LHCb::RawBank::BankType bankType ) const; + + Gaudi::Property<std::string> m_outputDirectory{this, "OutputDirectory", "banks"}; + Gaudi::Property<std::set<LHCb::RawBank::BankType>> m_bankTypes{ + this, "BankTypes", {LHCb::RawBank::VP, LHCb::RawBank::UT, LHCb::RawBank::FTCluster, LHCb::RawBank::Muon}}; + + std::unordered_map<std::string, AIDA::IHistogram1D*> m_histos; +}; +#endif // DUMPRAWBANKS_H diff --git a/Dumpers/src/DumpUTGeometry.cpp b/Dumpers/src/DumpUTGeometry.cpp new file mode 100644 index 00000000000..20c18503e21 --- /dev/null +++ b/Dumpers/src/DumpUTGeometry.cpp @@ -0,0 +1,157 @@ +/*****************************************************************************\ +* (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 <fstream> +#include <iostream> +#include <tuple> +#include <vector> + +#include <range/v3/view/repeat_n.hpp> +#include <range/v3/view/transform.hpp> + +#include <Kernel/IUTReadoutTool.h> +#include <Kernel/UTTell1Board.h> + +#include "DumpUTGeometry.h" + +namespace { + using std::vector; + + using namespace ranges; +} // namespace + +DECLARE_COMPONENT( DumpUTGeometry ) + +DumpUtils::Dump DumpUTGeometry::dumpGeom() const { + const auto& sectors = detector().sectors(); + uint32_t number_of_sectors = sectors.size(); + // first strip is always 1 + vector<uint32_t> firstStrip = view::repeat_n( 1, number_of_sectors ); + vector<float> pitch = view::transform( sectors, &DeUTSector::pitch ); + vector<float> cos = view::transform( sectors, &DeUTSector::cosAngle ); + vector<float> dy; + vector<float> dp0diX; + vector<float> dp0diY; + vector<float> dp0diZ; + vector<float> p0X; + vector<float> p0Y; + vector<float> p0Z; + + dy.reserve( number_of_sectors ); + dp0diX.reserve( number_of_sectors ); + dp0diY.reserve( number_of_sectors ); + dp0diZ.reserve( number_of_sectors ); + p0X.reserve( number_of_sectors ); + p0Y.reserve( number_of_sectors ); + p0Z.reserve( number_of_sectors ); + + // This code comes from DeUTSector::cacheInfo + for ( const auto sector : sectors ) { + auto firstTraj = sector->trajectoryFirstStrip(); + + // get the start and end point. for piecewise trajectories, we + // effectively make an approximation by a straight line. + const Gaudi::XYZPoint g1 = firstTraj.beginPoint(); + const Gaudi::XYZPoint g2 = firstTraj.endPoint(); + + const double activeWidth = sector->sensors().front()->activeWidth(); + + // direction + Gaudi::XYZVector direction = g2 - g1; + direction = direction.Unit(); + + // cross with normal along z + Gaudi::XYZVector zVec( 0, 0, 1 ); + Gaudi::XYZVector norm = direction.Cross( zVec ); + + // trajectory of middle + const Gaudi::XYZPoint g3 = g1 + 0.5 * ( g2 - g1 ); + const Gaudi::XYZPoint g4 = g3 + activeWidth * norm; + + // creating the 'fast' trajectories + const Gaudi::XYZVector vectorlayer = ( g4 - g3 ).unit() * sector->pitch(); + const Gaudi::XYZPoint p0 = g3 - 0.5 * sector->stripLength() * direction; + auto dxdy = direction.x() / direction.y(); + auto dzdy = direction.z() / direction.y(); + auto sdy = sector->stripLength() * direction.y(); + + dy.push_back( sdy ); + dp0diX.push_back( vectorlayer.x() - vectorlayer.y() * dxdy ); + dp0diY.push_back( vectorlayer.y() ); + dp0diZ.push_back( vectorlayer.z() - vectorlayer.y() * dzdy ); + p0X.push_back( p0.x() - p0.y() * dxdy ); + p0Y.push_back( p0.y() ); + p0Z.push_back( p0.z() - p0.y() * dzdy ); + } + + DumpUtils::Writer ut_geometry{}; + ut_geometry.write( number_of_sectors, firstStrip, pitch, dy, dp0diX, dp0diY, dp0diZ, p0X, p0Y, p0Z, cos ); + + return std::tuple{ut_geometry.buffer(), "ut_geometry", Allen::NonEventData::UTGeometry::id}; +} + +DumpUtils::Dump DumpUTGeometry::dumpBoards() const { + std::vector<uint32_t> stripsPerHybrids; + std::vector<uint32_t> stations; + std::vector<uint32_t> layers; + std::vector<uint32_t> detRegions; + std::vector<uint32_t> sectors; + std::vector<uint32_t> chanIDs; + + auto readout = tool<IUTReadoutTool>( "UTReadoutTool" ); + if ( !readout ) { throw GaudiException{"Failed to obtain readout tool.", name(), StatusCode::FAILURE}; } + + // Strips per hybrid cannot be obtained from the boards, so use the + // condition where it came from instead. + // This can be found in UTReadoutTool + std::string conditionLocation = "/dd/Conditions/ReadoutConf/UT/ReadoutMap"; + Condition* rInfo = getDet<Condition>( conditionLocation ); + auto hybridsPerBoard = rInfo->param<int>( "hybridsPerBoard" ); + unsigned int stripsPerHybrid = UTDAQ::nStripsPerBoard / hybridsPerBoard; + + uint32_t currentBoardID = 0, cbID = 0; + for ( ; cbID < readout->nBoard(); ++cbID ) { + auto b = readout->findByOrder( cbID ); + const uint32_t boardID = b->boardID().id(); + + // Insert empty boards if there is a gap between the last boardID and the + // current one + for ( ; boardID != 0 && currentBoardID < boardID; ++currentBoardID ) { + stripsPerHybrids.push_back( 0 ); + for ( uint32_t i = 0; i < 6; ++i ) { + stations.push_back( 0 ); + layers.push_back( 0 ); + detRegions.push_back( 0 ); + sectors.push_back( 0 ); + chanIDs.push_back( 0 ); + } + } + + stripsPerHybrids.push_back( stripsPerHybrid ); + + for ( size_t is = 0; is < b->nSectors(); ++is ) { + auto r = b->DAQToOfflineFull( 0, UTDAQ::v4, is * stripsPerHybrid ); + auto s = std::get<0>( r ); + stations.push_back( s.station ); + layers.push_back( s.layer ); + detRegions.push_back( s.detRegion ); + sectors.push_back( s.sector ); + chanIDs.push_back( s.chanID ); + } + ++currentBoardID; + } + + DumpUtils::Writer ut_boards{}; + ut_boards.write( currentBoardID, stripsPerHybrids, stations, layers, detRegions, sectors, chanIDs ); + + return std::tuple{ut_boards.buffer(), "ut_boards", Allen::NonEventData::UTBoards::id}; +} + +DumpUtils::Dumps DumpUTGeometry::dumpGeometry() const { return {{dumpGeom(), dumpBoards()}}; } diff --git a/Dumpers/src/DumpUTGeometry.h b/Dumpers/src/DumpUTGeometry.h new file mode 100644 index 00000000000..19f31470458 --- /dev/null +++ b/Dumpers/src/DumpUTGeometry.h @@ -0,0 +1,37 @@ +/*****************************************************************************\ +* (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 DUMPUTGEOMETRY_H +#define DUMPUTGEOMETRY_H 1 + +// Include files +#include "DumpGeometry.h" +#include <UTDet/DeUTDetector.h> + +/** @class DumpUTGeometry + * Class that dumps the UT geometry + * + * @author Roel Aaij + * @date 2018-08-27 + */ +class DumpUTGeometry final : public DumpGeometry<DeUTDetector> { +public: + DumpUTGeometry( std::string name, ISvcLocator* loc ) + : DumpGeometry<DeUTDetector>{std::move( name ), loc, DeUTDetLocation::UT} {} + +protected: + DumpUtils::Dumps dumpGeometry() const override; + +private: + DumpUtils::Dump dumpGeom() const; + DumpUtils::Dump dumpBoards() const; +}; + +#endif // DUMPUTGEOMETRY_H diff --git a/Dumpers/src/DumpUTHits.cpp b/Dumpers/src/DumpUTHits.cpp new file mode 100644 index 00000000000..486daf4be38 --- /dev/null +++ b/Dumpers/src/DumpUTHits.cpp @@ -0,0 +1,91 @@ +/*****************************************************************************\ +* (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 <vector> + +#include <boost/filesystem.hpp> + +#include "DumpUTHits.h" +#include "Utils.h" + +namespace fs = boost::filesystem; + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT( DumpUTHits ) + +DumpUTHits::DumpUTHits( const std::string& name, ISvcLocator* pSvcLocator ) + : Consumer( name, pSvcLocator, + {KeyValue{"ODINLocation", LHCb::ODINLocation::Default}, + KeyValue{"UTHitsLocation", UT::Info::HitLocation}} ) {} + +StatusCode DumpUTHits::initialize() { + if ( !DumpUtils::createDirectory( m_outputDirectory.value() ) ) { + error() << "Failed to create directory " << m_outputDirectory.value() << endmsg; + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +void DumpUTHits::operator()( const LHCb::ODIN& odin, const UT::HitHandler& hitHandler ) const { + + /*Write UT variables for GPU to binary file */ + DumpUtils::FileWriter outfile{m_outputDirectory.value() + "/" + std::to_string( odin.runNumber() ) + "_" + + std::to_string( odin.eventNumber() ) + ".bin"}; + + // UT + // Variables written to binary file as GPU input for VeloUT tracking + + constexpr int n_layers_ut = 4; + auto ut_cos = std::array<std::vector<float>, n_layers_ut>{}; + auto ut_yBegin = std::array<std::vector<float>, n_layers_ut>{}; + auto ut_yEnd = std::array<std::vector<float>, n_layers_ut>{}; + auto ut_dxDy = std::array<std::vector<float>, n_layers_ut>{}; + auto ut_zAtYEq0 = std::array<std::vector<float>, n_layers_ut>{}; + auto ut_xAtYEq0 = std::array<std::vector<float>, n_layers_ut>{}; + auto ut_weight = std::array<std::vector<float>, n_layers_ut>{}; + auto ut_highThreshold = std::array<std::vector<int>, n_layers_ut>{}; + auto ut_LHCbID = std::array<std::vector<unsigned int>, n_layers_ut>{}; + + for ( int iStation = 1; iStation < 3; ++iStation ) { + for ( int iLayer = 1; iLayer < 3; ++iLayer ) { + for ( int iRegion = 1; iRegion < 4; ++iRegion ) { + for ( int iSector = 1; iSector < 99; ++iSector ) { + for ( const auto& hit : hitHandler.hits( iStation, iLayer, iRegion, iSector ) ) { + /* For GPU input */ + ut_cos[hit.planeCode()].push_back( hit.cos() ); + ut_yBegin[hit.planeCode()].push_back( hit.yBegin() ); + ut_yEnd[hit.planeCode()].push_back( hit.yEnd() ); + ut_dxDy[hit.planeCode()].push_back( hit.dxDy() ); + ut_zAtYEq0[hit.planeCode()].push_back( hit.zAtYEq0() ); + ut_xAtYEq0[hit.planeCode()].push_back( hit.xAtYEq0() ); + ut_weight[hit.planeCode()].push_back( hit.weight() ); + ut_highThreshold[hit.planeCode()].push_back( hit.highThreshold() ); + ut_LHCbID[hit.planeCode()].push_back( hit.lhcbID().lhcbID() ); + } + } + } + } + } + + // first the number of hits per layer in each half as header + for ( int iStation = 0; iStation < 2; ++iStation ) { + for ( int iLayer = 0; iLayer < 2; ++iLayer ) { + int index = 2 * iStation + iLayer; + uint32_t n_hits = (int)( ut_cos[index].size() ); + outfile.write( n_hits ); + } + } + + // then the vectors containing the variables + for ( int i_layer = 0; i_layer < n_layers_ut; ++i_layer ) { + outfile.write( ut_cos[i_layer], ut_yBegin[i_layer], ut_yEnd[i_layer], ut_dxDy[i_layer], ut_zAtYEq0[i_layer], + ut_xAtYEq0[i_layer], ut_weight[i_layer], ut_highThreshold[i_layer], ut_LHCbID[i_layer] ); + } +} diff --git a/Dumpers/src/DumpUTHits.h b/Dumpers/src/DumpUTHits.h new file mode 100644 index 00000000000..0f02c6a5e24 --- /dev/null +++ b/Dumpers/src/DumpUTHits.h @@ -0,0 +1,44 @@ +/*****************************************************************************\ +* (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 DUMPUTHITS_H +#define DUMPUTHITS_H 1 + +#include <cstring> +#include <fstream> +#include <string> +#include <vector> + +// Include files +#include "Event/ODIN.h" +#include "GaudiAlg/Consumer.h" +#include "PrKernel/UTHitHandler.h" +#include "PrKernel/UTHitInfo.h" + +/** @class DumpUTHits DumpUTHits.h + * Algorithm that dumps UT hit variables to binary files. + * + * @author Roel Aaij + * @date 2018-08-27 + */ +class DumpUTHits : public Gaudi::Functional::Consumer<void( const LHCb::ODIN&, const UT::HitHandler& )> { +public: + /// Standard constructor + DumpUTHits( const std::string& name, ISvcLocator* pSvcLocator ); + + StatusCode initialize() override; + + void operator()( const LHCb::ODIN& odin, const UT::HitHandler& hitHandler ) const override; + +private: + Gaudi::Property<std::string> m_outputDirectory{this, "OutputDirectory", "ut_hits"}; +}; +#endif // DUMPUTHITS_H diff --git a/Dumpers/src/DumpUTLookupTables.cpp b/Dumpers/src/DumpUTLookupTables.cpp new file mode 100644 index 00000000000..61c27d77364 --- /dev/null +++ b/Dumpers/src/DumpUTLookupTables.cpp @@ -0,0 +1,35 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <tuple> +#include <vector> + +#include "DumpUTLookupTables.h" +#include "Utils.h" + +DECLARE_COMPONENT( DumpUTLookupTables ) + +DumpUtils::Dumps DumpUTLookupTables::dumpGeometry() const { + + auto& tool = detector(); + + DumpUtils::Writer output{}; + + std::tuple tables{std::tuple{"deflection", tool.DxLayTable()}, std::tuple{"Bdl", tool.BdlTable()}}; + for_each( tables, [this, &output]( auto const& entry ) { + auto const& [name, t] = entry; + auto const& table = t.table(); + output.write( t.nVar ); + for ( int i = 0; i < t.nVar; ++i ) output.write( t.nBins( i ) ); + output.write( table.size(), table ); + } ); + + return {{std::tuple{output.buffer(), "ut_tables", Allen::NonEventData::UTLookupTables::id}}}; +} diff --git a/Dumpers/src/DumpUTLookupTables.h b/Dumpers/src/DumpUTLookupTables.h new file mode 100644 index 00000000000..b77e8dc5d36 --- /dev/null +++ b/Dumpers/src/DumpUTLookupTables.h @@ -0,0 +1,33 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 DUMPUTLOOKUPTABLES_H +#define DUMPUTLOOKUPTABLES_H 1 + +// Include files +#include "DumpGeometry.h" +#include <PrKernel/IPrUTMagnetTool.h> + +/** @class DumpUTLookupTables + * Dump magnetic field. Implements DumpGeometry. + * + * @author Roel Aaij + * @date 2019-04-27 + */ +class DumpUTLookupTables final : public DumpGeometry<IPrUTMagnetTool> { +public: + DumpUTLookupTables( std::string name, ISvcLocator* loc ) + : DumpGeometry<IPrUTMagnetTool>{std::move( name ), loc, "PrUTMagnetTool"} {} + +protected: + DumpUtils::Dumps dumpGeometry() const override; +}; + +#endif // DUMPUTLOOKUPTABLES_H diff --git a/Dumpers/src/DumpVPGeometry.cpp b/Dumpers/src/DumpVPGeometry.cpp new file mode 100644 index 00000000000..7051b2ea91d --- /dev/null +++ b/Dumpers/src/DumpVPGeometry.cpp @@ -0,0 +1,41 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <tuple> +#include <vector> + +#include "DumpVPGeometry.h" +#include <GaudiKernel/SystemOfUnits.h> +#include <VPDet/VPGeometry.h> + +#include <boost/numeric/conversion/cast.hpp> + +DECLARE_COMPONENT( DumpVPGeometry ) + +DumpUtils::Dumps DumpVPGeometry::dumpGeometry() const { + + auto const& det = detector(); + VPGeometry vp( det ); + + DumpUtils::Writer output{}; + auto const& sensors = det.sensors(); + const size_t sensorPerModule = 4; + std::vector<float> zs( sensors.size() / sensorPerModule, 0.f ); + auto sensorZ = [&zs, sensorPerModule]( const auto* sensor ) { + zs[sensor->module()] += boost::numeric_cast<float>( sensor->z() / sensorPerModule ); + }; + std::for_each( sensors.begin(), sensors.end(), sensorZ ); + + output.write( zs.size(), zs, vp.m_local_x.size(), vp.m_local_x, vp.m_x_pitch.size(), vp.m_x_pitch, vp.m_ltg.size(), + vp.m_ltg[0].size() ); + for ( auto const& ltg : vp.m_ltg ) { output.write( ltg ); } + + return {{std::tuple{output.buffer(), "velo_geometry", Allen::NonEventData::VeloGeometry::id}}}; +} diff --git a/Dumpers/src/DumpVPGeometry.h b/Dumpers/src/DumpVPGeometry.h new file mode 100644 index 00000000000..b55a58232c6 --- /dev/null +++ b/Dumpers/src/DumpVPGeometry.h @@ -0,0 +1,33 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 DUMPVPGEOMETRY_H +#define DUMPVPGEOMETRY_H 1 + +// Include files +#include "DumpGeometry.h" +#include <VPDet/DeVP.h> + +/** @class DumpVPGeometry + * Dump geometry of the VeloPix tracker. Implements DumpGeometry. + * + * @author Roel Aaij + * @date 2019-04-23 + */ +class DumpVPGeometry final : public DumpGeometry<DeVP> { +public: + DumpVPGeometry( std::string name, ISvcLocator* loc ) + : DumpGeometry<DeVP>{std::move( name ), loc, DeVPLocation::Default} {} + +protected: + DumpUtils::Dumps dumpGeometry() const override; +}; + +#endif // DUMPUTGEOMETRY_H diff --git a/Dumpers/src/PVDumper.cpp b/Dumpers/src/PVDumper.cpp new file mode 100644 index 00000000000..cb413dd00ae --- /dev/null +++ b/Dumpers/src/PVDumper.cpp @@ -0,0 +1,92 @@ +/*****************************************************************************\ +* (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 files + +// local +#include "PVDumper.h" +#include "Associators/Associators.h" +#include "Utils.h" +#include <boost/filesystem.hpp> + +namespace { + + namespace fs = boost::filesystem; + + void collectProductss( const LHCb::MCVertex& mcpv, const LHCb::MCVertex& mcvtx, + std::vector<const LHCb::MCParticle*>& allprods ) { + for ( const auto& idau : mcvtx.products() ) { + double dv2 = ( mcpv.position() - idau->originVertex()->position() ).Mag2(); + if ( dv2 > ( 100. * Gaudi::Units::mm ) * ( 100. * Gaudi::Units::mm ) ) continue; + allprods.emplace_back( idau ); + for ( const auto& ivtx : idau->endVertices() ) { collectProductss( mcpv, *ivtx, allprods ); } + } + } +} // namespace + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT( PVDumper ) + +//============================================================================= +// Standard constructor, initializes variables +//============================================================================= + +PVDumper::PVDumper( const std::string& name, ISvcLocator* pSvcLocator ) + : Consumer( name, pSvcLocator, + {KeyValue{"MCVerticesLocation", LHCb::MCVertexLocation::Default}, + KeyValue{"MCPropertyLocation", LHCb::MCPropertyLocation::TrackInfo}, + KeyValue{"ODINLocation", LHCb::ODINLocation::Default}} ) {} + +StatusCode PVDumper::initialize() { + auto dir = fs::path{m_outputDirectory.value()}; + if ( !fs::exists( dir ) ) { + boost::system::error_code ec; + bool success = fs::create_directories( dir, ec ); + success &= !ec; + if ( !success ) { + error() << "Failed to create directory " << dir.string() << ": " << ec.message() << endmsg; + return StatusCode::FAILURE; + } + } + return StatusCode::SUCCESS; +} + +void PVDumper::operator()( const LHCb::MCVertices& MCVertices, const LHCb::MCProperty& MCProp, + const LHCb::ODIN& odin ) const { + // Binary file to dump MC PVs info + DumpUtils::FileWriter outfile_PV{m_outputDirectory.value() + "/" + std::to_string( odin.runNumber() ) + "_" + + std::to_string( odin.eventNumber() ) + ".bin"}; + + auto goodVertex = []( const auto* v ) { + return !v->mother() && v->type() == LHCb::MCVertex::MCVertexType::ppCollision; + }; + + int n_PVs = std::count_if( MCVertices.begin(), MCVertices.end(), goodVertex ); + outfile_PV.write( n_PVs ); + + MCTrackInfo trInfo{MCProp}; + for ( const auto& mcv : MCVertices ) { + if ( !goodVertex( mcv ) ) continue; + const auto& pv = mcv->position(); + outfile_PV.write( count_reconstructible_mc_particles( *mcv, trInfo ), pv.X(), pv.Y(), pv.Z() ); + } +} + +// count number reconstructible tracks in the same way as PrimaryVertexChecker +int PVDumper::count_reconstructible_mc_particles( const LHCb::MCVertex& avtx, const MCTrackInfo& trInfo ) const { + std::vector<const LHCb::MCParticle*> allproducts; + collectProductss( avtx, avtx, allproducts ); + + return std::count_if( allproducts.begin(), allproducts.end(), [&]( const auto* pmcp ) { + if ( pmcp->particleID().threeCharge() == 0 || !trInfo.hasVelo( pmcp ) ) return false; + double dv2 = ( avtx.position() - pmcp->originVertex()->position() ).Mag2(); + return dv2 < 0.0000001 && pmcp->p() > 100. * Gaudi::Units::MeV; + } ); +} diff --git a/Dumpers/src/PVDumper.h b/Dumpers/src/PVDumper.h new file mode 100644 index 00000000000..fcdd2896ad9 --- /dev/null +++ b/Dumpers/src/PVDumper.h @@ -0,0 +1,48 @@ +/*****************************************************************************\ +* (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 PVDUMPER_H +#define PVDUMPER_H 1 + +#include <cstring> +#include <fstream> +#include <string> + +// Include files +#include "Event/MCParticle.h" +#include "Event/MCTrackInfo.h" +#include "Event/MCVertex.h" +#include "Event/ODIN.h" +#include "GaudiAlg/Consumer.h" +#include "Linker/LinkerWithKey.h" + +/** @class PVDumper PVDumper.h + * tool to dump the MC truth informaiton for PVs + * based on the PrTrackerDumper code + * + * @author Florian Reiss + * @date 2018-12-17 + */ +class PVDumper : public Gaudi::Functional::Consumer<void( const LHCb::MCVertices& MCVertices, const LHCb::MCProperty&, + const LHCb::ODIN& )> { +public: + /// Standard constructor + PVDumper( const std::string& name, ISvcLocator* pSvcLocator ); + + StatusCode initialize() override; + + void operator()( const LHCb::MCVertices& MCVertices, const LHCb::MCProperty&, const LHCb::ODIN& odin ) const override; + +private: + int count_reconstructible_mc_particles( const LHCb::MCVertex&, const MCTrackInfo& ) const; + + Gaudi::Property<std::string> m_outputDirectory{this, "OutputDirectory", "MC_info/PVs"}; +}; +#endif // PVDUMPER_H diff --git a/Dumpers/src/TestMuonTable.cpp b/Dumpers/src/TestMuonTable.cpp new file mode 100644 index 00000000000..b7e8e7981a7 --- /dev/null +++ b/Dumpers/src/TestMuonTable.cpp @@ -0,0 +1,211 @@ +/*****************************************************************************\ +* (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 <array> +#include <vector> + +#include <boost/filesystem.hpp> +#include <boost/math/special_functions/relative_difference.hpp> + +#include "TestMuonTable.h" +#include "Utils.h" + +namespace { + using std::array; + using std::string; + using std::to_string; + using std::tuple; + using std::vector; + + namespace fs = boost::filesystem; +} // namespace + +// Declaration of the Algorithm Factory +DECLARE_COMPONENT( TestMuonTable ) + +unsigned int pad_offset( MuonTable const& table, LHCb::MuonTileID const& tile ) { + int idx = 4 * tile.station() + tile.region(); + int perQuarter = 3 * table.gridX[idx] * table.gridY[idx]; + return static_cast<unsigned int>( ( 4 * tile.region() + tile.quarter() ) * perQuarter ); +} + +unsigned int strip_offset( MuonTable const& table, LHCb::MuonTileID const& tile ) { + int idx = 4 * tile.station() + tile.region(); + int perQuarter = 3 * table.gridX[idx] * table.gridY[idx]; + return table.offset[4 * tile.station() + tile.region()] + tile.quarter() * perQuarter; +} + +size_t lookup_index( MuonTable const& table, LHCb::MuonTileID const& tile ) { + int station = tile.station(); + int region = tile.region(); + int idx = 4 * station + region; + int xpad = static_cast<int>( tile.nX() ); + int ypad = static_cast<int>( tile.nY() ); + auto index = table.offset_fun( table, tile ); + + if ( ypad < table.gridY[idx] ) { + index = index + table.gridX[idx] * ypad + xpad - table.gridX[idx]; + } else { + index = index + table.gridX[idx] * table.gridY[idx] + 2 * table.gridX[idx] * ( ypad - table.gridY[idx] ) + xpad; + } + return index; +} + +void lookup( MuonTable const& table, LHCb::MuonTileID const& tile, double& x, double& deltax, double& y, double& deltay, + double& z ) { + int station = tile.station(); + auto index = lookup_index( table, tile ); + auto& p = table.table[station][index]; + x = p[0]; + y = p[1]; + z = p[2]; + + auto dxi = MuonUtils::size_index( table.sizeOffset, table.gridX, table.gridY, tile ); + deltax = table.sizeX[dxi]; + deltay = table.sizeY[dxi]; +} + +unsigned int getLayoutX( MuonTable const& table, unsigned int station, unsigned int region ) { + return table.gridX[4 * station + region]; +} + +unsigned int getLayoutY( MuonTable const& table, unsigned int station, unsigned int region ) { + return table.gridY[4 * station + region]; +} + +tuple<std::reference_wrapper<const MuonTable>, string> lookup_table( LHCb::MuonTileID const& tile, bool const uncrossed, + MuonTable const& pad, MuonTable const& stripX, + MuonTable const& stripY ) { + unsigned int x1 = getLayoutX( stripX, tile.station(), tile.region() ); + unsigned int y1 = getLayoutY( stripX, tile.station(), tile.region() ); + auto table = tuple{std::cref( pad ), "pad"}; + if ( uncrossed ) { + if ( tile.station() <= 1 || tile.region() != 0 ) { + if ( tile.layout().xGrid() == x1 && tile.layout().yGrid() == y1 ) { + table = tuple{std::cref( stripX ), "stripX"}; + } else { + table = tuple{std::cref( stripY ), "stripY"}; + } + } + } + return table; +} + +void coord_position( LHCb::MuonTileID const& tile, MuonTable const& pad, MuonTable const& stripX, + MuonTable const& stripY, bool const uncrossed, double& x, double& dx, double& y, double& dy, + double& z ) { + + auto r = lookup_table( tile, uncrossed, pad, stripX, stripY ); + lookup( std::get<0>( r ).get(), tile, x, dx, y, dy, z ); +} + +void read_muon_table( const char* raw_input, MuonTable& pad, MuonTable& stripX, MuonTable& stripY ) { + + size_t n = 0; + for ( MuonTable& muonTable : {std::ref( pad ), std::ref( stripX ), std::ref( stripY )} ) { + for_each( make_tuple( std::ref( muonTable.gridX ), std::ref( muonTable.gridY ), std::ref( muonTable.sizeX ), + std::ref( muonTable.sizeY ), std::ref( muonTable.offset ) ), + [&n, &raw_input]( auto& table ) { + size_t s = 0; + std::copy_n( (size_t*)raw_input, 1, &s ); + + // Some metaprogramming to resize the underlying + // container if it is a vector and get the underlying + // value type + using table_t = typename std::remove_reference_t<decltype( table )>; + using T = typename table_t::value_type; + optional_resize<table_t>{}( table, s ); + assert( s == table.size() ); + + // Read the data into the container + raw_input += sizeof( size_t ); + std::copy_n( (T*)raw_input, s, table.data() ); + raw_input += sizeof( T ) * s; + ++n; + } ); + + for ( size_t i = 0; i < muonTable.gridY.size() - 1; ++i ) { + muonTable.sizeOffset[i + 1] = muonTable.sizeOffset[i] + 24 * muonTable.gridY[i]; + } + assert( ( muonTable.sizeOffset.back() + 24 * muonTable.gridY.back() ) == muonTable.sizeX.size() ); + + size_t tableSize = 0; + std::copy_n( (size_t*)raw_input, 1, &tableSize ); + raw_input += sizeof( size_t ); + assert( tableSize == 4 ); + + for ( size_t i = 0; i < tableSize; i++ ) { + size_t stationTableSize = 0; + std::copy_n( (size_t*)raw_input, 1, &stationTableSize ); + raw_input += sizeof( size_t ); + ( muonTable.table )[i].resize( stationTableSize ); + for ( size_t j = 0; j < stationTableSize; j++ ) { + std::copy_n( (float*)raw_input, 3, muonTable.table[i][j].data() ); + raw_input += sizeof( float ) * 3; + } + } + } +} + +TestMuonTable::TestMuonTable( const string& name, ISvcLocator* pSvcLocator ) + : Consumer( name, pSvcLocator, {KeyValue{"MuonCoordsLocation", LHCb::MuonCoordLocation::MuonCoords}} ) {} + +StatusCode TestMuonTable::initialize() { + m_det = getDet<DeMuonDetector>( "/dd/Structure/LHCb/DownstreamRegion/Muon" ); + + fs::path p{m_table.value()}; + auto read_size = fs::file_size( p ); + std::vector<char> raw_input( read_size ); + + std::ifstream input( p.c_str(), std::ios::binary ); + input.read( &raw_input[0], read_size ); + input.close(); + + read_muon_table( raw_input.data(), m_pad, m_stripX, m_stripY ); + + return StatusCode::SUCCESS; +} + +void TestMuonTable::operator()( const LHCb::MuonCoords& muonCoords ) const { + + double xp = 0., dxp = 0., yp = 0., dyp = 0., zp = 0., dzp = 0.; + double xt = 0., dxt = 0., yt = 0., dyt = 0., zt = 0.; + + size_t n = 0; + + for ( auto coord : muonCoords ) { + + m_det->Tile2XYZ( coord->key(), xp, dxp, yp, dyp, zp, dzp ); + + coord_position( coord->key(), m_pad, m_stripX, m_stripY, coord->uncrossed(), xt, dxt, yt, dyt, zt ); + + array<tuple<char const*, double, double>, 5> values{ + {{"x ", xp, xt}, {"dx", dxp, dxt}, {"y ", yp, yt}, {"dy", dyp, dyt}, {"z ", zp, zt}}}; + + boost::format msg{"%|4d| %|8d| %|6s| %|d| %|d| %|d| %|2d| %|2d| %|d| %|5d| %|5d|"}; + + for ( auto [w, a, b] : values ) { + if ( boost::math::relative_difference( a, b ) > 0.01 ) { + auto const& tile = coord->key(); + auto [table, tt] = lookup_table( tile, coord->uncrossed(), m_pad, m_stripX, m_stripY ); + const auto index = lookup_index( table.get(), tile ); + + auto dx_index = MuonUtils::size_index( table.get().sizeOffset, table.get().gridX, table.get().gridY, tile ); + + // positions are always indexed by station + error() << ( msg % n % unsigned{tile} % tt % tile.station() % tile.region() % tile.quarter() % tile.nX() % + tile.nY() % coord->uncrossed() % index % dx_index ) + << endmsg; + error() << w << " " << a << " " << b << endmsg; + } + } + ++n; + } +} diff --git a/Dumpers/src/TestMuonTable.h b/Dumpers/src/TestMuonTable.h new file mode 100644 index 00000000000..3150c0c52c0 --- /dev/null +++ b/Dumpers/src/TestMuonTable.h @@ -0,0 +1,74 @@ +/*****************************************************************************\ +* (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 TESTMUONTABLE_H +#define TESTMUONTABLE_H 1 + +#include <array> +#include <cstring> +#include <fstream> +#include <string> +#include <vector> + +// Include files +#include <Event/MuonCoord.h> +#include <Event/ODIN.h> +#include <GaudiAlg/Consumer.h> +#include <MuonDet/DeMuonDetector.h> + +struct MuonTable; +using offset_fun_t = std::function<unsigned int( MuonTable const& table, LHCb::MuonTileID const& tile )>; + +unsigned int pad_offset( MuonTable const& table, LHCb::MuonTileID const& tile ); +unsigned int strip_offset( MuonTable const& table, LHCb::MuonTileID const& tile ); + +struct MuonTable { + MuonTable( offset_fun_t of ) : offset_fun{std::move( of )} {} + + std::array<int, 16> gridX{}, gridY{}; + std::array<unsigned int, 16> offset{}, sizeOffset{}; + std::vector<float> sizeX{}, sizeY{}; + std::array<std::vector<std::array<float, 3>>, 4> table; + offset_fun_t offset_fun; +}; + +struct PadTable : public MuonTable { + PadTable() : MuonTable{pad_offset} {} +}; + +struct StripTable : public MuonTable { + StripTable() : MuonTable{strip_offset} {} +}; + +/** @class TestMuonTable TestMuonTable.h + * Algorithm that dumps FT hit variables to binary files. + * + * @author Roel Aaij + * @date 2018-08-27 + */ +class TestMuonTable : public Gaudi::Functional::Consumer<void( const LHCb::MuonCoords& )> { +public: + /// Standard constructor + TestMuonTable( const std::string& name, ISvcLocator* pSvcLocator ); + + StatusCode initialize() override; + + void operator()( const LHCb::MuonCoords& ) const override; + +private: + Gaudi::Property<std::string> m_table{this, "MuonTable", ""}; + + PadTable m_pad; + StripTable m_stripX; + StripTable m_stripY; + + DeMuonDetector* m_det = nullptr; +}; +#endif // TESTMUONTABLE_H diff --git a/Dumpers/src/Utils.cpp b/Dumpers/src/Utils.cpp new file mode 100644 index 00000000000..789a579761b --- /dev/null +++ b/Dumpers/src/Utils.cpp @@ -0,0 +1,39 @@ +/*****************************************************************************\ +* (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 <boost/filesystem.hpp> +#include <string> + +#include "Utils.h" + +namespace { + namespace fs = boost::filesystem; +} + +bool DumpUtils::createDirectory( fs::path directory ) { + if ( !fs::exists( directory ) ) { + boost::system::error_code ec; + bool success = fs::create_directories( directory, ec ); + success &= !ec; + return success; + } + return true; +} + +size_t MuonUtils::size_index( std::array<unsigned int, 16> const& offset, std::array<int, 16> const& gridX, + std::array<int, 16> const& gridY, LHCb::MuonTileID const& tile ) { + auto idx = 4 * tile.station() + tile.region(); + auto index = offset[idx] + tile.quarter() * gridY[idx] * 6; + if ( tile.nY() < static_cast<unsigned int>( gridY[idx] ) ) { + return index + 2 * tile.nY() + 2 * ( tile.nX() - gridX[idx] ) / gridX[idx]; + } else { + return index + 4 * tile.nY() - 2 * gridY[idx] + ( 2 * tile.nX() / gridX[idx] ); + } +} diff --git a/Dumpers/src/Utils.h b/Dumpers/src/Utils.h new file mode 100644 index 00000000000..de548c0adb5 --- /dev/null +++ b/Dumpers/src/Utils.h @@ -0,0 +1,121 @@ +/*****************************************************************************\ +* (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 DUMPUTILS_H +#define DUMPUTILS_H + +#include <boost/filesystem.hpp> +#include <boost/interprocess/streams/vectorstream.hpp> + +#include <Kernel/MuonTileID.h> +#include <fstream> +#include <functional> +#include <gsl/span> +#include <string> +#include <type_traits> +#include <vector> + +#include <Dumpers/Identifiers.h> + +namespace Detail { + template <class F, class... Args> + void for_each_arg( F&& f, Args&&... args ) { + using discard = int[]; + (void)discard{0, ( (void)( f( std::forward<Args>( args ) ) ), 0 )...}; + } + + template <class T> + constexpr std::make_index_sequence<std::tuple_size<T>::value> get_indexes( T const& ) { + return {}; + } +} // namespace Detail + +template <size_t... Is, class Tuple, class F> +void for_each( std::index_sequence<Is...>, Tuple&& tup, F&& f ) { + using std::get; + Detail::for_each_arg( std::forward<F>( f ), get<Is>( std::forward<Tuple>( tup ) )... ); +} + +template <class Tuple, class F> +void for_each( Tuple&& tup, F&& f ) { + auto indexes = Detail::get_indexes( tup ); + for_each( indexes, std::forward<Tuple>( tup ), std::forward<F>( f ) ); +} + +template <class T> +struct optional_resize { + void operator()( T&, size_t ) {} +}; + +template <class... Args> +struct optional_resize<std::vector<Args...>> { + void operator()( std::vector<Args...>& v, size_t s ) { v.resize( s ); } +}; + +namespace DumpUtils { + + bool createDirectory( boost::filesystem::path dir ); + + namespace detail { + + template <typename T> + std::ostream& write( std::ostream& os, const T& t ) { + // if you would like to know why there is a check for trivially copyable, + // please read the 'notes' section of https://en.cppreference.com/w/cpp/types/is_trivially_copyable + if constexpr ( std::is_same_v<T, gsl::span<const std::byte>> ) { + return os.write( reinterpret_cast<const char*>( t.data() ), t.size() ); + } else if constexpr ( std::is_trivially_copyable_v<T> && !gsl::details::is_span<T>::value ) { + return os.write( reinterpret_cast<const char*>( &t ), sizeof( T ) ); + } else { + static_assert( std::is_trivially_copyable_v<typename T::value_type> ); + return write( os, as_bytes( gsl::make_span( t ) ) ); + } + } + + } // namespace detail + + class Writer { + + boost::interprocess::basic_vectorstream<std::vector<char>> m_buffer; + + public: + template <typename... Args> + Writer& write( Args&&... args ) { + ( detail::write( m_buffer, std::forward<Args>( args ) ), ... ); + return *this; + } + + std::vector<char> const& buffer() { return m_buffer.vector(); } + }; + + class FileWriter { + std::ofstream m_f; + + public: + FileWriter( const std::string& name ) : m_f{name, std::ios::out | std::ios::binary} {} + + template <typename... Args> + FileWriter& write( Args&&... args ) { + ( detail::write( m_f, std::forward<Args>( args ) ), ... ); + return *this; + } + }; + + using Dump = std::tuple<std::vector<char>, std::string, std::string>; + using Dumps = std::vector<Dump>; + +} // namespace DumpUtils + +namespace MuonUtils { + size_t size_index( std::array<unsigned int, 16> const& sizeXOffset, std::array<int, 16> const& gridX, + std::array<int, 16> const& gridY, LHCb::MuonTileID const& tile ); +} + +#endif diff --git a/Dumpers/src/lib/PyAllenHelper.cpp b/Dumpers/src/lib/PyAllenHelper.cpp new file mode 100644 index 00000000000..b3fc40a2fc7 --- /dev/null +++ b/Dumpers/src/lib/PyAllenHelper.cpp @@ -0,0 +1,16 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <Dumpers/IUpdater.h> +#include <GaudiKernel/Service.h> + +Allen::NonEventData::IUpdater* cast_updater( IService* updater_svc ) { + return dynamic_cast<Allen::NonEventData::IUpdater*>( updater_svc ); +} diff --git a/Dumpers/src/lib/TestUTBoards.cpp b/Dumpers/src/lib/TestUTBoards.cpp new file mode 100644 index 00000000000..30ccbed400b --- /dev/null +++ b/Dumpers/src/lib/TestUTBoards.cpp @@ -0,0 +1,60 @@ +/*****************************************************************************\ +* (c) Copyright 2000-2019 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 <filesystem> +#include <fstream> +#include <iomanip> +#include <iostream> +#include <iterator> + +#include <Dumpers/TestUTBoards.h> + +namespace fs = std::filesystem; + +using namespace std; + +UTBoards::UTBoards( std::vector<char> data ) : m_data{std::move( data )} { + uint32_t* p = (uint32_t*)m_data.data(); + number_of_boards = *p; + p += 1; + number_of_channels = 6 * number_of_boards; + stripsPerHybrids = p; + p += number_of_boards; + stations = p; + p += number_of_channels; + layers = p; + p += number_of_channels; + detRegions = p; + p += number_of_channels; + sectors = p; + p += number_of_channels; + chanIDs = p; + p += number_of_channels; +} + +std::vector<char> readFile( const string& filename ) { + fs::path p{filename}; + std::ifstream file( filename, std::ios::binary ); + + // Stop eating new lines in binary mode + file.unsetf( std::ios::skipws ); + + std::vector<char> v; + v.reserve( fs::file_size( p ) ); + + // read the data: + v.insert( v.begin(), std::istream_iterator<char>( file ), std::istream_iterator<char>() ); + return v; +} + +UTBoards readUTBoards( const string& filename ) { + auto v = readFile( filename ); + return UTBoards{std::move( v )}; +} diff --git a/Dumpers/tests/options/make_ref.py b/Dumpers/tests/options/make_ref.py new file mode 100644 index 00000000000..d88b9b002b6 --- /dev/null +++ b/Dumpers/tests/options/make_ref.py @@ -0,0 +1,29 @@ +############################################################################### +# (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. # +############################################################################### +import sys +import os +base_dir = sys.argv[1] +dump_directories = sys.argv[2].split(',') +files = {} +for dd in dump_directories: + dump_dir = os.path.join(base_dir, dd) + files[dd] = sorted([ + os.path.join(dd, f) for f in os.listdir(dump_dir) + if not f.endswith('.root') + ]) + +sizes = [(f, os.stat(os.path.join(base_dir, f)).st_size) + for v in files.itervalues() for f in v] +sizes = sorted(sizes, key=lambda e: e[0]) + +with open("ref", "w") as ref: + for f, s in sizes: + ref.write("%s %d\n" % (f, s)) diff --git a/Dumpers/tests/options/test_geometry.py b/Dumpers/tests/options/test_geometry.py new file mode 100644 index 00000000000..3456f992d52 --- /dev/null +++ b/Dumpers/tests/options/test_geometry.py @@ -0,0 +1,15 @@ +############################################################################### +# (c) Copyright 2019 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. # +############################################################################### +from Configurables import LHCbApp, TestMuonTable + +app = LHCbApp() +tmt = TestMuonTable() +tmt.MuonTable = "geometry/muon_table_%s_%s.bin" % (app.DDDBtag, app.CondDBtag) diff --git a/Dumpers/tests/options/upgrade-minbias-testfiledb.py b/Dumpers/tests/options/upgrade-minbias-testfiledb.py new file mode 100644 index 00000000000..9aa83f80c98 --- /dev/null +++ b/Dumpers/tests/options/upgrade-minbias-testfiledb.py @@ -0,0 +1,16 @@ +############################################################################### +# (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. # +############################################################################### +from GaudiConf import IOExtension +from PRConfig import TestFileDB + +sample = TestFileDB.test_file_db['MiniBrunel_2018_MinBias_FTv4_MDF'] +sample.setqualifiers(withDB=True) +IOExtension().inputFiles(list(set(sample.filenames)), clear=True) diff --git a/Dumpers/tests/qmtest/dumpers.qms/dump.qmt b/Dumpers/tests/qmtest/dumpers.qms/dump.qmt new file mode 100755 index 00000000000..7d85203ad24 --- /dev/null +++ b/Dumpers/tests/qmtest/dumpers.qms/dump.qmt @@ -0,0 +1,62 @@ +<?xml version="1.0" ?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'> +<!-- + (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. +--> +<!-- +####################################################### +# SUMMARY OF THIS TEST +# ................... +# Author: Roel Aaij +# Purpose: Verify that raw banks are dumped +####################################################### +--> +<extension class="GaudiTest.GaudiExeTest" kind="test"> + <argument name="program"><text>gaudirun.py</text></argument> + <argument name="args"><set> + <text>../../options/dump.py</text> + <text>../options/upgrade-minbias-testfiledb.py</text> + <text>../options/test_geometry.py</text> + </set></argument> + <arguement name="timeout"><integer>600</integer></arguement> + <argument name="validator"><text> +test_name = "dumpers.dump" + +ref_sizes = {} +with open('../refs/dump.ref') as ref: + for line in ref: + f, s = line.strip().split() + ref_sizes[f] = int(s) + +missing = [] +bad_size = [] +for f, s in ref_sizes.iteritems(): + if not os.path.exists(f): + missing.append(f) + else: + size = os.stat(f).st_size + if size != s: + bad_size.append((f, size, s)) + +result_str = '' +if not missing and not bad_size: + result_str += 'Files and sizes match\n' +if missing: + result_str += 'Missing:\n\t' + '\n\t'.join(missing) + '\n' +if bad_size: + pat = "%s is %d bytes instead of %d" + result_str += ('Wrong size:\n\t' + + '\n\t'.join([pat % e for e in bad_size]) + '\n') + +result["validator.output"] = result.Quote(result_str) + +countErrorLines({"FATAL":0,"ERROR":0,"WARNING":0}) + +</text></argument> +</extension> diff --git a/Dumpers/tests/refs/dump.ref b/Dumpers/tests/refs/dump.ref new file mode 100644 index 00000000000..91c29020135 --- /dev/null +++ b/Dumpers/tests/refs/dump.ref @@ -0,0 +1,410 @@ +banks/FTCluster/7046998_9701.bin 19448 +banks/FTCluster/7046998_9702.bin 21260 +banks/FTCluster/7046998_9703.bin 7008 +banks/FTCluster/7046998_9704.bin 7580 +banks/FTCluster/7046998_9705.bin 7296 +banks/FTCluster/7046998_9706.bin 16912 +banks/FTCluster/7046998_9707.bin 13752 +banks/FTCluster/7046998_9708.bin 9412 +banks/FTCluster/7046998_9709.bin 10644 +banks/FTCluster/7046998_9710.bin 19844 +banks/FTCluster/7046998_9711.bin 13472 +banks/FTCluster/7046998_9712.bin 14276 +banks/FTCluster/7046998_9713.bin 5444 +banks/FTCluster/7046998_9714.bin 7132 +banks/FTCluster/7046998_9715.bin 11516 +banks/FTCluster/7046998_9716.bin 9628 +banks/FTCluster/7046998_9717.bin 19132 +banks/FTCluster/7046998_9718.bin 14912 +banks/FTCluster/7046998_9719.bin 11088 +banks/FTCluster/7046998_9720.bin 15552 +banks/FTCluster/7046998_9721.bin 8272 +banks/FTCluster/7046998_9722.bin 7240 +banks/FTCluster/7046998_9723.bin 9968 +banks/FTCluster/7046998_9724.bin 15560 +banks/FTCluster/7046998_9725.bin 17132 +banks/FTCluster/7046998_9726.bin 18704 +banks/FTCluster/7046998_9727.bin 7404 +banks/FTCluster/7046998_9728.bin 11708 +banks/FTCluster/7046998_9729.bin 11032 +banks/FTCluster/7046998_9730.bin 12876 +banks/FTCluster/7046998_9731.bin 14984 +banks/FTCluster/7046998_9732.bin 22576 +banks/FTCluster/7046998_9733.bin 8828 +banks/FTCluster/7046998_9734.bin 13540 +banks/FTCluster/7046998_9735.bin 17700 +banks/FTCluster/7046998_9736.bin 10028 +banks/FTCluster/7046998_9737.bin 21276 +banks/FTCluster/7046998_9738.bin 8644 +banks/FTCluster/7046998_9739.bin 13172 +banks/FTCluster/7046998_9740.bin 29316 +banks/FTCluster/7046998_9741.bin 19288 +banks/FTCluster/7046998_9742.bin 24444 +banks/FTCluster/7046998_9743.bin 18332 +banks/FTCluster/7046998_9744.bin 8112 +banks/FTCluster/7046998_9745.bin 15372 +banks/FTCluster/7046998_9746.bin 7004 +banks/FTCluster/7046998_9747.bin 12928 +banks/FTCluster/7046998_9748.bin 6504 +banks/FTCluster/7046998_9749.bin 5804 +banks/FTCluster/7046998_9750.bin 9292 +banks/Muon/7046998_9701.bin 1796 +banks/Muon/7046998_9702.bin 1600 +banks/Muon/7046998_9703.bin 788 +banks/Muon/7046998_9704.bin 960 +banks/Muon/7046998_9705.bin 784 +banks/Muon/7046998_9706.bin 2120 +banks/Muon/7046998_9707.bin 1232 +banks/Muon/7046998_9708.bin 832 +banks/Muon/7046998_9709.bin 780 +banks/Muon/7046998_9710.bin 2556 +banks/Muon/7046998_9711.bin 1272 +banks/Muon/7046998_9712.bin 1788 +banks/Muon/7046998_9713.bin 744 +banks/Muon/7046998_9714.bin 920 +banks/Muon/7046998_9715.bin 1496 +banks/Muon/7046998_9716.bin 856 +banks/Muon/7046998_9717.bin 1656 +banks/Muon/7046998_9718.bin 1980 +banks/Muon/7046998_9719.bin 2564 +banks/Muon/7046998_9720.bin 1196 +banks/Muon/7046998_9721.bin 584 +banks/Muon/7046998_9722.bin 784 +banks/Muon/7046998_9723.bin 1024 +banks/Muon/7046998_9724.bin 1188 +banks/Muon/7046998_9725.bin 1728 +banks/Muon/7046998_9726.bin 2508 +banks/Muon/7046998_9727.bin 920 +banks/Muon/7046998_9728.bin 1168 +banks/Muon/7046998_9729.bin 960 +banks/Muon/7046998_9730.bin 1228 +banks/Muon/7046998_9731.bin 1120 +banks/Muon/7046998_9732.bin 1696 +banks/Muon/7046998_9733.bin 1316 +banks/Muon/7046998_9734.bin 1024 +banks/Muon/7046998_9735.bin 1168 +banks/Muon/7046998_9736.bin 876 +banks/Muon/7046998_9737.bin 2876 +banks/Muon/7046998_9738.bin 808 +banks/Muon/7046998_9739.bin 1072 +banks/Muon/7046998_9740.bin 2200 +banks/Muon/7046998_9741.bin 1572 +banks/Muon/7046998_9742.bin 1708 +banks/Muon/7046998_9743.bin 1560 +banks/Muon/7046998_9744.bin 832 +banks/Muon/7046998_9745.bin 1656 +banks/Muon/7046998_9746.bin 628 +banks/Muon/7046998_9747.bin 696 +banks/Muon/7046998_9748.bin 632 +banks/Muon/7046998_9749.bin 524 +banks/Muon/7046998_9750.bin 864 +banks/UT/7046998_9701.bin 12484 +banks/UT/7046998_9702.bin 11028 +banks/UT/7046998_9703.bin 4420 +banks/UT/7046998_9704.bin 3572 +banks/UT/7046998_9705.bin 4308 +banks/UT/7046998_9706.bin 8284 +banks/UT/7046998_9707.bin 7936 +banks/UT/7046998_9708.bin 5256 +banks/UT/7046998_9709.bin 4460 +banks/UT/7046998_9710.bin 12868 +banks/UT/7046998_9711.bin 6092 +banks/UT/7046998_9712.bin 7432 +banks/UT/7046998_9713.bin 3164 +banks/UT/7046998_9714.bin 3944 +banks/UT/7046998_9715.bin 5276 +banks/UT/7046998_9716.bin 5496 +banks/UT/7046998_9717.bin 9184 +banks/UT/7046998_9718.bin 7556 +banks/UT/7046998_9719.bin 7436 +banks/UT/7046998_9720.bin 10992 +banks/UT/7046998_9721.bin 4040 +banks/UT/7046998_9722.bin 3564 +banks/UT/7046998_9723.bin 5124 +banks/UT/7046998_9724.bin 8056 +banks/UT/7046998_9725.bin 8352 +banks/UT/7046998_9726.bin 9860 +banks/UT/7046998_9727.bin 3536 +banks/UT/7046998_9728.bin 6800 +banks/UT/7046998_9729.bin 4928 +banks/UT/7046998_9730.bin 6356 +banks/UT/7046998_9731.bin 8280 +banks/UT/7046998_9732.bin 10004 +banks/UT/7046998_9733.bin 5284 +banks/UT/7046998_9734.bin 5768 +banks/UT/7046998_9735.bin 10032 +banks/UT/7046998_9736.bin 5776 +banks/UT/7046998_9737.bin 12728 +banks/UT/7046998_9738.bin 5112 +banks/UT/7046998_9739.bin 5972 +banks/UT/7046998_9740.bin 18032 +banks/UT/7046998_9741.bin 11344 +banks/UT/7046998_9742.bin 13492 +banks/UT/7046998_9743.bin 9636 +banks/UT/7046998_9744.bin 3868 +banks/UT/7046998_9745.bin 9160 +banks/UT/7046998_9746.bin 3276 +banks/UT/7046998_9747.bin 5992 +banks/UT/7046998_9748.bin 2988 +banks/UT/7046998_9749.bin 3920 +banks/UT/7046998_9750.bin 4736 +banks/VP/7046998_9701.bin 19304 +banks/VP/7046998_9702.bin 21944 +banks/VP/7046998_9703.bin 5452 +banks/VP/7046998_9704.bin 4996 +banks/VP/7046998_9705.bin 6576 +banks/VP/7046998_9706.bin 15500 +banks/VP/7046998_9707.bin 10516 +banks/VP/7046998_9708.bin 10020 +banks/VP/7046998_9709.bin 6888 +banks/VP/7046998_9710.bin 18364 +banks/VP/7046998_9711.bin 12576 +banks/VP/7046998_9712.bin 15964 +banks/VP/7046998_9713.bin 4096 +banks/VP/7046998_9714.bin 5344 +banks/VP/7046998_9715.bin 9676 +banks/VP/7046998_9716.bin 8664 +banks/VP/7046998_9717.bin 14024 +banks/VP/7046998_9718.bin 14468 +banks/VP/7046998_9719.bin 14140 +banks/VP/7046998_9720.bin 18472 +banks/VP/7046998_9721.bin 6356 +banks/VP/7046998_9722.bin 5464 +banks/VP/7046998_9723.bin 6384 +banks/VP/7046998_9724.bin 16484 +banks/VP/7046998_9725.bin 13744 +banks/VP/7046998_9726.bin 15100 +banks/VP/7046998_9727.bin 6084 +banks/VP/7046998_9728.bin 7828 +banks/VP/7046998_9729.bin 8820 +banks/VP/7046998_9730.bin 10260 +banks/VP/7046998_9731.bin 13296 +banks/VP/7046998_9732.bin 16888 +banks/VP/7046998_9733.bin 6376 +banks/VP/7046998_9734.bin 11164 +banks/VP/7046998_9735.bin 15096 +banks/VP/7046998_9736.bin 9596 +banks/VP/7046998_9737.bin 23360 +banks/VP/7046998_9738.bin 8676 +banks/VP/7046998_9739.bin 8724 +banks/VP/7046998_9740.bin 35776 +banks/VP/7046998_9741.bin 16720 +banks/VP/7046998_9742.bin 23432 +banks/VP/7046998_9743.bin 16300 +banks/VP/7046998_9744.bin 6208 +banks/VP/7046998_9745.bin 14528 +banks/VP/7046998_9746.bin 4288 +banks/VP/7046998_9747.bin 13516 +banks/VP/7046998_9748.bin 2956 +banks/VP/7046998_9749.bin 5740 +banks/VP/7046998_9750.bin 7748 +geometry/ut_boards_dddb-20171010_sim-20180530-vc-md100.bin 24060 +geometry/ut_boards_dddb-20171126_sim-20171127-vc-md100.bin 24060 +geometry/ut_geometry_dddb-20171010_sim-20180530-vc-md100.bin 41924 +geometry/ut_geometry_dddb-20171126_sim-20171127-vc-md100.bin 41924 +geometry/muon_table_dddb-20171122_sim-20180530-vc-md100.bin 1170864 +geometry/muon_geometry_dddb-20171122_sim-20180530-vc-md100.bin 80080 +geometry/velo_geometry_dddb-20171010_sim-20180530-vc-md100.bin 19456 +geometry/velo_geometry_dddb-20171122_sim-20180530-vc-md100.bin 19456 +geometry/polarity_dddb-20171122_sim-20180530-vc-md100.bin 4 +geometry/beamline_dddb-20171122_sim-20180530-vc-md100.bin 8 +muon_common_hits/7046998_9701.bin 16472 +muon_common_hits/7046998_9702.bin 14756 +muon_common_hits/7046998_9703.bin 6264 +muon_common_hits/7046998_9704.bin 8200 +muon_common_hits/7046998_9705.bin 5604 +muon_common_hits/7046998_9706.bin 21356 +muon_common_hits/7046998_9707.bin 11412 +muon_common_hits/7046998_9708.bin 6352 +muon_common_hits/7046998_9709.bin 6704 +muon_common_hits/7046998_9710.bin 27120 +muon_common_hits/7046998_9711.bin 12952 +muon_common_hits/7046998_9712.bin 17880 +muon_common_hits/7046998_9713.bin 5912 +muon_common_hits/7046998_9714.bin 8024 +muon_common_hits/7046998_9715.bin 15020 +muon_common_hits/7046998_9716.bin 7232 +muon_common_hits/7046998_9717.bin 15592 +muon_common_hits/7046998_9718.bin 19112 +muon_common_hits/7046998_9719.bin 30596 +muon_common_hits/7046998_9720.bin 10224 +muon_common_hits/7046998_9721.bin 3448 +muon_common_hits/7046998_9722.bin 5516 +muon_common_hits/7046998_9723.bin 8948 +muon_common_hits/7046998_9724.bin 10136 +muon_common_hits/7046998_9725.bin 17132 +muon_common_hits/7046998_9726.bin 26064 +muon_common_hits/7046998_9727.bin 8200 +muon_common_hits/7046998_9728.bin 10180 +muon_common_hits/7046998_9729.bin 7540 +muon_common_hits/7046998_9730.bin 10312 +muon_common_hits/7046998_9731.bin 9344 +muon_common_hits/7046998_9732.bin 16340 +muon_common_hits/7046998_9733.bin 11764 +muon_common_hits/7046998_9734.bin 9168 +muon_common_hits/7046998_9735.bin 10004 +muon_common_hits/7046998_9736.bin 7056 +muon_common_hits/7046998_9737.bin 30992 +muon_common_hits/7046998_9738.bin 5868 +muon_common_hits/7046998_9739.bin 9080 +muon_common_hits/7046998_9740.bin 21356 +muon_common_hits/7046998_9741.bin 15152 +muon_common_hits/7046998_9742.bin 15240 +muon_common_hits/7046998_9743.bin 14536 +muon_common_hits/7046998_9744.bin 6528 +muon_common_hits/7046998_9745.bin 15944 +muon_common_hits/7046998_9746.bin 4636 +muon_common_hits/7046998_9747.bin 4768 +muon_common_hits/7046998_9748.bin 4724 +muon_common_hits/7046998_9749.bin 2876 +muon_common_hits/7046998_9750.bin 6528 +muon_coords/7046998_9701.bin 7184 +muon_coords/7046998_9702.bin 6540 +muon_coords/7046998_9703.bin 2636 +muon_coords/7046998_9704.bin 3504 +muon_coords/7046998_9705.bin 2372 +muon_coords/7046998_9706.bin 9356 +muon_coords/7046998_9707.bin 4972 +muon_coords/7046998_9708.bin 2784 +muon_coords/7046998_9709.bin 2720 +muon_coords/7046998_9710.bin 11936 +muon_coords/7046998_9711.bin 5580 +muon_coords/7046998_9712.bin 7868 +muon_coords/7046998_9713.bin 2528 +muon_coords/7046998_9714.bin 3368 +muon_coords/7046998_9715.bin 6692 +muon_coords/7046998_9716.bin 3116 +muon_coords/7046998_9717.bin 6844 +muon_coords/7046998_9718.bin 8412 +muon_coords/7046998_9719.bin 13704 +muon_coords/7046998_9720.bin 4508 +muon_coords/7046998_9721.bin 1468 +muon_coords/7046998_9722.bin 2396 +muon_coords/7046998_9723.bin 3920 +muon_coords/7046998_9724.bin 4420 +muon_coords/7046998_9725.bin 7360 +muon_coords/7046998_9726.bin 11264 +muon_coords/7046998_9727.bin 3424 +muon_coords/7046998_9728.bin 4476 +muon_coords/7046998_9729.bin 3216 +muon_coords/7046998_9730.bin 4536 +muon_coords/7046998_9731.bin 4060 +muon_coords/7046998_9732.bin 7244 +muon_coords/7046998_9733.bin 5256 +muon_coords/7046998_9734.bin 3852 +muon_coords/7046998_9735.bin 4264 +muon_coords/7046998_9736.bin 3016 +muon_coords/7046998_9737.bin 13836 +muon_coords/7046998_9738.bin 2512 +muon_coords/7046998_9739.bin 3916 +muon_coords/7046998_9740.bin 9404 +muon_coords/7046998_9741.bin 6560 +muon_coords/7046998_9742.bin 6708 +muon_coords/7046998_9743.bin 6264 +muon_coords/7046998_9744.bin 2768 +muon_coords/7046998_9745.bin 6992 +muon_coords/7046998_9746.bin 1932 +muon_coords/7046998_9747.bin 2072 +muon_coords/7046998_9748.bin 1892 +muon_coords/7046998_9749.bin 1252 +muon_coords/7046998_9750.bin 2868 +scifi_hits/7046998_9701.bin 270616 +scifi_hits/7046998_9702.bin 304696 +scifi_hits/7046998_9703.bin 80176 +scifi_hits/7046998_9704.bin 86776 +scifi_hits/7046998_9705.bin 82096 +scifi_hits/7046998_9706.bin 230056 +scifi_hits/7046998_9707.bin 178256 +scifi_hits/7046998_9708.bin 113576 +scifi_hits/7046998_9709.bin 133216 +scifi_hits/7046998_9710.bin 278016 +scifi_hits/7046998_9711.bin 175896 +scifi_hits/7046998_9712.bin 191216 +scifi_hits/7046998_9713.bin 58656 +scifi_hits/7046998_9714.bin 80336 +scifi_hits/7046998_9715.bin 144456 +scifi_hits/7046998_9716.bin 116016 +scifi_hits/7046998_9717.bin 267296 +scifi_hits/7046998_9718.bin 198256 +scifi_hits/7046998_9719.bin 135496 +scifi_hits/7046998_9720.bin 206816 +scifi_hits/7046998_9721.bin 97496 +scifi_hits/7046998_9722.bin 84536 +scifi_hits/7046998_9723.bin 121336 +scifi_hits/7046998_9724.bin 205336 +scifi_hits/7046998_9725.bin 235976 +scifi_hits/7046998_9726.bin 260216 +scifi_hits/7046998_9727.bin 83976 +scifi_hits/7046998_9728.bin 147016 +scifi_hits/7046998_9729.bin 138336 +scifi_hits/7046998_9730.bin 165136 +scifi_hits/7046998_9731.bin 197736 +scifi_hits/7046998_9732.bin 330016 +scifi_hits/7046998_9733.bin 105216 +scifi_hits/7046998_9734.bin 176416 +scifi_hits/7046998_9735.bin 241576 +scifi_hits/7046998_9736.bin 123856 +scifi_hits/7046998_9737.bin 303616 +scifi_hits/7046998_9738.bin 101816 +scifi_hits/7046998_9739.bin 170376 +scifi_hits/7046998_9740.bin 446816 +scifi_hits/7046998_9741.bin 270656 +scifi_hits/7046998_9742.bin 364296 +scifi_hits/7046998_9743.bin 254496 +scifi_hits/7046998_9744.bin 93776 +scifi_hits/7046998_9745.bin 203936 +scifi_hits/7046998_9746.bin 79296 +scifi_hits/7046998_9747.bin 165896 +scifi_hits/7046998_9748.bin 72136 +scifi_hits/7046998_9749.bin 62856 +scifi_hits/7046998_9750.bin 112456 +ut_hits/7046998_9701.bin 81952 +ut_hits/7046998_9702.bin 73096 +ut_hits/7046998_9703.bin 17980 +ut_hits/7046998_9704.bin 11824 +ut_hits/7046998_9705.bin 18124 +ut_hits/7046998_9706.bin 48688 +ut_hits/7046998_9707.bin 46564 +ut_hits/7046998_9708.bin 26620 +ut_hits/7046998_9709.bin 19348 +ut_hits/7046998_9710.bin 84544 +ut_hits/7046998_9711.bin 32200 +ut_hits/7046998_9712.bin 44872 +ut_hits/7046998_9713.bin 8440 +ut_hits/7046998_9714.bin 15064 +ut_hits/7046998_9715.bin 26620 +ut_hits/7046998_9716.bin 27988 +ut_hits/7046998_9717.bin 58120 +ut_hits/7046998_9718.bin 44728 +ut_hits/7046998_9719.bin 43324 +ut_hits/7046998_9720.bin 71548 +ut_hits/7046998_9721.bin 16180 +ut_hits/7046998_9722.bin 11896 +ut_hits/7046998_9723.bin 24100 +ut_hits/7046998_9724.bin 49300 +ut_hits/7046998_9725.bin 50056 +ut_hits/7046998_9726.bin 62116 +ut_hits/7046998_9727.bin 11932 +ut_hits/7046998_9728.bin 36952 +ut_hits/7046998_9729.bin 23380 +ut_hits/7046998_9730.bin 33676 +ut_hits/7046998_9731.bin 49840 +ut_hits/7046998_9732.bin 63628 +ut_hits/7046998_9733.bin 25468 +ut_hits/7046998_9734.bin 30544 +ut_hits/7046998_9735.bin 64276 +ut_hits/7046998_9736.bin 29680 +ut_hits/7046998_9737.bin 87568 +ut_hits/7046998_9738.bin 24856 +ut_hits/7046998_9739.bin 31588 +ut_hits/7046998_9740.bin 128068 +ut_hits/7046998_9741.bin 75364 +ut_hits/7046998_9742.bin 92176 +ut_hits/7046998_9743.bin 59920 +ut_hits/7046998_9744.bin 14884 +ut_hits/7046998_9745.bin 56104 +ut_hits/7046998_9746.bin 9448 +ut_hits/7046998_9747.bin 32272 +ut_hits/7046998_9748.bin 7072 +ut_hits/7046998_9749.bin 14920 +ut_hits/7046998_9750.bin 21832 diff --git a/bindings/.gaudi_project_ignore b/bindings/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/checker/.gaudi_project_ignore b/checker/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/checker/pv/CMakeLists.txt b/checker/pv/CMakeLists.txt index 5f11a9eb4d8..cd40ac73b86 100644 --- a/checker/pv/CMakeLists.txt +++ b/checker/pv/CMakeLists.txt @@ -7,7 +7,7 @@ include_directories(${CMAKE_SOURCE_DIR}/cuda/event_model/velo/include) include_directories(${CMAKE_SOURCE_DIR}/cuda/event_model/common/include) include_directories(${CMAKE_SOURCE_DIR}/cuda/UT/PrVeloUT/include) include_directories(${CMAKE_SOURCE_DIR}/cuda/PV/beamlinePV/include) -include_directories(${ROOT_INCLUDE_DIRS}) +include_directories(SYSTEM ${ROOT_INCLUDE_DIRS}) file(GLOB pv_checker_sources "src/*cpp") diff --git a/checker/selections/CMakeLists.txt b/checker/selections/CMakeLists.txt index bd6c667b376..fd277e4a13e 100644 --- a/checker/selections/CMakeLists.txt +++ b/checker/selections/CMakeLists.txt @@ -2,7 +2,7 @@ include_directories(include) include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) include_directories(${CMAKE_SOURCE_DIR}/main/include) include_directories(${CMAKE_SOURCE_DIR}/cuda/UT/PrVeloUT/include) -include_directories(${ROOT_INCLUDE_DIRS}) +include_directories(SYSTEM ${ROOT_INCLUDE_DIRS}) file(GLOB selection_checker_sources "src/*cpp") diff --git a/checker/tracking/CMakeLists.txt b/checker/tracking/CMakeLists.txt index fa931478c6a..1ce93ce0b2e 100644 --- a/checker/tracking/CMakeLists.txt +++ b/checker/tracking/CMakeLists.txt @@ -13,7 +13,7 @@ include_directories(${CMAKE_SOURCE_DIR}/cuda/SciFi/PrForward/include) include_directories(${CMAKE_SOURCE_DIR}/cuda/kalman/ParKalman/include) include_directories(${CMAKE_SOURCE_DIR}/cuda/PV/common/include) include_directories(${CMAKE_SOURCE_DIR}/cuda/PV/beamlinePV/include) -include_directories(${ROOT_INCLUDE_DIRS}) +include_directories(SYSTEM ${ROOT_INCLUDE_DIRS}) file(GLOB tracking_checker_sources "src/*cpp") diff --git a/configuration/.gaudi_project_ignore b/configuration/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cuda/.gaudi_project_ignore b/cuda/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cuda/PV/beamlinePV/CMakeLists.txt b/cuda/PV/beamlinePV/CMakeLists.txt index 8484b2e2524..7579740b0b1 100644 --- a/cuda/PV/beamlinePV/CMakeLists.txt +++ b/cuda/PV/beamlinePV/CMakeLists.txt @@ -20,7 +20,7 @@ add_library(PV_beamline STATIC if(ROOT_FOUND) add_library(PV_monitoring STATIC src/pv_beamline_monitoring.cpp) target_compile_definitions(PV_monitoring PRIVATE ${ALLEN_ROOT_DEFINITIONS}) - target_include_directories(PV_monitoring BEFORE PRIVATE + target_include_directories(PV_monitoring SYSTEM BEFORE PRIVATE ${ROOT_INCLUDE_DIRS}) target_link_libraries(PV_beamline PRIVATE PV_monitoring) endif() diff --git a/cuda/PV/beamlinePV/src/pv_beamline_monitoring.cpp b/cuda/PV/beamlinePV/src/pv_beamline_monitoring.cpp index 042133b8415..0b42799f37e 100644 --- a/cuda/PV/beamlinePV/src/pv_beamline_monitoring.cpp +++ b/cuda/PV/beamlinePV/src/pv_beamline_monitoring.cpp @@ -9,7 +9,7 @@ void pv_beamline_monitor(uint n_events, float* zhisto) { // Check the output TFile output{"testt.root","RECREATE"}; TTree outtree{"PV","PV"}; - int i_event = 0; + uint i_event = 0; outtree.Branch("event",&i_event); float z_histo; diff --git a/cuda/PV/patPV/CMakeLists.txt b/cuda/PV/patPV/CMakeLists.txt index 977d5d67386..4268468b4a1 100644 --- a/cuda/PV/patPV/CMakeLists.txt +++ b/cuda/PV/patPV/CMakeLists.txt @@ -14,8 +14,8 @@ include_directories(${CMAKE_SOURCE_DIR}/cuda/PV/beamlinePV/include) file(GLOB pat_pv "src/*cu") -add_library(PatPV STATIC +add_library(AllenPatPV STATIC ${pat_pv} ) -set_property(TARGET PatPV PROPERTY +set_property(TARGET AllenPatPV PROPERTY CUDA_SEPARABLE_COMPILATION ON) diff --git a/integration/.gaudi_project_ignore b/integration/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/integration/non_event_data/CMakeLists.txt b/integration/non_event_data/CMakeLists.txt index f71b3d37713..9dda86e3480 100644 --- a/integration/non_event_data/CMakeLists.txt +++ b/integration/non_event_data/CMakeLists.txt @@ -1,5 +1,5 @@ file(GLOB SOURCES "src/*.cpp") -add_library(NonEventData ${SOURCES}) +add_library(NonEventData STATIC ${SOURCES}) target_include_directories(NonEventData PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) target_include_directories(NonEventData PUBLIC diff --git a/main/.gaudi_project_ignore b/main/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/mdf/.gaudi_project_ignore b/mdf/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/stream/.gaudi_project_ignore b/stream/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/stream/CMakeLists.txt b/stream/CMakeLists.txt index 79b59cde8a4..8d35a006c11 100644 --- a/stream/CMakeLists.txt +++ b/stream/CMakeLists.txt @@ -139,7 +139,7 @@ target_link_libraries(Stream PRIVATE IPCut GlobalEventCut Velo - PatPV + AllenPatPV PV_beamline x86Clustering x86beamlinePV @@ -163,7 +163,7 @@ set_property(TARGET Stream PROPERTY if (ROOT_FOUND) target_compile_definitions(Stream PUBLIC ${ALLEN_ROOT_DEFINITIONS}) - target_include_directories(Stream BEFORE PRIVATE + target_include_directories(Stream SYSTEM BEFORE PRIVATE ${ROOT_INCLUDE_DIRS} ) endif() diff --git a/tests/.gaudi_project_ignore b/tests/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/x86/.gaudi_project_ignore b/x86/.gaudi_project_ignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/x86/SciFi/PrForward/CMakeLists.txt b/x86/SciFi/PrForward/CMakeLists.txt index 45de4aada34..bcf26b353ce 100644 --- a/x86/SciFi/PrForward/CMakeLists.txt +++ b/x86/SciFi/PrForward/CMakeLists.txt @@ -34,7 +34,7 @@ set_property(TARGET x86Forward PROPERTY if ( ROOT_FOUND ) target_compile_definitions(x86Forward PUBLIC WITH_ROOT) - target_include_directories(x86Forward BEFORE PRIVATE + target_include_directories(x86Forward SYSTEM BEFORE PRIVATE ${ROOT_INCLUDE_DIRS} ) endif() diff --git a/x86/muon/decoding/CMakeLists.txt b/x86/muon/decoding/CMakeLists.txt index 9cfab8fbf66..84fc681077b 100644 --- a/x86/muon/decoding/CMakeLists.txt +++ b/x86/muon/decoding/CMakeLists.txt @@ -16,5 +16,5 @@ set_property(TARGET x86MuonDecoding PROPERTY if ( ROOT_FOUND ) target_compile_definitions(x86MuonDecoding PUBLIC WITH_ROOT) - target_include_directories(x86MuonDecoding BEFORE PRIVATE ${ROOT_INCLUDE_DIRS}) + target_include_directories(x86MuonDecoding SYSTEM BEFORE PRIVATE ${ROOT_INCLUDE_DIRS}) endif() -- GitLab