Commit fb7018fd authored by Joerg Stelzer's avatar Joerg Stelzer Committed by Frank Winklmeier
Browse files

Extending the L1 configuration access methods

parent 49220a7f
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_CONSTITER_H
#define TRIGCONFDATA_CONSTITER_H
/**
* @file TrigConfData/ConstIter.h
* @author J. Stelzer
* @date Feb 2019
* @brief Forward iterator to traverse the main components of the trigger configuration
*/
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_DATASTRUCTURE_H
#define TRIGCONFDATA_DATASTRUCTURE_H
/**
* @file TrigConfData/DataStructure.h
* @author J. Stelzer
* @date Feb 2019
* @brief Base class for Trigger configuration data and wrapper around underlying representation
*/
......@@ -63,8 +60,11 @@ namespace TrigConf {
void setData(const ptree & data);
void setData(ptree && data);
/** A string that is the name of the class */
virtual std::string className() const;
virtual const std::string & name() const final;
/** Clearing the configuration data
*
* leads to an uninitialized object
......@@ -121,8 +121,12 @@ namespace TrigConf {
template<class T>
T getAttribute(const std::string & key, bool ignoreIfMissing = false, const T & def = T()) const {
const auto & obj = data().get_child_optional(key);
if( !obj && ignoreIfMissing ) {
return def;
if( !obj ) {
if( ignoreIfMissing ) {
return def;
} else {
throw std::runtime_error(className() + "#" + name() + ": structure '" + key + "' does not exist" );
}
}
return obj.get().get_value<T>();
}
......@@ -172,7 +176,12 @@ namespace TrigConf {
/* Print this object including children
* @param os The output stream
*/
void print(std::ostream & os = std::cout) const;
void printRaw(std::ostream & os = std::cout) const;
/* Print this object including children
* @param os The output stream
*/
virtual void print(std::ostream & os = std::cout) const;
/** Static function to print a @c ptree object
* @param key The key of this data as found in the parent structure
......@@ -201,6 +210,8 @@ namespace TrigConf {
std::shared_ptr<ptree> m_dataSPtr { nullptr }; // used when owning the tree
const ptree * m_dataPtr { nullptr }; // used when not owning the tree
std::string m_name{""}; // most objects are named
};
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_HLTCHAIN_H
......@@ -29,8 +29,7 @@ namespace TrigConf {
/** Destructor */
virtual ~Chain();
/** Accessor to the chain name */
const std::string & name() const;
virtual std::string className() const;
/** Accessor to the chain counter
*
......@@ -55,6 +54,10 @@ namespace TrigConf {
/** Accessor to the groups this chain belongs to */
std::vector<std::string> groups() const;
private:
void update() override;
};
}
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_HLTMENU_H
......@@ -32,9 +32,6 @@ namespace TrigConf {
/** Destructor */
~HLTMenu();
/** Accessor to the menu name */
std::string name() const;
/** Accessor to the number of HLT chains */
std::size_t size() const;
......@@ -55,6 +52,9 @@ namespace TrigConf {
/** print overview of L1 Menu */
void printMenu(bool full = false) const;
private:
void update() override;
};
}
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_HLTPRESCALESET_H
......@@ -37,9 +37,6 @@ namespace TrigConf {
/** Destructor */
~HLTPrescalesSet();
/** name of the prescale set */
std::string name() const;
/** number of HLT prescales */
std::size_t size() const;
......@@ -61,8 +58,6 @@ namespace TrigConf {
// maps HLT chain hashes to prescales
std::unordered_map<uint32_t, HLTPrescale> m_prescalesByHash {1024};
std::string m_name;
};
}
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_L1BOARD_H
#define TRIGCONFDATA_L1BOARD_H
#include "TrigConfData/ConstIter.h"
#include "TrigConfData/DataStructure.h"
#include <map>
#include <vector>
namespace TrigConf {
/** @brief a TriggerLine entry describes the location of a threshold multiplicity on a cable (connector)
*
* for electrical connections from L1Topo boards it also knows
* which fpga they come from and which clock signal they have (those signals run on doubled clock)
*/
/** @brief L1 board configuration */
class L1Board final : public DataStructure {
public:
enum class BoardType { CTPIN, TOPO, MUCTPI };
/** Constructor */
L1Board();
L1Board(const L1Board &) = delete;
L1Board& operator=(const L1Board&) = delete;
L1Board(L1Board&&) = delete;
/** Constructor initialized with configuration data
* @param data The data containing the L1 menu
*/
L1Board(const std::string & boardName, const ptree & data);
/** Destructor */
virtual ~L1Board();
virtual std::string className() const;
/** Accessor to the number of connectors */
std::size_t size() const;
BoardType type() const;
/** Accessor to the connector type */
bool legacy() const;
/** Accessor to connector names */
const std::vector<std::string> & connectorNames() const;
private:
/** Update the internal members */
virtual void update();
BoardType m_type;
bool m_legacy;
std::vector<std::string> m_connectorNames;
};
}
#endif
......@@ -58,8 +58,7 @@ namespace TrigConf {
/** Destructor */
virtual ~L1Connector();
/** Accessor to the connector name */
const std::string & name() const;
virtual std::string className() const;
/** Accessor to the number of trigger lines */
std::size_t size() const;
......@@ -87,7 +86,6 @@ namespace TrigConf {
/** Update the internal members */
virtual void update();
std::string m_name;
ConnectorType m_type;
std::vector<TrigConf::TriggerLine> m_triggerLines[2][2];
std::map<std::string, TrigConf::TriggerLine*> m_lineByName;
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_L1ITEM_H
......@@ -29,8 +29,7 @@ namespace TrigConf {
/** Destrutor */
~L1Item();
/** Accessor to the item name */
const std::string & name() const;
virtual std::string className() const;
/** Accessor to the CTP ID */
unsigned int ctpId() const;
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_L1MENU_H
......@@ -8,8 +8,11 @@
#include "TrigConfData/ConstIter.h"
#include "TrigConfData/DataStructure.h"
#include "TrigConfData/L1Item.h"
#include "TrigConfData/L1Threshold.h"
#include "TrigConfData/L1Connector.h"
#include "TrigConfData/L1Board.h"
#include "TrigConfData/L1TopoAlgorithm.h"
#include "TrigConfData/L1Threshold.h"
#include "TrigConfData/L1ThrExtraInfo.h"
#include <vector>
#include <map>
......@@ -37,9 +40,6 @@ namespace TrigConf {
/** Destructor */
virtual ~L1Menu();
/** Accessor to the menu name */
std::string name() const;
/** Accessor to the menu version */
unsigned int version() const;
......@@ -67,19 +67,37 @@ namespace TrigConf {
*/
const_iterator end() const;
/** Access to list of all L1Thresholds
* (requires vector copy)
*/
std::vector<TrigConf::L1Threshold> thresholds() const;
/** List of L1 thresholds types */
std::vector<std::string> thresholdTypes() const;
/** List of L1 thresholds names */
std::vector<std::string> thresholdNames() const;
/** Access to list of all L1Thresholds */
std::vector<std::shared_ptr<TrigConf::L1Threshold>> thresholds() const;
/** Access to list of L1Thresholds by type */
const std::vector<TrigConf::L1Threshold> & thresholds(const std::string & typeName) const;
const std::vector<std::shared_ptr<TrigConf::L1Threshold>> & thresholds(const std::string & typeName) const;
/** Access to L1Threshold by name */
const TrigConf::L1Threshold & threshold(const std::string & thresholdName) const;
/** List of L1 thresholds types */
std::vector<std::string> thresholdTypes() const;
/** Access to extra info for threshold types */
const L1ThrExtraInfo & thrExtraInfo() const;
/** Access to topo algorithm by name */
const TrigConf::L1TopoAlgorithm & algorithm(const std::string & algoName) const;
/** Access to topo algorithm by output */
const TrigConf::L1TopoAlgorithm & algorithmFromOutput(const std::string & outputName) const;
/** Access to boards by name */
const TrigConf::L1Board & board(const std::string & boardName) const;
/** Board names */
std::vector<std::string> boardNames() const;
/** Access to connector by name */
const TrigConf::L1Connector & connector(const std::string & connectorName) const;
......@@ -87,6 +105,7 @@ namespace TrigConf {
/** Connector names */
std::vector<std::string> connectorNames() const;
/** print overview of L1 Menu */
void printMenu(bool full = false) const;
......@@ -95,12 +114,19 @@ namespace TrigConf {
/** Update the internal data after modification of the data object */
virtual void update() override;
std::string m_name{""};
std::map<std::string, TrigConf::L1Connector> m_connectors{};
std::map<std::string, std::vector<TrigConf::L1Threshold>> m_thresholdsByType{};
std::map<std::string, TrigConf::L1Threshold*> m_thresholdsByName{};
std::map<std::string, TrigConf::L1Board> m_boards{};
std::map<std::string, std::vector<std::shared_ptr<TrigConf::L1Threshold>>> m_thresholdsByType{};
std::map<std::string, std::shared_ptr<TrigConf::L1Threshold>> m_thresholdsByName{};
TrigConf::L1ThrExtraInfo m_thrExtraInfo;
std::map<std::string, std::vector<TrigConf::L1TopoAlgorithm>> m_algorithmsByType{};
std::map<std::string, TrigConf::L1TopoAlgorithm*> m_algorithmsByName{};
std::map<std::string, TrigConf::L1TopoAlgorithm*> m_algorithmsByOutput{};
};
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_L1PRESCALESSET_H
......@@ -40,9 +40,6 @@ namespace TrigConf {
/** Destructor */
virtual ~L1PrescalesSet();
/** name of the prescale set */
std::string name() const;
/** number of L1 prescales */
std::size_t size() const;
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_L1THREXTRAINFO_H
#define TRIGCONFDATA_L1THREXTRAINFO_H
#include "TrigConfData/DataStructure.h"
#include "TrigConfData/L1ThresholdBase.h"
#include <map>
#include <vector>
#include <iostream>
namespace TrigConf {
class L1ThrExtraInfoBase;
class L1ThrExtraInfo_EMTAULegacy;
class L1ThrExtraInfo_JETLegacy;
class L1ThrExtraInfo_eEMTAU;
class L1ThrExtraInfo_jJ;
class L1ThrExtraInfo_jTAU;
class L1ThrExtraInfo_gXE;
class L1ThrExtraInfo_MU;
class L1ThrExtraInfo {
public:
static std::unique_ptr<L1ThrExtraInfoBase> createExtraInfo(const std::string & thrTypeName, const boost::property_tree::ptree & data);
std::weak_ptr<TrigConf::L1ThrExtraInfoBase> addExtraInfo(const std::string & thrTypeName, const boost::property_tree::ptree & data);
const L1ThrExtraInfo_EMTAULegacy & EM() const;
const L1ThrExtraInfo_EMTAULegacy & TAU() const;
const L1ThrExtraInfo_JETLegacy & JET() const;
const L1ThrExtraInfo_eEMTAU & eEM() const;
const L1ThrExtraInfo_eEMTAU & eTAU() const;
const L1ThrExtraInfo_jJ & jJ() const;
const L1ThrExtraInfo_jTAU & jTAU() const;
const L1ThrExtraInfo_gXE & gXE() const;
const L1ThrExtraInfo_MU & MU() const;
const L1ThrExtraInfoBase & thrExtraInfo(const std::string & thrTypeName) const;
bool hasInfo(const std::string & typeName) const;
private:
// map from threshold type to
std::map<std::string, std::shared_ptr<TrigConf::L1ThrExtraInfoBase>> m_thrExtraInfo{};
std::shared_ptr<TrigConf::L1ThrExtraInfoBase> m_emptyInfo{ nullptr };
};
class L1ThrExtraInfo_EMTAULegacy final : public L1ThrExtraInfoBase {
public:
L1ThrExtraInfo_EMTAULegacy(const std::string & thrTypeName, const ptree & data);
virtual ~L1ThrExtraInfo_EMTAULegacy();
virtual std::string className() const;
unsigned int emScale() const;
unsigned int ptMinToTopo() const;
const IsolationLegacy & isolation(const std::string & thrType, size_t bit) const;
private:
/** Update the internal members */
virtual void update();
/** EM specific data */
unsigned int m_emScale{1};
unsigned int m_ptMinToTopo{0};
std::map<std::string,std::vector<IsolationLegacy>> m_isolation{};
};
class L1ThrExtraInfo_JETLegacy final : public L1ThrExtraInfoBase {
public:
L1ThrExtraInfo_JETLegacy(const std::string & thrTypeName, const ptree & data);
virtual ~L1ThrExtraInfo_JETLegacy();
unsigned int jetScale() const;
unsigned int ptMinToTopoLargeWindow() const;
unsigned int ptMinToTopoSmallWindow() const;
private:
/** Update the internal members */
virtual void update();
/** JET specific data */
unsigned int m_jetScale{1};
unsigned int m_ptMinToTopoLargeWindow{0};
unsigned int m_ptMinToTopoSmallWindow{0};
};
/***********************************
* Extra info for new thresholds
***********************************/
class L1ThrExtraInfo_eEMTAU final : public L1ThrExtraInfoBase {
public:
L1ThrExtraInfo_eEMTAU(const std::string & thrTypeName, const ptree & data);
virtual ~L1ThrExtraInfo_eEMTAU();
unsigned int ptMinToTopo() const;
const TrigConf::Isolation & isolation(TrigConf::Isolation::WP wp, int eta) const;
const ValueWithEtaDependence<TrigConf::Isolation> & isolation(TrigConf::Isolation::WP wp) const;
private:
/** Update the internal members */
virtual void update();
/** eEM specific data */
unsigned int m_ptMinToTopo{0};
std::map<TrigConf::Isolation::WP, ValueWithEtaDependence<Isolation>> m_isolation{};
};
class L1ThrExtraInfo_jJ final : public L1ThrExtraInfoBase {
public:
L1ThrExtraInfo_jJ(const std::string & thrTypeName, const ptree & data);
virtual ~L1ThrExtraInfo_jJ();
unsigned int ptMinToTopoSmall(int eta) const;
unsigned int ptMinToTopoLarge(int eta) const;
private:
/** Update the internal members */
virtual void update();
/** jJ specific data */
std::map<std::pair<int,int>,unsigned int> m_ptMinToTopoSmall{};
std::map<std::pair<int,int>,unsigned int> m_ptMinToTopoLarge{};
};
class L1ThrExtraInfo_jTAU final : public L1ThrExtraInfoBase {
public:
L1ThrExtraInfo_jTAU(const std::string & thrTypeName, const ptree & data);
virtual ~L1ThrExtraInfo_jTAU();
unsigned int ptMinToTopo() const;
private:
/** Update the internal members */
virtual void update();
/** jTAU specific data */
unsigned int m_ptMinToTopo{0};
};
class L1ThrExtraInfo_gXE final : public L1ThrExtraInfoBase {
public:
L1ThrExtraInfo_gXE(const std::string & thrTypeName, const ptree & data);
virtual ~L1ThrExtraInfo_gXE();
private:
/** Update the internal members */
virtual void update();
/** gXE specific data */
};
class L1ThrExtraInfo_MU final : public L1ThrExtraInfoBase {
public:
L1ThrExtraInfo_MU(const std::string & thrTypeName, const ptree & data);
virtual ~L1ThrExtraInfo_MU();
unsigned int rpcIdxForPt(unsigned int pt) const;
unsigned int tgcIdxForPt(unsigned int pt) const;
std::vector<unsigned int> knownRpcPtValues() const;
std::vector<unsigned int> knownTgcPtValues() const;
std::vector<std::string> exclusionListNames() const;
const std::map<std::string, std::vector<unsigned int>> & exlusionList(const std::string & listName) const;
private:
/** Update the internal members */
virtual void update();
/** MU specific data */
std::map<unsigned int, unsigned int> m_rpcPtMap; // map of pt value (1..~20) to road index (0..5)
std::map<unsigned int, unsigned int> m_tgcPtMap; // map of pt value (1..~30) to road index (0..15)
std::map<std::string, std::map<std::string, std::vector<unsigned int>>> m_roiExclusionLists; // named lists of excluded rois
};
}
#endif
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFDATA_L1THRESHOLD_H
#define TRIGCONFDATA_L1THRESHOLD_H
#include "TrigConfData/DataStructure.h"
#include <vector>
#include "TrigConfData/L1ThresholdBase.h"
namespace TrigConf {
/**
* @brief L1 threshold configuration
/************************************
*
* Provides access to the L1Topo algorithm name and type and the selection parameters,
* input and output collections. Can hold sorting and decision algorithms
*/
class L1Threshold final : public DataStructure {
* L1Calo legacy thresholds
*
************************************/
class L1Threshold_EM final : public L1Threshold {
public:
L1Threshold_EM( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data);
virtual ~L1Threshold_EM() = default;
unsigned int thrValueCounts(int eta = 0) const override;
uint16_t isolationMask(int eta) const { return m_isolationMask.at(eta); }
void print(std::ostream & os = std::cout) const override;
private:
virtual void update();
ValueWithEtaDependence<uint16_t> m_isolationMask{""};
};
/** Constructor */
L1Threshold();