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
  • rrabadan/LHCb
  • talin/LHCb
  • imjelde/LHCb
  • mstahl/LHCb
  • padeken/LHCb
  • mimazure/LHCb
  • roiser/LHCb
  • conrad/LHCb
  • kklimasz/LHCb
  • rcurrie/LHCb
  • wkrzemie/LHCb
  • fkeizer/LHCb
  • valassi/LHCb
  • hschrein/LHCb
  • anstahll/LHCb
  • jonrob/LHCb
  • graven/LHCb
  • clemenci/LHCb
  • chaen/LHCb
  • sstahl/LHCb
  • lhcb/LHCb
21 results
Show changes
Commits on Source (8)
......@@ -165,6 +165,8 @@ namespace LHCb {
/// Retrieve (const) Vector of pointers to decay vertices
const SmartRefVector<LHCb::MCVertex>& endVertices() const;
const MCVertex* goodEndVertex() const;
/// Update Vector of pointers to decay vertices
MCParticle& setEndVertices( SmartRefVector<LHCb::MCVertex> value );
......
......@@ -31,30 +31,57 @@ std::ostream& LHCb::MCParticle::fillStream( std::ostream& s ) const {
}
namespace LHCb {
LinAlg::Vec3<SIMDWrapper::scalar::float_v> referencePoint( const MCParticle& p ) {
auto const& pos = p.originVertex()->position();
return LinAlg::Vec3<SIMDWrapper::scalar::float_v>{pos.x(), pos.y(), pos.z()};
}
/**
* @brief Get first end-vertex of MCParticle if it's from a decay or hadronic interaction
* @brief Get MCParticle's first end-vertex that likely destroyed the particle
*
* @return const LHCb::MCVertex*
* @note Choosing an endVertex is not trivial and might depend on the physics case.
* This implementation was presented in
* https://indico.cern.ch/event/1118300/contributions/4734729/attachments/2389881.
* It first tries to find the first vertex where the particle is actually destroyed.
* If no such vertex is found, it checks for an hadronic IA and returns this vertex or
* nullptr if nothing was found.
*/
const MCVertex* MCParticle::goodEndVertex() const {
const auto& v = endVertices();
const auto destructiveV = std::find_if( v.begin(), v.end(), []( auto vtx ) {
switch ( vtx->type() ) {
case MCVertex::DecayVertex:
case MCVertex::OscillatedAndDecay:
case MCVertex::Annihilation:
case MCVertex::PairProduction:
return true;
default:
return false;
}
} );
if ( destructiveV != v.end() ) {
return destructiveV->data();
} else {
const auto hadronIAV =
std::find_if( v.begin(), v.end(), []( auto vtx ) { return vtx->type() == MCVertex::HadronicInteraction; } );
return hadronIAV != v.end() ? hadronIAV->data() : nullptr;
}
}
/**
* @brief Get position of a good endVertex for MCParticle
*
* @param p LHCb::MCParticle
* @return LinAlg::Vec3<SIMDWrapper::scalar::float_v>
* @note Returns LinAlg::Vec3<SIMDWrapper::scalar::float_v> filled with NaN if no end-vertex
* found. This function is used by ThOr functors via ADL.
* Choosing an endVertex is not trivial and might depend on the physics case. This
* implementation is taken from
* https://gitlab.cern.ch/lhcb/Analysis/-/blob/v34r1/Phys/DecayTreeTupleMC/src/MCTupleToolKinematic.cpp#L112
*/
LinAlg::Vec3<SIMDWrapper::scalar::float_v> endVertexPos( const MCParticle& p ) {
const auto& endVertices = p.endVertices();
const auto mcV = std::find_if( endVertices.begin(), endVertices.end(), []( auto vtx ) {
return vtx->type() == MCVertex::DecayVertex || vtx->type() == MCVertex::OscillatedAndDecay ||
vtx->type() == MCVertex::HadronicInteraction;
} );
if ( mcV != endVertices.end() ) {
const auto pos = ( *mcV )->position();
const auto* goodVtx = p.goodEndVertex();
if ( goodVtx ) {
const auto pos = goodVtx->position();
return LinAlg::Vec3<SIMDWrapper::scalar::float_v>{pos.x(), pos.y(), pos.z()};
} else {
constexpr auto nan = std::numeric_limits<float>::quiet_NaN();
......
......@@ -29,23 +29,26 @@ def mc_unpackers(process='Hlt2', filtered_mc=True, configurables=True):
This must run BEFORE unpackers!!!.
Args:
process (str): 'Hlt2' (or, in the future, 'Spruce').
process (str): 'Turbo', 'Spruce' or 'Hlt2'.
filtered_mc (bool): If True, assume Moore saved only a filtered
subset of the input MC objects.
configurables (bool): set to False to use PyConf Algorithm.
"""
assert process == "Hlt2" or process == "Turbo" or process == "Spruce", 'MC unpacker helper only accepts Turbo, Spruce or Hlt2 processes'
assert process == "Hlt2" or process == "Turbo" or process == "Spruce", 'MC unpacker helper only accepts Turbo, Spruce or Hlt2 process'
mc_prefix = '/Event/HLT2' if filtered_mc else "/Event"
if process == "Spruce":
mc_prefix = '/Event/Spruce/HLT2'
if configurables:
from Configurables import UnpackMCParticle, UnpackMCVertex
unpack_mcp = UnpackMCParticle(
InputName=os.path.join(mc_prefix, "pSim/MCParticles"),
OutputName=os.path.join(mc_prefix, "MC/Particles"),
)
OutputName=os.path.join(mc_prefix, "MC/Particles"))
unpack_mcv = UnpackMCVertex(
InputName=os.path.join(mc_prefix, "pSim/MCVertices"),
OutputName=os.path.join(mc_prefix, "MC/Vertices"),
)
OutputName=os.path.join(mc_prefix, "MC/Vertices"))
else:
from PyConf.application import make_data_with_FetchDataFromFile
from PyConf.Algorithms import UnpackMCParticle, UnpackMCVertex
......@@ -73,7 +76,7 @@ def unpack_rawevent(bank_types=["DstData", "HltDecReports"],
stream="default",
raw_event_format=0.3,
configurables=True,
OutputLevel=4):
output_level=4):
"""Return RawBank:Views of banks in RawEvent.
Args:
......@@ -82,6 +85,8 @@ def unpack_rawevent(bank_types=["DstData", "HltDecReports"],
stream (str): needed post-sprucing as RawEvent is then dependent on stream name
- drives `RawEventLocation` only.
raw_event_format (float):
configurables (bool): set to False to use PyConf Algorithm.
output_level (int): Level of verbosity 1-8.
"""
assert process == "Spruce" or process == "Turbo" or process == "Hlt2", 'Unpacking helper only accepts Turbo, Spruce or Hlt2 processes'
if process == "Spruce" or process == "Turbo":
......@@ -100,14 +105,14 @@ def unpack_rawevent(bank_types=["DstData", "HltDecReports"],
'/Event/DAQ/RawBanks/%s' % (rb) for rb in bank_types
],
RawEventLocation=bank_location,
OutputLevel=OutputLevel)
OutputLevel=output_level)
return unpackrawevent
def unpackers(process='Hlt2',
data_type='Upgrade',
configurables=True,
OutputLevel=4):
output_level=4):
"""Return a list of unpackers for reading reconstructed objects.
This must run AFTER mc_unpackers if MC data!!!.
......@@ -115,6 +120,8 @@ def unpackers(process='Hlt2',
Args:
process (str): 'Turbo' or 'Spruce' or 'Hlt2'.
data_type (str): The data type to configure PersistRecoPacking
configurables (bool): set to False to use PyConf Algorithm.
output_level (int): Level of verbosity 1-8.
"""
assert process == "Spruce" or process == "Turbo" or process == "Hlt2", 'Unpacking helper only accepts Turbo, Spruce or Hlt2 processes'
if configurables:
......@@ -129,9 +136,9 @@ def unpackers(process='Hlt2',
RECO_ROOT = PANDV_ROOT
prpacking = PersistRecoPacking(stream=RECO_ROOT, data_type=data_type)
unpack_persistreco = prpacking.unpackers(
configurables=configurables, output_level=OutputLevel)
configurables=configurables, output_level=output_level)
unpack_psandvs = UnpackParticlesAndVertices(
InputStream=PANDV_ROOT, OutputLevel=OutputLevel)
InputStream=PANDV_ROOT, OutputLevel=output_level)
return unpack_persistreco + [unpack_psandvs]
......@@ -139,8 +146,9 @@ def decoder(process='Hlt2',
stream="default",
raw_event_format=0.3,
data_type='Upgrade',
annsvc_name='HltANNSvc',
configurables=True,
OutputLevel=4):
output_level=4):
"""Return a DstData raw bank decoder.
Args:
......@@ -149,6 +157,9 @@ def decoder(process='Hlt2',
- drives `RawEventLocation` only.
raw_event_format (float):
data_type (str): The data type to configure PersistRecoPacking.
annsvc_name (str): Name of ANNSvc to read data.
configurables (bool): set to False to use PyConf Algorithm.
output_level (int): Level of verbosity 1-8.
"""
assert process == "Spruce" or process == "Turbo" or process == "Hlt2", 'Unpacking helper only accepts Turbo, Spruce or Hlt2 processes'
if process == "Spruce":
......@@ -173,7 +184,8 @@ def decoder(process='Hlt2',
decode_packeddata = HltPackedDataDecoder(
RawEventLocations=[bank_location],
ContainerMap=container_map,
OutputLevel=OutputLevel)
ANNSvc=annsvc_name,
OutputLevel=output_level)
return decode_packeddata
......@@ -182,14 +194,17 @@ def hlt2_decisions(process='Hlt2',
output_loc="/Event/Hlt/DecReports",
raw_event_format=0.3,
configurables=True,
OutputLevel=4):
output_level=4):
"""Return a HltDecReportsDecoder instance for HLT2 decisions.
Args:
process (str): 'Turbo' or 'Spruce' or 'Hlt2' - serves to determine `RawEventLocation` only.
stream (str): needed post-sprucing as RawEvent is then dependent on stream name
- drives `RawEventLocation` only.
output_loc (str): TES location to put decoded DecReports.
raw_event_format (float):
configurables (bool): set to False to use PyConf Algorithm.
output_level (int): Level of verbosity 1-8.
"""
assert process == "Spruce" or process == "Turbo" or process == "Hlt2", 'Unpacking helper only accepts Turbo, Spruce or Hlt2 processes'
......@@ -206,7 +221,7 @@ def hlt2_decisions(process='Hlt2',
SourceID='Hlt2',
RawEventLocations=bank_location.location,
OutputHltDecReportsLocation=output_loc,
OutputLevel=OutputLevel)
OutputLevel=output_level)
else:
from PyConf.Algorithms import HltDecReportsDecoder
......@@ -217,7 +232,7 @@ def hlt2_decisions(process='Hlt2',
outputs={
'OutputHltDecReportsLocation': force_location(output_loc)
},
OutputLevel=OutputLevel)
OutputLevel=output_level)
return decode_hlt2
......@@ -225,13 +240,15 @@ def hlt2_decisions(process='Hlt2',
def spruce_decisions(process="Spruce",
stream="default",
configurables=True,
OutputLevel=4):
output_level=4):
"""Return a HltDecReportsDecoder instance for Sprucing decisions.
Args:
process (str): 'Turbo' or 'Spruce' - serves to determine `RawEventLocation` only.
stream (str): needed post-sprucing as RawEvent is then dependent on stream name
- drives `RawEventLocation` only.
configurables (bool): set to False to use PyConf Algorithm.
output_level (int): Level of verbosity 1-8.
"""
assert process == "Spruce" or process == "Turbo", 'Can only ask for sprucing decisions if post - sprucing'
bank_location = make_data_with_FetchDataFromFile(stream)
......@@ -244,7 +261,7 @@ def spruce_decisions(process="Spruce",
SourceID='Spruce',
RawEventLocations=bank_location.location,
OutputHltDecReportsLocation=output_loc,
OutputLevel=OutputLevel)
OutputLevel=output_level)
else:
from PyConf.Algorithms import HltDecReportsDecoder
......@@ -256,7 +273,7 @@ def spruce_decisions(process="Spruce",
outputs={
'OutputHltDecReportsLocation': force_location(output_loc)
},
OutputLevel=OutputLevel)
OutputLevel=output_level)
return decode_spruce
......
......@@ -28,6 +28,7 @@ gaudi_add_library(ZMQLib
Gaudi::GaudiKernel
Gaudi::GaudiUtilsLib
PkgConfig::zmq
PkgConfig::sodium
)
gaudi_add_module(ZeroMQ
......@@ -39,7 +40,6 @@ gaudi_add_module(ZeroMQ
LHCb::LHCbAlgsLib
Gaudi::GaudiKernel
LHCb::ZMQLib
PkgConfig::zmq
)
gaudi_install(PYTHON)
......
......@@ -27,6 +27,11 @@ list(PREPEND CMAKE_MODULE_PATH ${LHCbConfigUtils_DIR})
find_package(PkgConfig)
include(FindDataPackage)
set(LHCB_UNUSED_SUBDIR_MESSAGE_TYPE "WARNING"
CACHE STRING "Message type for detected unused subdirs")
set(LHCB_UNUSED_SOURCE_MESSAGE_TYPE "WARNING"
CACHE STRING "Message type for detected unused source files")
#[========================================================================[.rst:
.. cmake:command:: lhcb_env
......@@ -291,8 +296,6 @@ macro(lhcb_finalize_configuration)
gaudi_install(CMAKE lhcbproject.yml)
endif()
set(LHCB_UNUSED_SUBDIR_MESSAGE_TYPE "WARNING" CACHE STRING "Message type for detected unused subdirs")
set(LHCB_UNUSED_SOURCE_MESSAGE_TYPE "WARNING" CACHE STRING "Message type for detected unused source files")
# check that we actually build everything in the project
# - check all subdirs are included (except for those listed in LHCB_IGNORE_SUBDIRS)
get_property(added_subdirs DIRECTORY PROPERTY SUBDIRECTORIES)
......
......@@ -100,6 +100,7 @@ find_package(yaml-cpp REQUIRED)
pkg_check_modules(git2 libgit2 REQUIRED IMPORTED_TARGET) # for GitEntityResolver
pkg_check_modules(zmq libzmq REQUIRED IMPORTED_TARGET) # for ZeroMQ
pkg_check_modules(sodium libsodium REQUIRED IMPORTED_TARGET) # for ZeroMQ
find_data_package(FieldMap REQUIRED)
find_data_package(Gen/DecFiles REQUIRED)
......