Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • laolivei/Allen
  • pvfinder/inference-engine
  • rmatev/Allen
  • suali/Allen
  • mstahl/Allen
  • roneil/Allen
  • graemes/Allen
  • cburr/Allen
  • jonrob/Allen
  • bjashal/Allen-HIP
  • dcampora/MiniAllen
  • brij/Allen
  • raaij/cuda_hlt
  • bsm-fleet/cuda_hlt
  • abrearod/cuda_hlt
  • aalvesju/cuda_hlt
  • lhcb/Allen
17 results
Show changes
Commits on Source (217)
Showing
with 764 additions and 194 deletions
......@@ -274,7 +274,7 @@ if(TARGET_DEVICE STREQUAL "CPU")
add_library(${ARGV})
add_library(Allen::${ARGV0} ALIAS ${ARGV0})
target_compile_definitions(${ARGV0} PRIVATE ${TARGET_DEFINITION})
target_compile_definitions(${ARGV0} PRIVATE ${TARGET_DEFINITION} ODIN_WITHOUT_GAUDI)
install(TARGETS ${ARGV0}
EXPORT Allen
LIBRARY DESTINATION lib)
......@@ -298,7 +298,7 @@ if(TARGET_DEVICE STREQUAL "CPU")
endif()
add_library(Allen::${ARGV0} ALIAS ${ARGV0})
target_compile_definitions(${ARGV0} PRIVATE ${TARGET_DEFINITION})
target_compile_definitions(${ARGV0} PRIVATE ${TARGET_DEFINITION} ODIN_WITHOUT_GAUDI)
install(TARGETS ${ARGV0}
EXPORT Allen
DESTINATION ${destination})
......@@ -371,7 +371,7 @@ elseif(TARGET_DEVICE STREQUAL "HIP")
add_library(Allen::${ARGV0} ALIAS ${ARGV0})
target_include_directories(${ARGV0} PRIVATE ${HIP_PATH}/include ${ROCM_PATH}/hsa/include)
target_compile_definitions(${ARGV0} PRIVATE ${TARGET_DEFINITION})
target_compile_definitions(${ARGV0} PRIVATE ${TARGET_DEFINITION} ODIN_WITHOUT_GAUDI)
install(TARGETS ${ARGV0}
EXPORT Allen
......@@ -385,7 +385,6 @@ elseif(TARGET_DEVICE STREQUAL "HIP")
install(TARGETS ${ARGV0} RUNTIME DESTINATION bin)
endfunction()
elseif(TARGET_DEVICE STREQUAL "CUDA")
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG --generate-line-info")
......@@ -400,8 +399,11 @@ elseif(TARGET_DEVICE STREQUAL "CUDA")
set(CUDA_VERBOSE_FLAGS "")
endif()
string(REGEX REPLACE "toolchain/.*" "toolchain" CXX_COMPILER_DIR ${CMAKE_CXX_COMPILER})
string(APPEND CMAKE_CUDA_FLAGS " ${DEVICE_ARCHITECTURE} -ccbin=${CXX_COMPILER_DIR} ${CUDA_TOOLCHAIN_OPTIONS} -Xcudafe --display_error_number --use_fast_math --expt-relaxed-constexpr ${CUDA_VERBOSE_FLAGS}")
string(APPEND CMAKE_CUDA_FLAGS " ${DEVICE_ARCHITECTURE} ${CUDA_TOOLCHAIN_OPTIONS} -Xcudafe --display_error_number --use_fast_math --expt-relaxed-constexpr ${CUDA_VERBOSE_FLAGS}")
if (NOT CMAKE_CUDA_HOST_COMPILER)
string(REGEX REPLACE "toolchain/.*" "toolchain" CXX_COMPILER_DIR ${CMAKE_CXX_COMPILER})
string(APPEND CMAKE_CUDA_FLAGS " -ccbin=${CXX_COMPILER_DIR} ")
endif()
message(STATUS "CMAKE CUDA FLAGS:" ${CMAKE_CUDA_FLAGS})
message(STATUS "Detected CUDA include directory: " ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
......@@ -420,7 +422,7 @@ elseif(TARGET_DEVICE STREQUAL "CUDA")
set_property(TARGET ${ARGV0} PROPERTY CUDA_SEPARABLE_COMPILATION ON)
endif()
target_include_directories(${ARGV0} PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} ${PROJECT_BINARY_DIR}/code_generation)
target_compile_definitions(${ARGV0} PRIVATE ${TARGET_DEFINITION})
target_compile_definitions(${ARGV0} PRIVATE ${TARGET_DEFINITION} ODIN_WITHOUT_GAUDI)
add_library(Allen::${ARGV0} ALIAS ${ARGV0})
install(TARGETS ${ARGV0}
EXPORT Allen
......@@ -605,6 +607,7 @@ foreach(header
InputProvider.h
OutputHandler.h
SliceUtils.h
FileSystem.h
TransposeTypes.h)
list(APPEND AllenHeaders main/include/${header})
endforeach()
......@@ -637,7 +640,6 @@ message(STATUS "CMAKE CXX FLAGS: " ${CMAKE_CXX_FLAGS})
# Add host library
allen_add_host_library(HostCommon STATIC
main/src/BankTypes.cpp
main/src/CheckVP.cpp
main/src/InputReader.cpp
main/src/InputTools.cpp
main/src/Logger.cpp
......@@ -649,9 +651,9 @@ allen_add_host_library(HostCommon STATIC
main/src/Transpose.cpp)
target_link_libraries(AllenCommon INTERFACE
mdf AllenFS nlohmann_json::nlohmann_json cppgsl::cppgsl)
LHCbEvent AllenFS nlohmann_json::nlohmann_json cppgsl::cppgsl)
target_link_libraries(HostCommon PRIVATE
EventModel Gear Backend mdf NonEventData AllenCommon LHCbEvent Boost::iostreams)
mdf EventModel Gear Backend mdf NonEventData AllenCommon LHCbEvent Boost::iostreams)
allen_add_host_library(AllenLib SHARED
main/src/Allen.cpp
......@@ -661,30 +663,31 @@ allen_add_host_library(AllenLib SHARED
main/src/RegisterConsumers.cpp
main/src/ZMQOutputSender.cpp)
target_compile_definitions(AllenLib PUBLIC ${TARGET_DEFINITION})
target_link_libraries(AllenLib PUBLIC
Stream
HostCommon
AllenCommon
HostEventModel
TrackChecking
PVChecking
CheckClustering
SelChecking
Monitoring
NonEventData
AllenZMQ
HostCombiners
Threads::Threads
Backend
EventModel
Gear
mdf
LHCbEvent
${CMAKE_DL_LIBS})
target_link_libraries(AllenLib
PRIVATE
Backend
Stream
HostCommon
HostEventModel
NonEventData
TrackChecking
PVChecking
CheckClustering
SelChecking
Monitoring
HostCombiners
EventModel
Gear
mdf
LHCbEvent
PUBLIC
AllenCommon
AllenRuntime
Threads::Threads
AllenZMQ
${CMAKE_DL_LIBS})
# To propagate filesystem includes/libs
target_link_libraries(AllenLib PRIVATE AllenFS)
......@@ -700,7 +703,7 @@ endif()
allen_add_executable(Allen main/src/main.cpp)
target_link_libraries(Allen PRIVATE AllenLib)
target_link_libraries(Allen PRIVATE AllenLib NonEventData)
if (NOT STANDALONE)
target_link_libraries(Allen PRIVATE fmt::fmt)
......@@ -717,7 +720,7 @@ if (STANDALONE)
find_package(Git REQUIRED)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/input/PARAM/")
SET(PARAMFILESROOT "${CMAKE_CURRENT_SOURCE_DIR}/input/PARAM/ParamFiles/")
add_custom_command(
add_custom_command(
OUTPUT "${PARAMFILESROOT}"
COMMENT "Checking out parameterization files from the LHCb stack"
COMMAND
......@@ -729,4 +732,3 @@ if (STANDALONE)
add_compile_definitions(PARAMFILESROOTPATH=${PARAMFILESROOT})
message(STATUS "PARAMFILESROOT set to ${PARAMFILESROOT}")
endif()
......@@ -5,14 +5,16 @@
# Package: BinaryDumpers
################################################################################
gaudi_add_library(BinaryDumpers
SOURCES
src/lib/TestUTBoards.cpp
src/lib/Utils.cpp
LINK PUBLIC
AllenCommon
Gaudi::GaudiKernel
LHCb::DAQEventLib
LHCb::MagnetLib
LHCb::FTDetLib
LHCb::MuonDAQLib)
gaudi_add_module(BinaryDumpersModule
......@@ -36,8 +38,10 @@ gaudi_add_module(BinaryDumpersModule
src/PVDumper.cpp
src/TestMuonTable.cpp
src/TransposeRawBanks.cpp
src/TESProducer.cpp
LINK
Rangev3::rangev3
TBB::tbb
Gaudi::GaudiAlgLib
LHCb::AssociatorsBase
LHCb::LinkerEvent
......@@ -51,6 +55,7 @@ gaudi_add_module(BinaryDumpersModule
LHCb::FTDetLib
LHCb::MuonDAQLib
Rec::PrKernel
yaml-cpp
BinaryDumpers)
gaudi_add_tests(QMTest)
......@@ -9,6 +9,8 @@
#include <string>
#include <vector>
#include <Event/ODIN.h>
#include "Identifiers.h"
namespace Allen {
......@@ -79,7 +81,7 @@ namespace Allen {
*
* @return void
*/
virtual void update(unsigned long run) = 0;
virtual void update(gsl::span<unsigned const> odin_data) = 0;
/**
* @brief Register a consumer for that will consume binary non-event
......
......@@ -16,13 +16,7 @@
#include <type_traits>
#include <vector>
template<class Tuple, class F>
void for_each(Tuple&& tup, F&& f)
{
std::apply(
[f = std::forward<F>(f)](auto&&... args) { (std::invoke(f, std::forward<decltype(args)>(args)), ...); },
std::forward<Tuple>(tup));
}
#include <Common.h>
template<class T>
void optional_resize(T&, size_t)
......
......@@ -2,14 +2,17 @@
###############################################################################
# (c) Copyright 2018-2021 CERN for the benefit of the LHCb Collaboration #
###############################################################################
import os
from GaudiPython.Bindings import AppMgr, gbl
from Configurables import LHCbApp, CondDB, ApplicationMgr
import os, sys
from Configurables import ApplicationMgr
from Configurables import Gaudi__RootCnvSvc as RootCnvSvc
from Allen.config import setup_allen_non_event_data_service
from PyConf.application import (configure, setup_component, ComponentConfig,
ApplicationOptions)
from threading import Thread
from time import sleep
import ctypes
import argparse
from GaudiPython.Bindings import AppMgr, gbl
# Load Allen entry point and helpers
gbl.gSystem.Load("libAllenLib")
......@@ -25,7 +28,7 @@ interpreter.Declare("#include <Allen/Provider.h>")
interpreter.Declare("#include <Dumpers/PyAllenHelper.h>")
sequence_default = os.path.join(os.environ['ALLEN_INSTALL_DIR'], 'constants',
'hlt1_pp_default')
'hlt1_pp_default.json')
def cast_service(return_type, svc):
......@@ -57,6 +60,11 @@ parser.add_argument(
allen_dir, "input", "minbias", "mdf",
"MiniBrunel_2018_MinBias_FTv4_DIGI_retinacluster_v1.mdf"))
parser.add_argument("--mep", dest="mep", default=None)
parser.add_argument(
"--mep-mask-source-id-top-5",
action="store_true",
dest="mask_top5",
default=False)
parser.add_argument(
"--reuse-meps",
action="store_true",
......@@ -79,6 +87,8 @@ parser.add_argument(
help="Add profiler start and stop calls",
)
parser.add_argument("--output-file", dest="output_file", default=None)
parser.add_argument(
"--output-batch-size", dest="output_batch_size", default=10)
parser.add_argument(
"--monitoring-save-period", dest="mon_save_period", default=0)
parser.add_argument(
......@@ -106,52 +116,53 @@ parser.add_argument(
default=300,
help="How long to run when reusing MEPs",
)
parser.add_argument(
"--tags", dest="tags", default="dddb-20171122,sim-20180530-vc-md100")
args = parser.parse_args()
# default_configuration = os.path.join(os.environ['ALLEN_INSTALL_DIR'],
# 'constants' + args.sequence + '.json')
runtime_lib = None
if args.profile == "CUDA":
runtime_lib = ctypes.CDLL("libcudart.so")
app = LHCbApp(
DataType="Upgrade",
EvtMax=1000,
Simulation=True,
DDDBtag="dddb-20171122",
CondDBtag="sim-20180530-vc-md100")
# DDDBtag="dddb-20210617", # tags for FEST sample from 10/2021
# CondDBtag="sim-20210617-vc-md100")
dddb_tag, conddb_tag = args.tags.split(',')
# Upgrade DBs
CondDB().Upgrade = True
options = ApplicationOptions(_enabled=False)
options.simulation = True
options.data_type = 'Upgrade'
options.input_type = 'MDF'
options.dddb_tag = dddb_tag
options.conddb_tag = conddb_tag
setup_allen_non_event_data_service()
options.finalize()
config = ComponentConfig()
# Some extra stuff for timing table
ApplicationMgr().EvtSel = "NONE"
ApplicationMgr().ExtSvc += ["ToolSvc", "AuditorSvc", "ZeroMQSvc"]
extSvc = ["ToolSvc", "AuditorSvc", "ZeroMQSvc"]
# RootCnvSvc becauce it sets up a bunch of ROOT IO stuff
rootSvc = RootCnvSvc("RootCnvSvc", EnableIncident=1)
ApplicationMgr().ExtSvc += ["Gaudi::IODataManager/IODataManager", rootSvc]
if args.mep is not None:
ApplicationMgr().ExtSvc += ["AllenConfiguration", "MEPProvider"]
extSvc += ["AllenConfiguration", "MEPProvider"]
from Configurables import MEPProvider, AllenConfiguration
allen_conf = AllenConfiguration("AllenConfiguration")
allen_conf.JSON = args.sequence
allen_conf.OutputLevel = 2
allen_conf.OutputLevel = 3
mep_provider = MEPProvider()
mep_provider.NSlices = args.slices
mep_provider.EventsPerSlice = args.events_per_slice
mep_provider.OutputLevel = 2
mep_provider.OutputLevel = 3
# Number of MEP buffers and number of transpose/offset threads
mep_provider.BufferConfig = (10, 8)
mep_provider.TransposeMEPs = False
mep_provider.SplitByRun = False
mep_provider.Source = "Files"
mep_dir = args.mep
mep_provider.MaskSourceIDTop5 = args.mask_top5
mep_dir = os.path.expandvars(args.mep)
if os.path.isdir(mep_dir):
mep_provider.Connections = sorted([
os.path.join(mep_dir, mep_file) for mep_file in os.listdir(mep_dir)
......@@ -167,9 +178,30 @@ if args.mep is not None:
# mep_provider.BufferNUMA = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
mep_provider.EvtMax = -1 if args.n_events == 0 else args.n_events
ApplicationMgr().EvtSel = "NONE"
ApplicationMgr().ExtSvc += extSvc
# Copeid from PyConf.application.configure_input
config.add(
setup_component(
'DDDBConf', Simulation=options.simulation, DataType=options.data_type))
config.add(
setup_component(
'CondDB',
Upgrade=True,
Tags={
'DDDB': options.dddb_tag,
'SIMCOND': options.conddb_tag,
}))
cf_node = setup_allen_non_event_data_service(allen_event_loop=True)
config.update(configure(options, cf_node))
# Start Gaudi and get the AllenUpdater service
gaudi = AppMgr()
gaudi.initialize()
sc = gaudi.initialize()
if not sc.isSuccess():
sys.exit("Failed to initialize AppMgr")
svc = gaudi.service("AllenUpdater", interface=gbl.IService)
zmqSvc = gaudi.service("ZeroMQSvc", interface=gbl.IZeroMQSvc)
......@@ -181,10 +213,11 @@ for flag, value in [("g", args.det_folder),
("params", os.getenv("PARAMFILESROOT")),
("n", args.n_events), ("t", args.threads),
("r", args.repetitions), ("output-file", args.output_file),
("output-batch-size", args.output_batch_size),
("m", args.reserve), ("v", args.verbosity),
("p", args.print_memory),
("sequence", os.path.expandvars(args.sequence)),
("s", args.slices), ("mdf", args.mdf),
("s", args.slices), ("mdf", os.path.expandvars(args.mdf)),
("cpu-offload", args.cpu_offload),
("disable-run-changes", int(not args.enable_run_changes)),
("monitoring-save-period", args.mon_save_period),
......
......@@ -5,6 +5,8 @@
#include <memory>
#include <optional>
#include <string>
#include <thread>
#include <chrono>
#include "AllenUpdater.h"
#include <Dumpers/Identifiers.h>
......@@ -20,6 +22,55 @@ namespace {
DECLARE_COMPONENT(AllenUpdater)
/// Query interfaces of Interface
StatusCode AllenUpdater::queryInterface(const InterfaceID& riid, void** ppv)
{
if (AllenUpdater::interfaceID().versionMatch(riid)) {
*ppv = this;
addRef();
return StatusCode::SUCCESS;
}
return Service::queryInterface(riid, ppv);
}
StatusCode AllenUpdater::initialize()
{
if (m_triggerEventLoop.value()) {
m_evtProc = serviceLocator()->service<Gaudi::Interfaces::IQueueingEventProcessor>("ApplicationMgr");
if (!m_evtProc) {
error() << "Failed to obtain ApplicationMgr as IQueueingEventProcessor" << endmsg;
return StatusCode::FAILURE;
}
}
return StatusCode::SUCCESS;
}
StatusCode AllenUpdater::start()
{
auto sc = Service::start();
if (!sc.isSuccess()) return sc;
if (m_triggerEventLoop.value()) {
m_taskArena = std::make_unique<tbb::task_arena>(2, 1);
}
return sc;
}
StatusCode AllenUpdater::stop()
{
if (m_taskArena) {
// this is our "threads.join()" alternative
while (!m_evtProc->empty())
std::this_thread::sleep_for(std::chrono::milliseconds(100));
m_taskArena->terminate(); // non blocking
m_taskArena.reset();
}
return Service::stop();
}
void AllenUpdater::registerConsumer(string const& id, unique_ptr<Allen::NonEventData::Consumer> c)
{
auto it = m_pairs.find(id);
......@@ -55,11 +106,23 @@ void AllenUpdater::registerProducer(string const& id, Allen::NonEventData::Produ
}
}
void AllenUpdater::update(unsigned long time)
void AllenUpdater::update(gsl::span<unsigned const> odin_data)
{
if (msgLevel(MSG::DEBUG)) {
debug() << "Running Update " << time << endmsg;
{
std::unique_lock {m_odinMutex};
LHCb::ODIN odin {odin_data};
if (m_odin && m_odin->runNumber() == odin.runNumber()) {
return;
}
else if (msgLevel(MSG::DEBUG)) {
debug() << "Running Update " << odin.runNumber() << endmsg;
}
// Store ODIN so it can be retrieved and then inserted into the event store
m_odin = std::move(odin);
}
// Check if all consumers have a producer
for (auto const& entry : m_pairs) {
auto const& id = std::get<0>(entry);
auto const& p = std::get<1>(entry);
......@@ -71,6 +134,21 @@ void AllenUpdater::update(unsigned long time)
debug() << "No consumers for " << id << endmsg;
}
}
// Run the "fake" event loop to produce the new data
if (m_triggerEventLoop.value()) {
EventContext ctx(m_evtProc->createEventContext());
m_evtProc->push(std::move(ctx));
auto result = m_evtProc->pop();
for (; !result; result = m_evtProc->pop())
std::this_thread::sleep_for(std::chrono::milliseconds(10));
auto&& [sc, context] = std::move(*result);
if (!sc.isSuccess()) {
throw GaudiException {"Failed to process event for conditions update", name(), StatusCode::FAILURE};
}
}
// Feed the consumers with the produced update
for (auto const& [id, pairs] : m_pairs) {
if (msgLevel(MSG::DEBUG)) {
debug() << "Updating " << id << endmsg;
......
......@@ -3,12 +3,19 @@
\*****************************************************************************/
#pragma once
#include <GaudiKernel/Service.h>
#include <map>
#include <memory>
#include <string>
#include <mutex>
#include <GaudiKernel/Service.h>
#include <Gaudi/Interfaces/IQueueingEventProcessor.h>
#include <Event/ODIN.h>
#include "Dumpers/IUpdater.h"
#include <Dumpers/IUpdater.h>
#include <tbb/task_arena.h>
/** @class AllenUpdater AllenUpdater.h
* LHCb implementation of the Allen non-event data manager
......@@ -18,8 +25,25 @@
*/
class AllenUpdater final : public Service, public Allen::NonEventData::IUpdater {
public:
/// Retrieve interface ID
static const InterfaceID& interfaceID()
{
// Declaration of the interface ID.
static const InterfaceID iid("AllenUpdater", 0, 0);
return iid;
}
/// Query interfaces of Interface
StatusCode queryInterface(const InterfaceID& riid, void** ppv) override;
AllenUpdater(std::string name, ISvcLocator* loc) : Service {name, loc} {}
StatusCode initialize() override;
StatusCode start() override;
StatusCode stop() override;
/**
* @brief Update all registered non-event data by calling all
* registered Producer and Consumer
......@@ -28,7 +52,7 @@ public:
*
* @return void
*/
void update(unsigned long run) override;
void update(gsl::span<unsigned const> odin) override;
/**
* @brief Register a consumer for that will consume binary non-event
......@@ -52,9 +76,20 @@ public:
*/
void registerProducer(std::string const& id, Allen::NonEventData::Producer p) override;
LHCb::ODIN odin() const { return m_odin ? *m_odin : LHCb::ODIN {}; }
private:
Gaudi::Property<bool> m_triggerEventLoop {this, "TriggerEventLoop", false};
std::map<
std::string,
std::tuple<Allen::NonEventData::Producer, std::vector<std::unique_ptr<Allen::NonEventData::Consumer>>>>
m_pairs;
std::unique_ptr<tbb::task_arena> m_taskArena;
SmartIF<Gaudi::Interfaces::IQueueingEventProcessor> m_evtProc;
std::mutex m_odinMutex;
std::optional<LHCb::ODIN> m_odin;
};
......@@ -4,23 +4,75 @@
#include <tuple>
#include <vector>
#include "DumpBeamline.h"
#include <yaml-cpp/yaml.h>
#include <LHCbAlgs/Transformer.h>
#include <DetDesc/GenericConditionAccessorHolder.h>
#include <Dumpers/Identifiers.h>
#include <Dumpers/Utils.h>
#ifdef USE_DD4HEP
#include <DD4hep/GrammarUnparsed.h>
#endif
namespace {
inline const std::string beamSpotCond = "/dd/Conditions/Online/Velo/MotionSystem";
struct Beamline_t {
double X = std::numeric_limits<double>::signaling_NaN();
double Y = std::numeric_limits<double>::signaling_NaN();
Beamline_t() {}
Beamline_t(YAML::Node const& n) :
X {(n["ResolPosRC"].as<double>() + n["ResolPosLA"].as<double>()) / 2}, Y {n["ResolPosY"].as<double>()}
{}
};
} // namespace
/** @class DumpBeamline
* Dump beamline position.
*
* @author Roel Aaij
* @date 2019-04-27
*/
class DumpBeamline final : public LHCb::Algorithm::MultiTransformer<
std::tuple<std::vector<char>, std::string>(const Beamline_t&),
LHCb::DetDesc::usesConditions<Beamline_t>> {
public:
DumpBeamline(const std::string& name, ISvcLocator* svcLoc);
std::tuple<std::vector<char>, std::string> operator()(const Beamline_t& beamline) const override;
StatusCode initialize() override;
Gaudi::Property<std::string> m_id {this, "ID", Allen::NonEventData::Beamline::id};
};
DECLARE_COMPONENT(DumpBeamline)
DumpUtils::Dumps DumpBeamline::dumpGeometry() const
DumpBeamline::DumpBeamline(const std::string& name, ISvcLocator* svcLoc) :
MultiTransformer(
name,
svcLoc,
{KeyValue {"BeamSpotLocation", "AlgorithmSpecific-" + name + "-beamspot"}},
{KeyValue {"Converted", "Allen/NonEventData/Beamspot"}, KeyValue {"OutputID", "Allen/NonEventData/BeamspotID"}})
{}
StatusCode DumpBeamline::initialize()
{
return MultiTransformer::initialize().andThen([&] {
addConditionDerivation(
{beamSpotCond}, inputLocation<Beamline_t>(), [](YAML::Node const& n) { return Beamline_t {n}; });
});
}
auto& cond = detector();
std::tuple<std::vector<char>, std::string> DumpBeamline::operator()(const Beamline_t& beamline) const
{
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);
output.write(beamline.X, beamline.Y);
return {{std::tuple {output.buffer(), "beamline", Allen::NonEventData::Beamline::id}}};
return std::tuple {output.buffer(), m_id};
}
/*****************************************************************************\
* (c) Copyright 2000-2019 CERN for the benefit of the LHCb Collaboration *
\*****************************************************************************/
#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
......@@ -8,18 +8,29 @@
* 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>
// LHCb
#include <Detector/Calo/CaloCellID.h>
#include <Detector/Calo/CaloCellCode.h>
#include "DumpCaloGeometry.h"
#include <Dumpers/Utils.h>
#include <CaloDet/DeCalorimeter.h>
// #include <DetDesc/Condition.h>
// #include <DetDesc/ConditionAccessorHolder.h>
// #include "DetDesc/IConditionDerivationMgr.h"
DECLARE_COMPONENT(DumpCaloGeometry)
#include <DetDesc/GenericConditionAccessorHolder.h>
// Gaudi
#include "GaudiAlg/Transformer.h"
// Allen
#include <Dumpers/Identifiers.h>
#include <Dumpers/Utils.h>
namespace {
const std::map<std::string, std::string> ids = {{"EcalDet", Allen::NonEventData::ECalGeometry::id},
......@@ -28,11 +39,51 @@ namespace {
constexpr unsigned max_neighbors = 9;
} // namespace
DumpUtils::Dumps DumpCaloGeometry::dumpGeometry() const
// Applies only to E Calorimeter
/** @class DumpCaloGeometry
* Dump Calo Geometry.
*
* @author Nabil Garroum
* This Class dumps geometry for SciFi using DD4HEP and Gaudi Algorithm
* This Class uses a condition derivation and a detector description
* This Class is basically an instation of a Gaudi algorithm with specific inputs and outputs:
* The role of this class is to get data from TES to Allen for the Calo
* @date 2022-02-14
*/
class DumpCaloGeometry final : public Gaudi::Functional::MultiTransformer<
std::tuple<std::vector<char>, std::string>(const DeCalorimeter&),
LHCb::DetDesc::usesConditions<DeCalorimeter>> {
public:
DumpCaloGeometry(const std::string& name, ISvcLocator* svcLoc);
std::tuple<std::vector<char>, std::string> operator()(const DeCalorimeter& DeCalorimeter) const override;
Gaudi::Property<std::string> m_id {
this,
"ID",
Allen::NonEventData::ECalGeometry::id}; // Ecalorimeter for Allen Namespace from Updater.cpp
};
DECLARE_COMPONENT(DumpCaloGeometry)
DumpCaloGeometry::DumpCaloGeometry(const std::string& name, ISvcLocator* svcLoc) :
MultiTransformer(
name,
svcLoc,
{KeyValue {"Location", DeCalorimeterLocation::Ecal}},
{KeyValue {"Converted", "Allen/NonEventData/ECal"}, KeyValue {"OutputID", "Allen/NonEventData/ECalID"}})
{}
// MultiTrasnformer algorithm with 1 input and 2 outputs , cf Gaudi algorithmas taxonomy as reference.
// Add the operator() call
std::tuple<std::vector<char>, std::string> DumpCaloGeometry::operator()(const DeCalorimeter& det) const
{
// Detector and mat geometry
const DeCalorimeter& det = detector();
// SourceID to feCards: tell1ToCards for 0 - det.nTell1s Returns tell1Param which has .feCards int vector.
// Bank header code to card using cardCode() function which operates on CardParam which has card code and channels.
......@@ -189,10 +240,7 @@ DumpUtils::Dumps DumpCaloGeometry::dumpGeometry() const
throw GaudiException {"Cannot find "s + det.caloName(), name(), StatusCode::FAILURE};
}
if (det.caloName()[0] == 'E') {
return {{std::tuple {output.buffer(), "ecal_geometry", id->second}}};
}
else {
return {{std::tuple {output.buffer(), "hcal_geometry", id->second}}};
}
// Final data output
return std::tuple {output.buffer(), m_id};
}
// FIXME: LoH: will not work with DD4HEP as is
/*****************************************************************************\
* (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 <fstream>
#include <iostream>
#include <tuple>
#include <vector>
#include "DumpFTGeometry.h"
// LHCb
#include "DumpGeometry.h"
#include <FTDet/DeFTDetector.h>
#include "FTDAQ/FTReadoutMap.h"
#include "Detector/FT/FTChannelID.h"
#include <LHCbAlgs/Transformer.h>
#include <DetDesc/GenericConditionAccessorHolder.h>
// Gaudi
//#include "GaudiAlg/Transformer.h"
// Attention : in this class, we are using Algs from LHCb and not from Gaudi
// Allen
#include <Dumpers/Identifiers.h>
#include <Dumpers/Utils.h>
//#include "DumpFTGeometry.h" , Old header, delted for this class
namespace {
using std::ios;
using std::ofstream;
using std::string;
using std::tuple;
using std::vector;
} // namespace
}
/** @class DumpFTGeometry
* Convert SciFi geometry for use on an accelerator
*
* @author Nabil Garroum
* @date 2022-04-23
* This Class dumps geometry for SciFi using DD4HEP and Gaudi Algorithm
* This Class uses a condition derivation and a detector description
* This Class is basically an instation of a Gaudi algorithm with specific inputs and outputs:
* The role of this class is to get data from TES to Allen for the SciFi
*/
class DumpFTGeometry final
: public LHCb::Algorithm::MultiTransformer<
std::tuple<std::vector<char>, std::string>(const DeFT&, const FTReadoutMap<DumpFTGeometry>&),
LHCb::DetDesc::usesBaseAndConditions<GaudiAlgorithm, FTReadoutMap<DumpFTGeometry>, DeFT>> {
public:
DumpFTGeometry(const std::string& name, ISvcLocator* pSvcLocator);
std::tuple<std::vector<char>, std::string> operator()(
const DeFT& DeFT,
const FTReadoutMap<DumpFTGeometry>& readoutMap) const override;
StatusCode initialize() override;
Gaudi::Property<std::string> m_id {this, "ID", Allen::NonEventData::SciFiGeometry::id};
private:
Gaudi::Property<std::string> m_mapLocation {this, "ReadoutMapLocation", "/dd/Conditions/ReadoutConf/FT/ReadoutMap"};
};
DECLARE_COMPONENT(DumpFTGeometry)
DumpUtils::Dumps DumpFTGeometry::dumpGeometry() const
DumpFTGeometry::DumpFTGeometry(const std::string& name, ISvcLocator* pSvcLocator) :
MultiTransformer {
name,
pSvcLocator,
{KeyValue {"FTLocation", DeFTDetectorLocation::Default},
KeyValue {"ReadoutMapStorage", "AlgorithmSpecific-" + name + "-ReadoutMap"}},
{KeyValue {"Converted", "Allen/NonEventData/DeFT"}, KeyValue {"OutputID", "Allen/NonEventData/DeFTID"}}}
{}
// MultiTrasnformer algorithm with 2 inputs and 2 outputs , cf Gaudi algorithmas taxonomy as reference.
StatusCode DumpFTGeometry::initialize()
{
return MultiTransformer::initialize().andThen(
[&] { FTReadoutMap<DumpFTGeometry>::addConditionDerivation(this, inputLocation<FTReadoutMap<DumpFTGeometry>>()); });
}
// operator() call
std::tuple<std::vector<char>, std::string> DumpFTGeometry::operator()(
const DeFT& det,
const FTReadoutMap<DumpFTGeometry>& readoutMap) const
{
// Detector and mat geometry
#ifdef USE_DD4HEP
// const auto& det = detector();
uint32_t number_of_stations = LHCb::Detector::FT::nStations;
uint32_t number_of_layers_per_station = LHCb::Detector::FT::nLayers;
uint32_t number_of_layers = number_of_stations * number_of_layers_per_station;
......@@ -33,7 +103,6 @@ DumpUtils::Dumps DumpFTGeometry::dumpGeometry() const
uint32_t number_of_quarters = number_of_quarters_per_layer * number_of_layers;
vector<uint32_t> number_of_modules(number_of_quarters);
#else
const auto& det = detector();
const auto& stations = det.stations();
const auto& layersFirstStation = stations[0]->layers();
const auto& quartersFirstLayer = layersFirstStation[0]->quarters();
......@@ -109,12 +178,10 @@ DumpUtils::Dumps DumpFTGeometry::dumpGeometry() const
}
}
#endif
// Raw bank layout (from FTReadoutTool)
string conditionLocation = "/dd/Conditions/ReadoutConf/FT/ReadoutMap";
Condition* rInfo = getDet<Condition>(conditionLocation);
auto readoutMap = FTReadoutMap {this, *rInfo};
DumpUtils::Writer output {};
// Data from Condition
auto comp = readoutMap.compatibleVersions();
if (comp.count(4)) {
auto number_of_tell40s = readoutMap.nBanks();
......@@ -155,6 +222,10 @@ DumpUtils::Dumps DumpFTGeometry::dumpGeometry() const
Gaudi::Utils::toStream(comp, s);
throw GaudiException {"Unsupported conditions compatible with " + s.str(), __FILE__, StatusCode::FAILURE};
}
return {{tuple {output.buffer(), "scifi_geometry", Allen::NonEventData::SciFiGeometry::id}}};
return {{tuple {output.buffer(), "scifi_geometry", Allen::NonEventData::SciFiGeometry::id}}};
// Final data output
return std::tuple {output.buffer(), m_id};
}
#endif
......@@ -24,4 +24,4 @@ protected:
DumpUtils::Dumps dumpGeometry() const override;
};
#endif // DUMPUTGEOMETRY_H
#endif
/*****************************************************************************\
* (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 <tuple>
#include <vector>
#include "DumpMagneticField.h"
// Include files
#include "DumpGeometry.h"
#include <Dumpers/Utils.h>
#include <Dumpers/Identifiers.h>
// LHCb
#include <Kernel/ILHCbMagnetSvc.h>
#include "Magnet/DeMagnet.h"
// #include <DetDesc/Condition.h>
// #include <DetDesc/ConditionAccessorHolder.h>
// #include "DetDesc/IConditionDerivationMgr.h"
#include <DetDesc/GenericConditionAccessorHolder.h>
// Gaudi
#include "GaudiAlg/Transformer.h"
#include "GaudiAlg/FunctionalUtilities.h"
/** @class DumpMagneticField
* Dump Magnetic Field Polarity.
*
* @author Nabil Garroum
* @date 2022-04-21
* This Class dumps Data for Magnetic Field polarity using DD4HEP and Gaudi Algorithm
* This Class uses a detector description
* This Class is basically an instation of a Gaudi algorithm with specific inputs and outputs:
* The role of this class is to get data from TES to Allen for the Magnetic Field
*/
class DumpMagneticField final : public Gaudi::Functional::MultiTransformer<
std::tuple<std::vector<char>, std::string>(const DeMagnet&),
LHCb::DetDesc::usesConditions<DeMagnet>> {
public:
DumpMagneticField(const std::string& name, ISvcLocator* svcLoc);
std::tuple<std::vector<char>, std::string> operator()(const DeMagnet& magField) const override;
Gaudi::Property<std::string> m_id {this,
"ID",
Allen::NonEventData::MagneticField::id}; // Allen Namespace from Identifiers.h
};
DECLARE_COMPONENT(DumpMagneticField)
DumpUtils::Dumps DumpMagneticField::dumpGeometry() const
// Add the multitransformer call , which keyvalues for Magnetic Field ?
DumpMagneticField::DumpMagneticField(const std::string& name, ISvcLocator* svcLoc) :
MultiTransformer(
name,
svcLoc,
{KeyValue {"Magnet", LHCb::Det::Magnet::det_path}},
{KeyValue {"Converted", "Allen/NonEventData/MagField"}, KeyValue {"OutputID", "Allen/NonEventData/MagFieldID"}})
{}
std::tuple<std::vector<char>, std::string> DumpMagneticField::operator()(const DeMagnet& magField) const
{
auto& magnetSvc = detector();
// auto& magnetSvc = detector();
DumpUtils::Writer output {};
float polarity = magnetSvc.isDown() ? -1.f : 1.f;
float polarity = magField.isDown() ? -1.f : 1.f;
output.write(polarity);
return {{std::tuple {output.buffer(), "polarity", Allen::NonEventData::MagneticField::id}}};
// Final data output
return std::tuple {output.buffer(), m_id};
}
#endif // DUMPMAGNETICFIELD_H
\ No newline at end of file
/*****************************************************************************\
* (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"
// LHCb
// #include <DetDesc/Condition.h>
// #include <DetDesc/ConditionAccessorHolder.h>
// #include "DetDesc/IConditionDerivationMgr.h"
#include "Detector/VP/VPChannelID.h"
#include <boost/numeric/conversion/cast.hpp>
#include <VPDet/DeVP.h>
#include <DetDesc/GenericConditionAccessorHolder.h>
// Gaudi
#include "GaudiAlg/Transformer.h"
#include "GaudiKernel/SystemOfUnits.h"
// Allen
#include <Dumpers/Identifiers.h>
#include <Dumpers/Utils.h>
//#include "DumpVPGeometry.h" , Old header, delted for this class
/** @class DumpVPGeometry
* Dump Calo Geometry.
*
* @author Nabil Garroum
* @date 2022-04-15
* This Class dumps geometry for Velo using DD4HEP and Gaudi Algorithm
* This Class uses a detector description
* This Class is basically an instation of a Gaudi algorithm with specific inputs and outputs:
* The role of this class is to get data from TES to Allen for the Velo Geometry
*/
class DumpVPGeometry final
: public Gaudi::Functional::
MultiTransformer<std::tuple<std::vector<char>, std::string>(const DeVP&), LHCb::DetDesc::usesConditions<DeVP>> {
public:
DumpVPGeometry(const std::string& name, ISvcLocator* svcLoc);
std::tuple<std::vector<char>, std::string> operator()(const DeVP& DeVP) const override;
Gaudi::Property<std::string> m_id {this, "ID", Allen::NonEventData::VeloGeometry::id};
};
DECLARE_COMPONENT(DumpVPGeometry)
#ifndef USE_DD4HEP
StatusCode DumpVPGeometry::registerConditions(IUpdateManagerSvc* updMgrSvc)
{
auto& det = detector();
return updMgrSvc->update(&det);
}
#else
StatusCode DumpVPGeometry::registerConditions(IUpdateManagerSvc*) { return StatusCode::SUCCESS; }
#endif
// Add the multitransformer call
DumpUtils::Dumps DumpVPGeometry::dumpGeometry() const
{
DumpVPGeometry::DumpVPGeometry(const std::string& name, ISvcLocator* svcLoc) :
MultiTransformer(
name,
svcLoc,
{KeyValue {"VPLocation", DeVPLocation::Default}},
{KeyValue {"Converted", "Allen/NonEventData/DeVP"}, KeyValue {"OutputID", "Allen/NonEventData/DeVPID"}})
{}
auto const& det = detector();
// MultiTrasnformer algorithm with 1 input and 2 outputs , cf Gaudi algorithmas taxonomy as reference.
// Add the operator() call
std::tuple<std::vector<char>, std::string> DumpVPGeometry::operator()(const DeVP& det) const
{
DumpUtils::Writer output {};
const size_t sensorPerModule = 4;
......@@ -42,5 +89,7 @@ DumpUtils::Dumps DumpVPGeometry::dumpGeometry() const
for (unsigned int i = 0; i < VP::NSensors; i++)
output.write(det.ltg(LHCb::Detector::VPChannelID::SensorID {i}));
return {{std::tuple {output.buffer(), "velo_geometry", Allen::NonEventData::VeloGeometry::id}}};
// Final data output
return std::tuple {output.buffer(), m_id};
}
/*****************************************************************************\
* (c) Copyright 2000-2019 CERN for the benefit of the LHCb Collaboration *
\*****************************************************************************/
#include <tuple>
#include <vector>
#include <string>
#include <DetDesc/Condition.h>
#include <DetDesc/ConditionAccessorHolder.h>
#include <GaudiAlg/Consumer.h>
#include "AllenUpdater.h"
namespace Allen {
/** @class TESProducer
* Dump beamline position.
*
* @author Roel Aaij
* @date 2019-04-27
*/
class TESProducer final : public Gaudi::Functional::Consumer<void(std::vector<char> const&, std::string const&)> {
public:
TESProducer(const std::string& name, ISvcLocator* svcLoc);
void operator()(std::vector<char> const& data, std::string const& id) const override;
StatusCode initialize() override;
private:
Gaudi::Property<std::string> m_id {this, "ID"};
mutable std::vector<char> m_data;
};
} // namespace Allen
DECLARE_COMPONENT_WITH_ID(Allen::TESProducer, "AllenTESProducer")
Allen::TESProducer::TESProducer(const std::string& name, ISvcLocator* svcLoc) :
Consumer(name, svcLoc, {KeyValue {"InputData", ""}, KeyValue {"InputID", ""}})
{}
StatusCode Allen::TESProducer::initialize()
{
auto sc = Consumer::initialize();
if (!sc.isSuccess()) {
return sc;
}
auto updater = service<AllenUpdater>("AllenUpdater", false);
if (!updater) {
error() << "Failed to retrieve AllenUpdater" << endmsg;
return StatusCode::FAILURE;
}
updater->registerProducer(m_id.value(), [this]() -> std::optional<std::vector<char>> { return {m_data}; });
return StatusCode::SUCCESS;
}
void Allen::TESProducer::operator()(std::vector<char> const& data, std::string const& id) const
{
using namespace std::string_literals;
if (id != m_id.value()) {
throw GaudiException {
"ID from TES is not what was expected: "s + id + " " + m_id.value(), name(), StatusCode::FAILURE};
}
m_data = data;
}
......@@ -6,14 +6,20 @@
#include <string>
#include <unordered_map>
#include <vector>
#include <GaudiAlg/MergingTransformer.h>
#include <AIDA/IHistogram1D.h>
#include <GaudiAlg/MergingTransformer.h>
#include <GaudiAlg/GaudiHistoAlg.h>
#include <GaudiKernel/GaudiException.h>
#include <Event/ODIN.h>
#include <Event/RawBank.h>
#include <Event/RawEvent.h>
#include <GaudiAlg/GaudiHistoAlg.h>
#include <Dumpers/Utils.h>
#include <GaudiKernel/GaudiException.h>
#include <BankTypes.h>
template<typename T>
using VOC = Gaudi::Functional::vector_of_const_<T>;
......@@ -41,17 +47,16 @@ using VOC = Gaudi::Functional::vector_of_const_<T>;
* @author Roel Aaij
* @date 2018-08-27
*/
class TransposeRawBanks
: public Gaudi::Functional::MergingTransformer<
std::array<std::tuple<std::vector<char>, int>, LHCb::RawBank::types().size()>(VOC<LHCb::RawEvent*> const&),
Gaudi::Functional::Traits::BaseClass_t<GaudiHistoAlg>> {
class TransposeRawBanks : public Gaudi::Functional::MergingTransformer<
std::array<TransposedBanks, LHCb::RawBank::types().size()>(VOC<LHCb::RawEvent*> const&),
Gaudi::Functional::Traits::BaseClass_t<GaudiHistoAlg>> {
public:
/// Standard constructor
TransposeRawBanks(const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize() override;
std::array<std::tuple<std::vector<char>, int>, LHCb::RawBank::types().size()> operator()(
std::array<TransposedBanks, LHCb::RawBank::types().size()> operator()(
VOC<LHCb::RawEvent*> const& rawEvents) const override;
private:
......@@ -86,11 +91,11 @@ StatusCode TransposeRawBanks::initialize()
return StatusCode::SUCCESS;
}
std::array<std::tuple<std::vector<char>, int>, LHCb::RawBank::types().size()> TransposeRawBanks::operator()(
std::array<TransposedBanks, LHCb::RawBank::types().size()> TransposeRawBanks::operator()(
VOC<LHCb::RawEvent*> const& rawEvents) const
{
std::array<std::tuple<std::vector<char>, int>, LHCb::RawBank::types().size()> output;
std::array<TransposedBanks, LHCb::RawBank::types().size()> output;
std::array<LHCb::RawBank::View, LHCb::RawBank::types().size()> rawBanks;
for (auto const* rawEvent : rawEvents) {
......@@ -109,12 +114,16 @@ std::array<std::tuple<std::vector<char>, int>, LHCb::RawBank::types().size()> Tr
auto const& banks = rawBanks[bt];
if (banks.empty()) continue;
const uint32_t number_of_rawbanks = banks.size();
const uint32_t nBanks = banks.size();
uint32_t offset = 0;
std::vector<uint32_t> bankOffsets;
std::vector<uint32_t> bankData;
bankOffsets.push_back(0);
std::vector<uint32_t> bankData;
std::vector<uint16_t> bankSizes;
bankSizes.reserve(nBanks);
std::vector<uint8_t> bankTypes;
bankTypes.reserve(nBanks);
for (auto& bank : banks) {
const uint32_t sourceID = static_cast<uint32_t>(bank->sourceID());
......@@ -141,12 +150,15 @@ std::array<std::tuple<std::vector<char>, int>, LHCb::RawBank::types().size()> Tr
offset++;
}
bankOffsets.push_back(offset * sizeof(uint32_t));
bankSizes.push_back(bank->size());
bankTypes.push_back(static_cast<uint8_t>(bank->type()));
}
// Dumping number_of_rawbanks + 1 offsets!
DumpUtils::Writer bank_buffer;
bank_buffer.write(number_of_rawbanks, bankOffsets, bankData);
output[bt] = std::tuple {bank_buffer.buffer(), banks[0]->version()};
bank_buffer.write(nBanks, bankOffsets, bankData);
output[bt] =
TransposedBanks {bank_buffer.buffer(), std::move(bankSizes), std::move(bankTypes), banks[0]->version()};
}
return output;
}
......
......@@ -15,10 +15,12 @@
<argument name="program"><text>python</text></argument>
<argument name="args"><set>
<text>../../options/allen.py</text>
<text>--mdf</text><text>root://eoslhcb.cern.ch///eos/lhcb/wg/rta/samples/mc/RetinaClusters_FTv4_MDF/00067189_retinaCluster_no63.mdf</text>
<text>-n</text><text>10000</text>
</set></argument>
<arguement name="timeout"><integer>600</integer></arguement>
<argument name="validator"><text>
countErrorLines({"FATAL":0,"ERROR":0,"WARNING":2})
countErrorLines({"FATAL":0,"ERROR":0,"WARNING":0})
import re
......
......@@ -10,6 +10,7 @@
\*****************************************************************************/
#pragma once
#include <algorithm>
#include <cstdio>
#include <BackendCommon.h>
#include <Argument.cuh>
......
......@@ -9,6 +9,7 @@ sequence as part of a Gaudi/LHCb
application
#]========================================]
if(TARGET_DEVICE STREQUAL "CPU")
include(GenerateConfiguration)
gaudi_add_module(AllenWrapper
......@@ -30,7 +31,25 @@ gaudi_add_module(AllenWrapper
src/TestVeloClusters.cpp
LINK
AllenLib
Backend
Stream
HostCommon
HostEventModel
NonEventData
TrackChecking
PVChecking
CheckClustering
SelChecking
Monitoring
HostCombiners
EventModel
Gear
mdf
LHCbEvent
EventModel
MuonCommon
EventModel
Gear
Gaudi::GaudiAlgLib
LHCb::DAQEventLib
LHCb::DAQKernelLib
......@@ -46,14 +65,30 @@ gaudi_add_module(AllenWrapper
target_include_directories(AllenWrapper PRIVATE ${PROJECT_BINARY_DIR}/code_generation)
add_dependencies(AllenWrapper struct_to_tuple)
gaudi_add_module(AllenAlgorithms
SOURCES
${WRAPPED_ALGORITHM_SOURCES}
LINK
AllenLib
Backend
Stream
HostCommon
HostEventModel
NonEventData
TrackChecking
PVChecking
CheckClustering
SelChecking
Monitoring
HostCombiners
EventModel
Gear
mdf
LHCbEvent
EventModel
MuonCommon
WrapperInterface
MuonCommon
WrapperInterface
Gaudi::GaudiAlgLib
LHCb::DAQEventLib
LHCb::DAQKernelLib
......@@ -78,6 +113,8 @@ endif()
target_compile_definitions(AllenWrapper PRIVATE -D${TARGET_DEFINITION})
target_compile_definitions(AllenAlgorithms PRIVATE -D${TARGET_DEFINITION})
endif()
gaudi_install(PYTHON)
gaudi_add_tests(QMTest)
......
......@@ -8,29 +8,74 @@
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
from Configurables import (ApplicationMgr, DumpUTGeometry, DumpFTGeometry,
DumpMuonTable, DumpMuonGeometry, DumpCaloGeometry,
DumpVPGeometry, DumpMagneticField, DumpBeamline,
DumpUTLookupTables, AllenUpdater)
from functools import partial
from Configurables import (ApplicationMgr, DumpUTGeometry, DumpMuonTable,
DumpMuonGeometry, DumpUTLookupTables, AllenUpdater)
from PyConf import configurable
from PyConf.control_flow import CompositeNode, NodeLogic
from PyConf.Algorithms import (AllenTESProducer, DumpBeamline,
DumpCaloGeometry, DumpMagneticField,
DumpVPGeometry, DumpFTGeometry)
from DDDB.CheckDD4Hep import UseDD4Hep
@configurable
def setup_allen_non_event_data_service(dump_geometry=False,
out_dir="geometry"):
def allen_non_event_data_config(dump_geometry=False, out_dir="geometry"):
return dump_geometry, out_dir
def setup_allen_non_event_data_service(allen_event_loop=False):
"""Setup Allen non-event data
An ExtSvc is added to the ApplicationMgr to provide the Allen non-event
data (geometries etc.)
"""
from functools import partial
ecal_location = "/dd/Structure/LHCb/DownstreamRegion/Ecal"
ecal_geom = partial(
DumpCaloGeometry, name="DumpEcal", Location=ecal_location)
producers = [
dump_geometry, out_dir = allen_non_event_data_config()
service_producers = [
p(DumpToFile=dump_geometry, OutputDirectory=out_dir)
for p in (DumpVPGeometry, DumpUTGeometry, DumpFTGeometry,
DumpMuonGeometry, DumpMuonTable, DumpMagneticField,
DumpBeamline, DumpUTLookupTables, ecal_geom)
for p in (DumpUTGeometry, DumpMuonGeometry, DumpMuonTable,
DumpUTLookupTables)
]
appMgr = ApplicationMgr()
if not UseDD4Hep:
# MagneticFieldSvc is required for non-DD4hep builds
appMgr.ExtSvc.append("MagneticFieldSvc")
appMgr.ExtSvc.extend(service_producers)
appMgr.ExtSvc.extend(AllenUpdater(TriggerEventLoop=allen_event_loop))
algorithm_converters = [
DumpBeamline(),
DumpCaloGeometry(),
DumpVPGeometry(),
DumpMagneticField(),
DumpFTGeometry()
]
ApplicationMgr().ExtSvc += [AllenUpdater()] + producers
algorithm_producers = []
for converter in algorithm_converters:
converter_id = converter.type.getDefaultProperties()['ID']
producer = AllenTESProducer(
InputID=converter.OutputID,
InputData=converter.Converted,
ID=converter_id)
algorithm_producers.append(producer)
converters_node = CompositeNode(
"allen_non_event_data_converters",
algorithm_converters,
combine_logic=NodeLogic.NONLAZY_OR,
force_order=True)
producers_node = CompositeNode(
"allen_non_event_data_producers",
algorithm_producers,
combine_logic=NodeLogic.NONLAZY_OR,
force_order=True)
control_flow = [converters_node, producers_node]
cf_node = CompositeNode(
"allen_non_event_data",
control_flow,
combine_logic=NodeLogic.LAZY_AND,
force_order=True)
return cf_node