Skip to content
Snippets Groups Projects

Add "empty" conditions when they are missing from the database

Merged Roel Aaij requested to merge default_conditions into master
2 files
+ 67
98
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -20,6 +20,7 @@
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/key_extractors.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index_container.hpp>
@@ -32,13 +33,19 @@ namespace LHCb::Detector {
// Tag structs to refer to the three indices of the
// ConditionsRepository::Locations multi-index container
struct by_location_hash {};
struct by_filename_hash {};
struct by_filename {};
struct by_condition_key {};
/// Utility function to extract the combined location hash (filename
/// and condition name) from a ConditionIdentifier
dd4hep::Condition::key_type location_key( const ConditionIdentifier* entry );
/// Utility function to extract the filename hash from a const ConditionIdentifier
inline std::string condition_filename( const ConditionIdentifier* entry ) { return entry->sys_id; };
/// Utility function to extract the condition key from a const ConditionIdentifier
inline dd4hep::Condition::key_type condition_key( const ConditionIdentifier* entry ) { return entry->hash; };
struct RequestSelector;
/**
@@ -51,25 +58,27 @@ namespace LHCb::Detector {
public:
// A multi-index container that allows (fast) lookup in three
// ways. the value is always the ConditionIdentifier.
// ways. the value is either ConditionIdentifier* or
// const ConditionIdentifier*.
template <bool const_pointer = false>
using Locations = boost::multi_index_container<
ConditionIdentifier*,
std::conditional_t<const_pointer, const ConditionIdentifier*, ConditionIdentifier*>,
bmi::indexed_by<
// Analogously to an `std::map` with key the combined hash
// of the filename and the condition name
bmi::ordered_unique<
bmi::tag<LHCb::Detector::by_location_hash>,
bmi::global_fun<const ConditionIdentifier*, dd4hep::Condition::key_type, &location_key>>,
// Analogously to an `std::unordered_multimap` with key the hash of the filename
bmi::hashed_non_unique<bmi::tag<LHCb::Detector::by_filename_hash>,
bmi::member<ConditionIdentifier, int, &ConditionIdentifier::sys_id_hash>>,
// Analogously to an `std::multimap` with key the hash of the filename
bmi::ordered_non_unique<bmi::tag<LHCb::Detector::by_filename>,
bmi::global_fun<const ConditionIdentifier*, std::string, &condition_filename>>,
// Analogously to an `std::unordered_map` with key the
// combined hash of the detector element and the condition
// name
bmi::hashed_unique<
bmi::tag<LHCb::Detector::by_condition_key>,
bmi::member<ConditionIdentifier, dd4hep::Condition::key_type, &ConditionIdentifier::hash>>>>;
Locations locations;
bmi::global_fun<const ConditionIdentifier*, dd4hep::Condition::key_type, &condition_key>>>>;
Locations<> locations;
private:
/// Default assignment operator
Loading