diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/ConfigSvcBase.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/ConfigSvcBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..46265e486544cf36e5975aa33a54ab350ee95f05
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/ConfigSvcBase.h
@@ -0,0 +1,53 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TrigConfigSvc_ConfigSvcBase
+#define TrigConfigSvc_ConfigSvcBase
+
+#include "AthenaBaseComps/AthService.h"
+
+namespace TrigConf {
+   class TrigDBConnectionConfig;
+   class IStorageMgr;
+   class TrigDBConnectionConfig;
+
+   class ConfigSvcBase : public AthService {
+   public:
+      ConfigSvcBase(const std::string& name, ISvcLocator* pSvcLocator);
+      virtual ~ConfigSvcBase();
+
+      virtual StatusCode initialize();
+
+      virtual void declareCommonProperties();
+
+      // to create db storage manager
+      StatusCode initStorageMgr();
+      StatusCode freeStorageMgr();
+
+      bool fromDB() const { return m_dbconfig != nullptr; }
+
+   protected:
+
+      // properties
+      std::string        m_configSourceString { "XML" };
+      std::string        m_xmlFile { "NONE" };
+      std::string        m_dbServer { "" };
+      std::string        m_dbUser { "" };
+      std::string        m_dbPassword { "" };
+      std::string        m_dbTable { "" };
+      int                m_dbSMKey { 0 };
+      int                m_dbLVL1PSKey { 0 };
+      int                m_dbHLTPSKey { 0 };
+      std::string        m_dbHLTPSKeySet { "" };
+      BooleanProperty    m_useFrontier { false };
+      int                m_printMenuLevel { 1 };
+      std::unique_ptr<TrigDBConnectionConfig> m_dbconfig;
+
+      // the storage manager
+      IStorageMgr*       m_storageMgr { nullptr };
+
+   };
+}
+
+#endif
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/DSConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/DSConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..aedc5fe466296d385ff92a85a00e9e07d8007938
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/DSConfigSvc.h
@@ -0,0 +1,152 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TrigConfig_DSConfigSvc
+#define TrigConfig_DSConfigSvc
+
+#include <stdint.h>
+
+#include "TrigConfL1Data/CTPConfig.h"
+#include "TrigConfHLTData/HLTFrame.h"
+
+#include "GaudiKernel/ServiceHandle.h"
+#include "AthenaBaseComps/AthService.h"
+#include "AthenaKernel/IIOVSvc.h"
+#include "StoreGate/StoreGateSvc.h"
+
+#include "TrigConfInterfaces/ITrigConfigSvc.h"
+
+namespace TXC {
+   class L1TopoMenu;
+}
+
+/**
+ *    @short Service providing the full trigger configuration information, based
+ *           on what is provided by HLTConfigSvc and LVL1ConfigSvc
+ */
+namespace TrigConf {
+
+   class ThresholdConfig;
+   class HLTChainList;
+   class HLTSequenceList;
+   class HLTPrescaleSet;
+   class BunchGroup;
+
+   /**
+    * @brief Service providing the full trigger configuration information, based
+    *        on what is provided by HLTConfigSvc and LVL1ConfigSvc
+    *
+    */
+   class DSConfigSvc : public AthService,
+                       virtual public ITrigConfigSvc
+   {
+
+   public:
+      /// Standard Gaudi Service constructor
+      DSConfigSvc( const std::string& name, ISvcLocator* pSvcLocator );
+      /// Destructor
+      virtual ~DSConfigSvc();
+
+      /**@brief initialize the service*/
+      StatusCode initialize();
+
+      /**@brief finalize the service*/
+      StatusCode finalize();
+
+      /**@brief set the master key of the configuration to be requested*/
+      StatusCode queryInterface( const InterfaceID& riid, void** ppvIF );
+
+      /**@brief L1 topo configuration menu*/
+      const TXC::L1TopoMenu* menu() const;
+
+      /// LVL1 menu and prescales only (no bunchgroups, prescale clocks, etc.)
+      const CTPConfig* ctpConfig() const;
+
+      // not available when reading from detector store
+      // (source of config meta data is COOL or AOD-header)
+      const Muctpi* muctpiConfig()             const;
+      const ThresholdConfig* thresholdConfig() const;
+
+      /**@brief BunchGroupSet
+       *
+       * @returns bunch group set
+       */
+      const BunchGroupSet* bunchGroupSet() const { return m_bunchGroupSet; }
+
+      // HLT accessors
+      const HLTChainList*    chainList() const;
+      const HLTChainList&    chains() const { return m_hltFrame.chains(); }
+      const HLTSequenceList* sequenceList() const;
+      const HLTSequenceList& sequences() const { return m_hltFrame.sequences(); }
+
+      /**@brief configuration master key
+       *
+       * @returns configuration master key
+       */
+      uint32_t masterKey() const { return m_masterKey; }
+
+      /**@brief LVL1 prescale key
+       *
+       * @returns LVL1 prescale configuration key
+       */
+      uint32_t lvl1PrescaleKey() const { return m_lvl1PsKey; }
+
+      /**@brief HLT prescale key
+       *
+       * @returns HLT prescale configuration key
+       */
+      uint32_t hltPrescaleKey() const { return m_hltPsKey; }
+
+      /**@brief Configuration source
+       *
+       * @returns description of the source of the configuration (TriggerDB/XMLfilename)
+       */
+      const std::string& configurationSource() const { return m_configSrc; }
+
+      StatusCode updatePrescaleSets(uint requestcount);
+
+      StatusCode assignPrescalesToChains(uint lumiblock );
+
+   private:
+      StatusCode registerCallbackForFolder( const std::string& foldername,
+                                            bool multichannel );
+      StatusCode update( IOVSVC_CALLBACK_ARGS_P( I, keys ) );
+      StatusCode reset();
+      void setEFLowerChainCounter();
+      void set_ChainlistFromHltPrescaleSet();
+      void set_HltPrescaleSetFromChainlist();
+
+      CTPConfig            m_ctpConfig;       ///< LVL1 configuration
+      HLTFrame             m_hltFrame;        ///< HLT configuration
+
+      ThresholdConfig    * m_thrcfg;          ///< list of thresholds
+      HLTPrescaleSet     * m_prescaleSet;     ///< hlt prescales set
+      uint32_t             m_masterKey;       ///< configuration master key
+      uint32_t             m_lvl1PsKey;       ///< lvl1 prescale key
+      uint32_t             m_hltPsKey;        ///< hlt prescale key
+      uint32_t             m_lvl1BgKey;       ///< lvl1 bunchgroup key
+      std::string          m_configSrc;       ///< Description of the source of the configuration
+
+
+      /// Handle to the Detector Store
+      ServiceHandle< StoreGateSvc > m_detstore;
+
+      std::vector< unsigned char > m_itembgs;       ///< item assignments to bunchgroups
+      TrigConf::BunchGroupSet*     m_bunchGroupSet; ///< bunchgroup definitions
+
+      bool m_readyState;  ///< ready to deliver trigger configuration ?
+      bool m_readLvl1Thr; ///< if set to true, read also the lvl1 thresholds
+      bool m_readLvl1BG;  ///< if set to true, read also the lvl1 bunchgroups
+
+      ///to avoid crashes when a folder is not present and allow for lvl1/htl separation : 
+      /// /* std::string folders will take the info on folders from IOVDbSvc*/
+      std::string m_folders;
+      /// /* hasFolder(folder_name) will return true if folder_name is found in the string returned by IOVDbSvc, false otherwise */
+      bool hasFolder( const std::string& folder_name );
+
+   }; // class DSConfigSvc
+
+} // namespace TrigConf
+
+#endif // TrigConfig_DSConfigSvc__H
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/HLTConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/HLTConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..e80cd8acac50ea6f18377a3f84fb4c316b2933ed
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/HLTConfigSvc.h
@@ -0,0 +1,97 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TrigConfigSvc_HLTConfigSvc
+#define TrigConfigSvc_HLTConfigSvc
+
+#include <string>
+#include <vector>
+
+#include "GaudiKernel/HistoProperty.h"
+#include "StoreGate/StoreGateSvc.h"
+
+#include "TrigConfInterfaces/IHLTConfigSvc.h"
+#include "TrigConfigSvc/ConfigSvcBase.h"
+#include "TrigConfHLTData/HLTFrame.h"
+
+class TH1F;
+class TH2I;
+class TrigTimer;
+
+namespace TrigConf {
+
+   class CTPConfig;
+   class HLTChainList;
+   class HLTSequenceList;
+   class HLTPrescaleSet;
+   class TrigDBConnectionConfig;
+
+   /**
+    * @brief Service providing the HLT trigger configuration chains and sequences
+    *
+    * This service should be accessed, to read the configuration lists
+    */
+   class HLTConfigSvc : public extends1<ConfigSvcBase, IHLTConfigSvc>
+   {
+   public:
+
+      using AthService::AthMessaging::msg;
+
+      // implementing IIHLTConfigSvc
+      const HLTChainList*    chainList() const __attribute__ ((deprecated));
+      const HLTChainList&    chains() const;
+      
+      const HLTSequenceList* sequenceList() const __attribute__ ((deprecated));
+      const HLTSequenceList& sequences() const;
+      
+      /*@brief constructor*/
+      HLTConfigSvc( const std::string& name, ISvcLocator* pSvcLocator );
+      virtual ~HLTConfigSvc();
+
+      StatusCode initialize();
+      StatusCode finalize();
+      StatusCode start();
+
+      StatusCode queryInterface( const InterfaceID& riid, void** ppvIF );
+
+      StatusCode updatePrescaleSets(uint requestcount);
+
+      // Access functions described by IHLTConfigSvc:
+      const HLTFrame*        hltFrame() const { return &m_HLTFrame; }
+      uint32_t               masterKey() const;
+      uint32_t               hltPrescaleKey() const;
+
+      void setL2LowerChainCounter(const CTPConfig*);
+
+   private:
+      StatusCode assignPrescalesToChains(uint lumiblock );
+
+      StatusCode bookHistograms();
+      void applyPrescaleSet(const HLTPrescaleSet& pss);
+    
+      enum ConfigSource { XML, ORACLE, MYSQL, SQLITE, DBLOOKUP };
+
+      StoreGateSvc* m_eventStore;
+
+      // The configuration:
+      HLTFrame    m_HLTFrame; // what for is this varaible - seems unused ???
+
+      uint        m_currentLumiblock;
+      uint        m_currentPSS;
+
+      // Properties:
+      bool            m_setMergedHLT; 
+      std::string     m_partition;
+      Histo1DProperty m_histProp_timePrescaleUpdate;
+
+      // Histograms:
+      TH1F* m_hist_timePrescaleUpdate;
+      TH2I* m_hist_prescaleLB;
+
+      StringProperty  m_PartitionName; // non-empty job-property overwrite value from DataFlowConfig
+
+   };
+}
+
+#endif
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/HLTJobOptionsSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/HLTJobOptionsSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..b69345a80de274487f85bc959af395d3875e83b3
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/HLTJobOptionsSvc.h
@@ -0,0 +1,122 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TrigConfigSvc_HLTJobOptionsSvc
+#define TrigConfigSvc_HLTJobOptionsSvc
+
+#include <string>
+#include <vector>
+#include <memory>
+
+#include "AthenaBaseComps/AthService.h"
+#include "GaudiKernel/IProperty.h"
+#include "GaudiKernel/IJobOptionsSvc.h"
+#include "GaudiKernel/ServiceHandle.h"
+#include "TrigConfigSvc/ConfigSvcBase.h"
+#include "TrigConfigSvc/JobOptionsCatalogue.h"
+
+/**
+ *  $Date: 2009-03-05 18:07:40 $
+ *
+ *  @short Service providing the HLT trigger job properties
+ *
+ *  @author Joerg Stelzer
+ *  @version $Revision: 1.19 $
+ *
+ */
+
+class StatusCode;
+
+namespace TrigConf {
+
+   class TrigDBConnectionConfig;
+   class JobOptionTable;
+  
+   class HLTJobOptionsSvc : public extends2<ConfigSvcBase, IProperty, IJobOptionsSvc>
+   {
+   public:
+
+      using AthService::AthMessaging::msg;
+      
+      // Constructor and destructor
+      HLTJobOptionsSvc( const std::string& name, ISvcLocator* pSvcLocator );
+      virtual ~HLTJobOptionsSvc();
+
+      // Service initialization method
+      virtual StatusCode initialize();
+
+      // Service finalization method
+      virtual StatusCode finalize();
+
+      // IJobOptionsSvc::setMyProperties
+      virtual StatusCode setMyProperties( const std::string& client,
+                                          IProperty* myInt );
+    
+      /// implementation of IJobOptionsSvc::addPropertyToCatalogue
+      virtual StatusCode addPropertyToCatalogue( const std::string& client, 
+                                                 const Property& property );
+    
+      /// implementation of IJobOptionsSvc::removePropertyFromCatalogue
+      virtual StatusCode removePropertyFromCatalogue( const std::string& client, 
+                                                      const std::string& name );
+    
+
+      // implementation of IJobOptionsSvc::getProperties
+      virtual const std::vector<const Property*>* getProperties( const std::string& client) const; 
+
+      // To avoid that the previous method shadowes the Service::getProperties()
+      virtual const std::vector<Property*> & getProperties() const { return Service::getProperties(); }
+
+
+      /// implementation of IJobOptionsSvc::getClients
+      virtual std::vector<std::string> getClients() const;
+    
+      /** look for file 'File' into search path 'Path' 
+       *  and read it to update existing JobOptionsCatalogue 
+       *  @param  File file   name 
+       *  @param  Path search path 
+       *  @return status code 
+       */
+      virtual StatusCode readOptions( const std::string& file      , 
+                                      const std::string& path = "" ) ;
+    
+    
+      StatusCode queryInterface( const InterfaceID& riid, void** ppvIF );
+    
+      // Access functions described by IHLTJobOptionsSvc:
+      StatusCode readDbWithMasterKey();
+
+      // IProperty implementation (needed for initialisation)
+      using Service::setProperty;
+      using Service::getProperty;
+
+      //     virtual StatusCode setProperty(const Property& p);
+      //     virtual StatusCode setProperty(std::string& s) { return Service::setProperty(s); }
+      //     virtual StatusCode setProperty(const std::string& n, const std::string& v) { return Service::setProperty(n,v); }
+
+      //     virtual StatusCode getProperty(Property *p) const;
+      //     virtual const Property& getProperty(const std::string& name) const { return Service::getProperty(name); }
+      //     virtual StatusCode getProperty(const std::string& n, std::string& v) const { return Service::getProperty(n,v); }
+    
+      void PrintCatalogue(std::ostream & os) const;
+
+   private:
+
+      StatusCode FillCatalogue(const JobOptionTable & jot);
+
+      StatusCode readEnv();
+
+      // Properties:
+      std::string m_dirSearchPath;
+      std::string m_sourcePath;
+      std::string m_sourceType;
+      JobOptionsCatalogue m_catalogue;
+
+   }; // class HLTJobOptionsSvc
+
+   // little helper functions -- have been moved to TrigConfL1Data/HelperFunctions class
+
+} // namespace TrigConf
+
+#endif // TrigJobOption_HLTJobOptionsSvc_h
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IHLTConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IHLTConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..12ba6c43290f579d01bdcbc7c82a25a599d8d060
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IHLTConfigSvc.h
@@ -0,0 +1,17 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: IHLTConfigSvc.h 580585 2014-01-29 09:08:03Z krasznaa $
+#ifndef TRIGCONFIGSVC_IHLTCONFIGSVC_H
+#define TRIGCONFIGSVC_IHLTCONFIGSVC_H
+
+// Forward the inclusion:
+#include "TrigConfInterfaces/IHLTConfigSvc.h"
+
+// Warn that this header should not be used anymore:
+#warning "Please switch to including TrigConfInterfaces/IHLTConfigSvc.h"
+
+#endif // TRIGCONFIGSVC_IHLTCONFIGSVC_H
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IIHLTConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IIHLTConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..711826d52c73764e1400188fd4ff9fa59ce187e7
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IIHLTConfigSvc.h
@@ -0,0 +1,17 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: IIHLTConfigSvc.h 580585 2014-01-29 09:08:03Z krasznaa $
+#ifndef TRIGCONFIGSVC_IIHLTCONFIGSVC_H
+#define TRIGCONFIGSVC_IIHLTCONFIGSVC_H
+
+// Forward the inclusion:
+#include "TrigConfInterfaces/IIHLTConfigSvc.h"
+
+// Warn that this header should not be used anymore:
+#warning "Please switch to including TrigConfInterfaces/IIHLTConfigSvc.h"
+
+#endif // TRIGCONFIGSVC_IIHLTCONFIGSVC_H
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IILVL1ConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IILVL1ConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..6015699b2781c2b846edb1a5abbc845d3acac699
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IILVL1ConfigSvc.h
@@ -0,0 +1,17 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: IILVL1ConfigSvc.h 580585 2014-01-29 09:08:03Z krasznaa $
+#ifndef TRIGCONFIGSVC_IILVL1CONFIGSVC_H
+#define TRIGCONFIGSVC_IILVL1CONFIGSVC_H
+
+// Forward the inclusion:
+#include "TrigConfInterfaces/IILVL1ConfigSvc.h"
+
+// Warn that this header should not be used anymore:
+#warning "Please switch to including TrigConfInterfaces/IILVL1ConfigSvc.h"
+
+#endif // TRIGCONFIGSVC_IILVL1CONFIGSVC_H
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IL1TopoConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IL1TopoConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..deaf8244a1eed47ec0665f5699a111007fcf23e5
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/IL1TopoConfigSvc.h
@@ -0,0 +1,17 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: IL1TopoConfigSvc.h 580585 2014-01-29 09:08:03Z krasznaa $
+#ifndef TRIGCONFIGSVC_IL1TOPOCONFIGSVC_H
+#define TRIGCONFIGSVC_IL1TOPOCONFIGSVC_H
+
+// Forward the inclusion:
+#include "TrigConfInterfaces/IL1TopoConfigSvc.h"
+
+// Warn that this header should not be used anymore:
+#warning "Please switch to including TrigConfInterfaces/IL1TopoConfigSvc.h"
+
+#endif // TRIGCONFIGSVC_IL1TOPOCONFIGSVC_H
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/ILVL1ConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/ILVL1ConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..bc1f9ce18f347222451b800ed51e88d21526410b
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/ILVL1ConfigSvc.h
@@ -0,0 +1,17 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ILVL1ConfigSvc.h 580585 2014-01-29 09:08:03Z krasznaa $
+#ifndef TRIGCONFIGSVC_ILVL1CONFIGSVC_H
+#define TRIGCONFIGSVC_ILVL1CONFIGSVC_H
+
+// Forward the inclusion:
+#include "TrigConfInterfaces/ILVL1ConfigSvc.h"
+
+// Warn that this header should not be used anymore:
+#warning "Please switch to including TrigConfInterfaces/ILVL1ConfigSvc.h"
+
+#endif // TRIGCONFIGSVC_ILVL1CONFIGSVC_H
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/ITrigConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/ITrigConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..32479d36c108191e2d38e7b88589ce1809c13e76
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/ITrigConfigSvc.h
@@ -0,0 +1,17 @@
+// Dear emacs, this is -*- c++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: ITrigConfigSvc.h 580585 2014-01-29 09:08:03Z krasznaa $
+#ifndef TRIGCONFIGSVC_ITRIGCONFIGSVC_H
+#define TRIGCONFIGSVC_ITRIGCONFIGSVC_H
+
+// Forward the inclusion:
+#include "TrigConfInterfaces/ITrigConfigSvc.h"
+
+// Warn that this header should not be used anymore:
+#warning "Please switch to including TrigConfInterfaces/ITrigConfigSvc.h"
+
+#endif // TRIGCONFIGSVC_ITRIGCONFIGSVC_H
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/JobOptionsCatalogue.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/JobOptionsCatalogue.h
new file mode 100644
index 0000000000000000000000000000000000000000..594e342649d114e64c7ec11ccaf2899b56e0f0cd
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/JobOptionsCatalogue.h
@@ -0,0 +1,95 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: JobOptionsCatalogue.h,v 1.1 2007-07-29 13:25:43 stelzer Exp $
+#ifndef GAUDISVC_JOBOPTIONSCATALOGUE_H
+#define GAUDISVC_JOBOPTIONSCATALOGUE_H
+
+#include <string>
+#include <vector>
+
+#include "GaudiKernel/StatusCode.h"
+#include "TrigConfigSvc/JobOptionsList.h"
+
+class MsgStream;
+
+class Property;
+
+namespace TrigConf {
+
+  /** @brief Collection of JobOptionsList 's, one for each algorithm*/
+  class JobOptionsCatalogue {
+  public:
+
+    /**@brief default constructor*/
+    JobOptionsCatalogue() {}
+
+    /**@brief destructor*/
+    virtual ~JobOptionsCatalogue();
+
+    /**@brief add property to algorithm
+     *
+     * @param[in] myAlg name of the algorithm
+     *
+     * @param[in] myOpt property to be added
+     */
+    virtual void addOption( const std::string myAlg, const Property* const& myOpt );
+
+    /**@brief retrieve all properties of an algorithm
+     *
+     * @param[in] myAlg name of the algorithm
+     *
+     * @param[out] myOpts reference to a property list that is filled
+     *
+     * @returns StatusCode about the success of the operation (success if it found the algorithm)
+     */
+    virtual StatusCode optionsOf( const std::string& myAlg,
+                                  std::vector<const Property*>*& myOpts) const;
+
+    /**@brief resolves all properties
+     *
+     * @returns StatusCode if no unresolved properties were found
+     */
+    virtual StatusCode resolveOptions(MsgStream& msgStream);
+
+    /**@brief resolves all properties
+     *
+     * @returns StatusCode if no unresolved properties were found
+     */
+    virtual void printUnresolvedOptions(MsgStream& msgStream);
+
+    /**@brief creates vector of all algorithm names
+     *
+     * @returns vector of all algorithm names 
+     */
+    virtual std::vector<std::string> getClients() const;
+
+  private:
+    typedef std::vector<JobOptionsList*>::iterator  algorithmsIterator;
+
+    /**@brief Lookup of a property
+     *
+     * @param which algorithm-property name in the form 'algorithm.property'
+     *
+     * @returns Property or 0 if not found
+     */
+    const Property*    getOption(const std::string& which);
+
+    /**@brief Sets the list of properties for a specified algorithm
+     *
+     * @param[in] myAlg name of the algorithm
+     *
+     * @param[out] myList reference to a JobOptionsList pointer that will be set if the algorithm name was found
+     *
+     * @returns StatusCode about the success of the operation (success if it found the algorithm)
+     */
+    StatusCode         findAlgorithm( const std::string myAlg, JobOptionsList*& myList ) const;
+
+    // data members
+    std::vector<JobOptionsList*>  m_algorithmoptions; ///< vector of JobOptionList 's, one for each algorithm
+  };
+
+} // end of namespace TrigConf
+
+#endif
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/JobOptionsList.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/JobOptionsList.h
new file mode 100644
index 0000000000000000000000000000000000000000..9176add850daa4ae4ea762e19818da002a7b11f7
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/JobOptionsList.h
@@ -0,0 +1,68 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// JobOptionsList.h: interface for the JobOptionsList class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(JOBOPTIONSLIST_H_INCLUDED_)
+#define JOBOPTIONSLIST_H_INCLUDED_
+
+#include <string>
+#include <vector>
+//#include "GaudiKernel/Property.h"
+
+class Property;
+
+namespace TrigConf {
+
+  /**@brief list of all properties of a single algorithm/component*/
+  class JobOptionsList {
+  public:
+
+    /**@brief constructor with data
+     *
+     * @param myAlg name of the algorithm
+     *
+     * @param myOpt first property
+     */
+    JobOptionsList( const std::string myAlg, const Property* const& myOpt );
+
+    /**@brief destructor
+     *
+     * All properties are deleted
+     */
+    virtual ~JobOptionsList();
+
+    /**@brief add property to the list
+     *
+     * @param myOpt reference to the Property pointer to be added
+     *
+     * JobOptionsList then assumes ownership of the pointer
+     */
+    virtual void addOption( const Property* const& myOpt );
+
+    /**@brief accessor to the name of the algorithm
+     * 
+     * @returns name of algorithm
+     */
+    virtual std::string algorithmName() const;
+
+    /**@brief accessor to the vector of properties
+     * 
+     * @returns pointer to the property vector
+     */
+    virtual const std::vector<const Property*>* properties() const;
+    
+  private:
+    /**@brief default constructor (private)*/
+    JobOptionsList() {}
+    
+    std::vector<const Property*> m_properties;    ///< vector of job properties
+    std::string                  m_algorithmName; ///< name of the algorithm
+  };
+
+} // end of namespace TrigConf
+
+#endif // !defined(JOBOPTIONSLIST_H_INCLUDED_)
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/L1TopoConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/L1TopoConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..07f04a1a763502267cc42fc5f146badf86dd08df
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/L1TopoConfigSvc.h
@@ -0,0 +1,39 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TRIGCONFIGSVC_L1TOPOCONFIGSVC
+#define TRIGCONFIGSVC_L1TOPOCONFIGSVC
+
+#include "TrigConfInterfaces/IL1TopoConfigSvc.h"
+#include "TrigConfigSvc/ConfigSvcBase.h"
+
+#include <memory>
+
+namespace TXC {
+   class L1TopoMenu;
+}
+
+
+namespace TrigConf {
+   class L1TopoConfigSvc : public extends1< ConfigSvcBase, IL1TopoConfigSvc>
+   {
+   public:
+      L1TopoConfigSvc(const std::string& name, ISvcLocator* pSvcLocator);
+      virtual ~L1TopoConfigSvc();
+
+      virtual StatusCode initialize();
+      virtual StatusCode start();
+      virtual StatusCode finalize();
+   
+      virtual const TXC::L1TopoMenu* menu() const { return m_menu.get(); }
+
+   private:
+   
+      std::unique_ptr<TXC::L1TopoMenu> m_menu;
+
+   };
+
+}
+
+#endif
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/LVL1ConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/LVL1ConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a57a5cbfeac66a86a240e0997e32fb56f8cf29f
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/LVL1ConfigSvc.h
@@ -0,0 +1,63 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef TrigConfigSvc_LVL1ConfigSvc
+#define TrigConfigSvc_LVL1ConfigSvc
+
+#include <string>
+
+#include "TrigConfigSvc/ConfigSvcBase.h"
+
+#include "TrigConfInterfaces/ILVL1ConfigSvc.h"
+
+class StoreGateSvc;
+
+namespace TrigConf {
+
+   /**
+    *  $Date: 2009-02-04 09:12:03 $
+    *   @short Service providing the LVL1 trigger configuration
+    *
+    *  @author $Author: stelzer $
+    *  @version $Revision: 1.8 $
+    *
+    */
+   class LVL1ConfigSvc : public extends1<ConfigSvcBase, ILVL1ConfigSvc> {
+   public:
+
+      LVL1ConfigSvc( const std::string& name, ISvcLocator* pSvcLocator );
+      virtual ~LVL1ConfigSvc();
+      
+      StatusCode initialize();
+      StatusCode finalize();
+
+      StatusCode queryInterface( const InterfaceID& riid, void** ppvIF );
+
+      // Access functions described by ILVL1ConfigSvc:
+      const Muctpi* muctpiConfig() const { return m_muctpi; }
+      const CTPConfig* ctpConfig() const { return m_ctpConfig; }
+      const ThresholdConfig* thresholdConfig() const { return m_thrcfg; }
+      const BunchGroupSet* bunchGroupSet() const;
+      uint32_t lvl1PrescaleKey() const { return 0; }
+
+   private:
+      
+      ::StoreGateSvc* m_detectorStore;
+      
+      // the configuration
+      CTPConfig*       m_ctpConfig;
+      ThresholdConfig* m_thrcfg;
+      Muctpi*          m_muctpi;
+
+      // Properties:
+      int m_masterID;
+      int m_prescaleSetID;
+      int m_bunchgroupSetID;
+      BooleanProperty m_dumpTTVmap;
+
+   };
+
+}
+
+#endif
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/TrigConfDataIOVChanger.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/TrigConfDataIOVChanger.h
new file mode 100644
index 0000000000000000000000000000000000000000..6fd9bd124cc5965712338d247bbe89ec46629e0d
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/TrigConfDataIOVChanger.h
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**************************************************************************
+ **
+ **   File:         TrigConfDataIOVChanger.h
+ **
+ **   Description:  - Algorithm-derived class to set the IOV of the trigger
+ **                   configuration meta data according to the run number
+ **
+ * @author Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN
+ **
+ **   CVS ID:       $Id: TrigConfDataIOVChanger.h,v 1.2 2008-03-03 16:51:43 stelzer Exp $
+ **   Created:      Dec 05 2007
+ **
+ **************************************************************************/
+#ifndef TrigConfigSvc_TrigConfDataIOVChanger_h
+#define TrigConfigSvc_TrigConfDataIOVChanger_h
+
+// Base class
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "GaudiKernel/ServiceHandle.h"
+
+// core stuff
+#include "GaudiKernel/ToolHandle.h"
+#include "StoreGate/StoreGate.h"
+#include "StoreGate/StoreGateSvc.h"
+
+// containers
+#include <vector>
+#include <string>
+#include <map>
+
+class CondAttrListCollection;
+
+namespace TrigConf {
+
+  /**
+   * @class TrigConfDataIOVChanger - Algorithm-derived class to be
+   * used when producing ESD/AOD using Trigger Menu configuration from
+   * xml. In this case the menu.xml is converted into COOL/SQlite.db
+   * before the start of the run and read from the SQlite file using
+   * the IOVDbSvc and the metadata detector store. Since the run
+   * number is unknown at the beginning before the start of the run,
+   * the IOV associated with the configuration data is set to
+   * [ValidityKeyMin,ValidityKeyMax). This algorithm reads the run
+   * number from the first event and modifies the IOV of the
+   * configuration metadata in the output metadata store, before it is
+   * written to AOD.
+   * 
+   * @author Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN
+   */
+
+  class TrigConfDataIOVChanger : public AthAlgorithm {
+  public:
+    
+    TrigConfDataIOVChanger(const std::string &name, ISvcLocator *pSvcLocator); //!< std Gaudi Algorithm constructor
+    ~TrigConfDataIOVChanger();                                                 //!< std  deconstructor
+
+    // IAlgorithm virtual methods to implement
+    StatusCode initialize(); //!< std Gaudi initialize method -> read-in trigger configuration
+    StatusCode execute();     //!< std Gaudi execute method  -> fill event-wise TrigDecision object, save in SG
+    StatusCode finalize();    //!< std Gaudi finalize method -> print out statistics
+
+  private:
+
+    bool CheckIOV(const CondAttrListCollection* coll) const;
+    void ChangeIOV(const CondAttrListCollection* coll, unsigned int runNumber) const;
+    CondAttrListCollection* CreatePayload(const CondAttrListCollection* coll, unsigned int runNumber) const;
+    void printOut(const CondAttrListCollection* coll) const;
+
+    bool m_AdjustIOV; //!< Set to true if the IOV needs adjustment (MC production), false for ESD/AOD -> AOD jobs
+
+    unsigned int m_LastRun; //!< the run number of the event last executed
+
+    ServiceHandle<StoreGateSvc> m_storeGate; //!< handle to SG service
+    ServiceHandle<StoreGateSvc> m_metaDataStore; //!< handle to output metadata store
+    ServiceHandle<StoreGateSvc> m_detStore; //!< handle to the detector store
+    
+  };
+}
+
+#endif
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/TrigConfigSvc.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/TrigConfigSvc.h
new file mode 100644
index 0000000000000000000000000000000000000000..babc7e3d3c5e1ec401edac4a99a7375a157e78e0
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/TrigConfigSvc.h
@@ -0,0 +1,90 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/////////////////////////////////////////////////////////////////////
+//
+// NAME:     TrigConfigSvc.h
+// PACKAGE:  TrigConfig
+//
+// AUTHORs:  Till Eifert, University of Geneva
+//
+// CREATED:  27-Dec-2007
+//
+// PURPOSE:
+//
+//////////////////////////////////////////////////////////////////////
+
+#ifndef TrigConfig_TrigConfigSvc
+#define TrigConfig_TrigConfigSvc
+
+#include "AthenaBaseComps/AthService.h"
+#include "TrigConfInterfaces/ITrigConfigSvc.h"
+#include "TrigConfL1Data/CTPConfig.h"
+#include "TrigConfHLTData/HLTFrame.h"
+
+#include <stdint.h>
+
+
+namespace TrigConf {
+
+   enum TrigConfSrc {DS = 0, XML, XMLL1, XMLHLT };
+
+   class TrigConfigSvc : public AthService, 
+                         virtual public ITrigConfigSvc
+   {
+   public:
+
+      TrigConfigSvc( const std::string& name, ISvcLocator* pSvcLocator );
+
+      virtual ~TrigConfigSvc(){}
+
+      StatusCode initialize();
+
+      StatusCode queryInterface( const InterfaceID& riid, void** ppvIF );
+      static const InterfaceID& interfaceID() { return ITrigConfigSvc::interfaceID(); }
+
+      // L1Topo menu
+      const TXC::L1TopoMenu* menu() const;
+
+      // Lvl1 Accessors
+      const Muctpi*          muctpiConfig() const;
+      const CTPConfig*       ctpConfig() const;
+      const ThresholdConfig* thresholdConfig() const;
+      const BunchGroupSet*   bunchGroupSet() const;
+
+      // HLT accessors
+      const HLTChainList*    chainList() const;
+      const HLTChainList&    chains() const;
+      const HLTSequenceList* sequenceList() const;
+      const HLTSequenceList& sequences() const;
+
+      // Super Master Key - 0 if from XML, other cases TBI.
+      uint32_t masterKey() const ;
+      uint32_t lvl1PrescaleKey() const ;
+      uint32_t hltPrescaleKey() const ;
+      std::string configurationSource() const;
+
+      StatusCode updatePrescaleSets(uint requestcount);
+
+      StatusCode assignPrescalesToChains(uint lumiblock );
+
+   private:
+
+      // jobProperties
+      ServiceHandle<TrigConf::IL1TopoConfigSvc> m_l1topoSvc; //!< read from xml/db
+      ServiceHandle<TrigConf::ILVL1ConfigSvc>   m_lvl1Svc; //!< read from xml/db
+      ServiceHandle<TrigConf::IHLTConfigSvc>    m_hltSvc;  //!< read from xml/db
+      ServiceHandle<TrigConf::ITrigConfigSvc >  m_dsSvc;  //!< read from detectorStore (header)
+      std::vector<std::string> m_priorityList;
+      
+      TrigConf::IL1TopoConfigSvc* m_l1toposervice = nullptr;    //!< the available l1 service that will be used
+      TrigConf::ILVL1ConfigSvc*   m_l1service = nullptr;    //!< the available l1 service that will be used
+      TrigConf::IHLTConfigSvc*    m_hltservice = nullptr;   //!< the available hlt service that will be used
+
+      HLTFrame m_NullFrame;
+   };
+
+}
+
+#endif
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/TrigConfigSvcDict.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/TrigConfigSvcDict.h
new file mode 100644
index 0000000000000000000000000000000000000000..8b1f341f5744a6c8a0970fe9abb74ef5050df3b9
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/TrigConfigSvcDict.h
@@ -0,0 +1,26 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "TrigConfHLTData/HLTChainList.h"
+#include "TrigConfHLTData/HLTSequenceList.h"
+#include "TrigConfHLTData/HLTChain.h"
+#include "TrigConfHLTData/HLTSequence.h"
+#include "TrigConfHLTData/HLTSignature.h"
+#include "TrigConfHLTData/HLTTriggerElement.h"
+#include "TrigConfHLTData/HLTTriggerType.h"
+#include "TrigConfHLTData/HLTStreamTag.h"
+
+#include "TrigConfL1Data/TriggerItem.h"
+#include "TrigConfL1Data/CTPConfig.h"
+#include "TrigConfL1Data/L1DataBaseclass.h"
+#include "TrigConfL1Data/TrigConfData.h"
+
+#include "TrigConfigSvc/TrigConfigARA.h"
+#include "TrigConfigSvc/TrigConfigSvcARA.h"
+
+#include <vector>
+namespace {
+   std::vector<TrigConf::HLTChain*> vc;
+   std::vector<TrigConf::HLTSequence*> vs;
+}
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/Verifyer.h b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/Verifyer.h
new file mode 100644
index 0000000000000000000000000000000000000000..1212ee6c61b473b96c6c6c47efb34cd1c433468a
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/Verifyer.h
@@ -0,0 +1,60 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+#ifndef TRIGCONFSVC_VERIFYER_H
+#define TRIGCONFSVC_VERIFYER_H
+
+class MsgStream;
+
+namespace TrigConf {
+
+  // Forward include(s):
+  class Menu;
+
+  /**
+   *  $Date: 2006-08-08 08:21:39 $
+   *
+   *    @short Class used to check the validity of the loaded configuration
+   *
+   *           As the users will be able to load their own trigger configuration XMLs, this
+   *           class is used to check whether the loaded configuration is valid.
+   *
+   *      @see TrigCongInterface::Menu
+   *
+   *   @author $Author: haller $
+   *  @version $Revision: 1.2 $
+   *
+   */
+  class Verifyer {
+
+  public:
+    /// This is the general verification function called from the outside
+    static bool verify( const Menu& menu, MsgStream& log );
+
+    //
+    // Constants used by the class, and providing them to the outside:
+    //
+    static const unsigned int MUON_CABLE_MASK;
+    static const unsigned int CP1_CABLE_MASK;
+    static const unsigned int CP2_CABLE_MASK;
+    static const unsigned int JEP1_CABLE_MASK;
+    static const unsigned int JEP2_CABLE_MASK;
+    static const unsigned int JEP3_CABLE_MASK;
+
+  private:
+    // These are the test called by verify():
+    static bool verifyThCount( const Menu& menu, MsgStream& log );
+    static bool verifyThLayout( const Menu& menu, MsgStream& log );
+
+    // Helper functions:
+    static unsigned int createMask( int startbit, int stopbit );
+    template< class T > static T max( T i, T j );
+    template< class T > static T min( T i, T j );
+
+  }; // class Verifyer
+
+} // namespace TrigConf
+
+#endif // TRIGCONFSVC_VERIFYER_H
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/selection.xml b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/selection.xml
new file mode 100644
index 0000000000000000000000000000000000000000..20bf7ed421045a359bf4a39783e585a2dfcfcb3a
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/TrigConfigSvc/selection.xml
@@ -0,0 +1,26 @@
+<lcgdict>
+ <class name="TrigConf::HLTChainList"/>
+ <class name="TrigConf::HLTSequenceList"/>
+ <class name="std::vector<TrigConf::HLTChain*>"/>
+ <class name="TrigConf::HLTChain"/>
+ <class name="std::vector<TrigConf::HLTSignature*>"/>
+ <class name="TrigConf::HLTSignature"/>
+ <class name="std::vector<TrigConf::HLTTriggerElement*>"/>
+ <class name="TrigConf::HLTTriggerElement"/>
+ <class name="std::vector<TrigConf::HLTTriggerType*>"/>
+ <class name="TrigConf::HLTTriggerType"/>
+ <class name="std::vector<TrigConf::HLTStreamTag*>"/>
+ <class name="TrigConf::HLTStreamTag"/>
+ <class name="std::vector<TrigConf::HLTSequence*>"/>
+ <class name="TrigConf::HLTSequence"/>
+
+ <class name="TrigConf::TrigConfigARA"/>
+ <class name="TrigConf::TrigConfigSvcARA"/>
+
+ <class name="TrigConf::TriggerItem"/>
+ <class name="TrigConf::CTPConfig"/>
+ <class name="TrigConf::L1DataBaseclass"/>
+ <class name="TrigConf::TrigConfData"/>
+ <class name="TrigConf::ThresholdConfig"/>
+
+</lcgdict>
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/cmt/requirements b/Trigger/TrigConfiguration/TrigConfigSvc/cmt/requirements
new file mode 100644
index 0000000000000000000000000000000000000000..b51c37eefdc07cdefb7d3fa39404e98770f3f910
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/cmt/requirements
@@ -0,0 +1,64 @@
+package TrigConfigSvc
+author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
+manager Joerg.Stelzer@cern.ch
+
+use  AtlasPolicy                AtlasPolicy-*
+
+use  AthenaBaseComps            AthenaBaseComps-*               Control
+use  StoreGate                  StoreGate-*                     Control
+use  GaudiInterface             GaudiInterface-*                External
+use  AthenaKernel               AthenaKernel-*                  Control
+use  TrigSteeringEvent          TrigSteeringEvent-*             Trigger/TrigEvent
+use  TrigConfL1Data             TrigConfL1Data-*                Trigger/TrigConfiguration
+use  TrigConfHLTData            TrigConfHLTData-*               Trigger/TrigConfiguration
+use  TrigConfInterfaces         TrigConfInterfaces-*            Trigger/TrigConfiguration
+
+private
+use  AthenaKernel               AthenaKernel-*                  Control
+use  IOVDbDataModel             IOVDbDataModel-*                Database
+use  AthenaPoolUtilities        AthenaPoolUtilities-*           Database/AthenaPOOL
+use  AtlasBoost                 AtlasBoost-*                    External
+use  AtlasCOOL                  AtlasCOOL-*                     External
+use  AtlasROOT                  AtlasROOT-*                     External
+use  EventInfo                  EventInfo-*                     Event
+use  PathResolver               PathResolver-*                  Tools
+use  TrigConfJobOptData         TrigConfJobOptData-*            Trigger/TrigConfiguration
+use  TrigConfStorage            TrigConfStorage-*               Trigger/TrigConfiguration
+use  TrigConfBase               TrigConfBase-*                  Trigger/TrigConfiguration
+use  TrigMonitorBase            TrigMonitorBase-*               Trigger/TrigMonitoring
+use  L1TopoConfig               L1TopoConfig-*                  Trigger/TrigT1/L1Topo
+end_private
+
+## temporarily, for getting the executable script: checkTrigger.py 
+use AtlasPyROOT	AtlasPyROOT-*	External -no_auto_imports
+apply_pattern declare_scripts files="checkTrigger.py checkTriggerConfig.py -s=$(PyUtils_root)/bin"
+# some handy aliases
+alias checkTrigger     checkTrigger.py
+
+
+apply_pattern dual_use_library files=*.cxx
+
+apply_pattern declare_joboptions files="*.py"
+
+apply_pattern declare_python_modules files="*.py"
+
+
+apply_pattern declare_xmls
+apply_pattern install_xmls
+
+private
+## reflection has been moved to TrigConfigOffline
+#use     AtlasReflex               AtlasReflex-*          External -no_auto_import
+#apply_pattern lcgdict dict=TrigConfigSvc selectionfile=selection.xml \
+#        headerfiles="../TrigConfigSvc/TrigConfigSvcDict.h"
+
+#application TrigConfigARATest "test/TrigConfigARATest.cxx" 	 
+#macro_append TrigConfigARATest_dependencies TrigConfigSvcLib
+#apply_pattern application_alias TrigConfigARATest
+
+#application MetaDataChainLoad "test/MetaDataChainLoad.cxx"
+#macro_append MetaDataChainLoad_dependencies TrigConfigSvcLib
+
+#macro_append ROOT_linkopts " -lPyROOT"
+
+end_private
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/data/LVL1Config.xml b/Trigger/TrigConfiguration/TrigConfigSvc/data/LVL1Config.xml
new file mode 100755
index 0000000000000000000000000000000000000000..146bd5e24b79fbc160f25f8dc3f341a0da432bcc
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/data/LVL1Config.xml
@@ -0,0 +1,2509 @@
+<?xml version="1.0" ?>
+<LVL1Config>
+  <!--File is auto-generated by python config class, may be overwritten-->
+  <!--By: tkohno on: Wed Sep 19 11:42:30 2007-->
+  <!--No. L1 thresholds defined: 54-->
+  <!--No. L1 items defined: 123-->
+  <TriggerMenu comment="test comment" group="0" id="1" name="lumi01" phase="lumi" version="1.0">
+    <TriggerItem ctpid="0" definition="(1)" name="L1_EM3" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="EM3_x1" triggerthreshold="EM3"/>
+    </TriggerItem>
+    <TriggerItem ctpid="1" definition="(1)" name="L1_EM7" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="EM7_x1" triggerthreshold="EM7"/>
+    </TriggerItem>
+    <TriggerItem ctpid="2" definition="(1)" name="L1_EM13" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="EM13_x1" triggerthreshold="EM13"/>
+    </TriggerItem>
+    <TriggerItem ctpid="3" definition="(1)" name="L1_EM13I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="EM13I_x1" triggerthreshold="EM13I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="4" definition="(1)" name="L1_EM18" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="EM18_x1" triggerthreshold="EM18"/>
+    </TriggerItem>
+    <TriggerItem ctpid="5" definition="(1)" name="L1_EM18I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="EM18I_x1" triggerthreshold="EM18I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="6" definition="(1)" name="L1_EM23I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="EM23I_x1" triggerthreshold="EM23I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="7" definition="(1)" name="L1_EM100" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="EM100_x1" triggerthreshold="EM100"/>
+    </TriggerItem>
+    <TriggerItem ctpid="8" definition="(1)" name="L1_2EM3" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="EM3_x2" triggerthreshold="EM3"/>
+    </TriggerItem>
+    <TriggerItem ctpid="9" definition="(1)" name="L1_2EM7" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="EM7_x2" triggerthreshold="EM7"/>
+    </TriggerItem>
+    <TriggerItem ctpid="11" definition="(1)" name="L1_2EM13" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="EM13_x2" triggerthreshold="EM13"/>
+    </TriggerItem>
+    <TriggerItem ctpid="12" definition="(1)" name="L1_2EM13I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="EM13I_x2" triggerthreshold="EM13I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="13" definition="(1)" name="L1_2EM18" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="EM18_x2" triggerthreshold="EM18"/>
+    </TriggerItem>
+    <TriggerItem ctpid="14" definition="(1)" name="L1_2EM18I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="EM18I_x2" triggerthreshold="EM18I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="15" definition="(1)" name="L1_2EM23I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="EM18I_x2" triggerthreshold="EM18I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="16" definition="(1)" name="L1_2EM3_EM7" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="EM3_x2" triggerthreshold="EM3"/>
+        <TriggerCondition multi="1" name="EM7_x1" triggerthreshold="EM7"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="17" definition="(1)" name="L1_3EM7" trigger_type="0" version="1.0">
+      <TriggerCondition multi="3" name="EM7_x3" triggerthreshold="EM7"/>
+    </TriggerItem>
+    <TriggerItem ctpid="32" definition="(1)" name="L1_MU4" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="MU4_x1" triggerthreshold="MU4"/>
+    </TriggerItem>
+    <TriggerItem ctpid="33" definition="(1)" name="L1_MU6" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="MU6_x1" triggerthreshold="MU6"/>
+    </TriggerItem>
+    <TriggerItem ctpid="34" definition="(1)" name="L1_MU10" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="MU10_x1" triggerthreshold="MU10"/>
+    </TriggerItem>
+    <TriggerItem ctpid="35" definition="(1)" name="L1_MU11" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="MU11_x1" triggerthreshold="MU11"/>
+    </TriggerItem>
+    <TriggerItem ctpid="36" definition="(1)" name="L1_MU20" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="MU20_x1" triggerthreshold="MU20"/>
+    </TriggerItem>
+    <TriggerItem ctpid="37" definition="(1)" name="L1_MU40" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="MU40_x1" triggerthreshold="MU40"/>
+    </TriggerItem>
+    <TriggerItem ctpid="38" definition="(1)" name="L1_2MU4" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="MU4_x2" triggerthreshold="MU4"/>
+    </TriggerItem>
+    <TriggerItem ctpid="39" definition="(1)" name="L1_2MU6" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="MU6_x2" triggerthreshold="MU6"/>
+    </TriggerItem>
+    <TriggerItem ctpid="40" definition="(1)" name="L1_2MU10" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="MU10_x2" triggerthreshold="MU10"/>
+    </TriggerItem>
+    <TriggerItem ctpid="41" definition="(1)" name="L1_2MU11" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="MU11_x2" triggerthreshold="MU11"/>
+    </TriggerItem>
+    <TriggerItem ctpid="42" definition="(1)" name="L1_2MU20" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="MU20_x2" triggerthreshold="MU20"/>
+    </TriggerItem>
+    <TriggerItem ctpid="43" definition="(1)" name="L1_3MU6" trigger_type="0" version="1.0">
+      <TriggerCondition multi="3" name="MU6_x3" triggerthreshold="MU6"/>
+    </TriggerItem>
+    <TriggerItem ctpid="64" definition="(1)" name="L1_TAU5" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="HA5_x1" triggerthreshold="HA5"/>
+    </TriggerItem>
+    <TriggerItem ctpid="65" definition="(1)" name="L1_TAU6" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="HA6_x1" triggerthreshold="HA6"/>
+    </TriggerItem>
+    <TriggerItem ctpid="66" definition="(1)" name="L1_TAU9I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="HA9I_x1" triggerthreshold="HA9I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="67" definition="(1)" name="L1_TAU11I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="HA11I_x1" triggerthreshold="HA11I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="68" definition="(1)" name="L1_TAU16I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="HA16I_x1" triggerthreshold="HA16I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="69" definition="(1)" name="L1_TAU25" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="HA25_x1" triggerthreshold="HA25"/>
+    </TriggerItem>
+    <TriggerItem ctpid="70" definition="(1)" name="L1_TAU25I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="HA25I_x1" triggerthreshold="HA25I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="71" definition="(1)" name="L1_TAU40" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="HA40_x1" triggerthreshold="HA40"/>
+    </TriggerItem>
+    <TriggerItem ctpid="72" definition="(1)" name="L1_2TAU6" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="HA6_x2" triggerthreshold="HA6"/>
+    </TriggerItem>
+    <TriggerItem ctpid="73" definition="(1)" name="L1_2TAU9I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="HA9I_x2" triggerthreshold="HA9I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="74" definition="(1)" name="L1_2TAU6_TAU16I" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="HA6_x2" triggerthreshold="HA6"/>
+        <TriggerCondition multi="1" name="HA16I_x1" triggerthreshold="HA16I"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="75" definition="(1)" name="L1_2TAU16I" trigger_type="0" version="1.0">
+      <TriggerCondition multi="2" name="HA16I_x2" triggerthreshold="HA16I"/>
+    </TriggerItem>
+    <TriggerItem ctpid="76" definition="(1)" name="L1_2TAU6_TAU25" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="HA6_x2" triggerthreshold="HA6"/>
+        <TriggerCondition multi="1" name="HA25_x1" triggerthreshold="HA25"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="96" definition="(1)" name="L1_J5" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="J5_x1" triggerthreshold="J5"/>
+    </TriggerItem>
+    <TriggerItem ctpid="97" definition="(1)" name="L1_J10" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="J10_x1" triggerthreshold="J10"/>
+    </TriggerItem>
+    <TriggerItem ctpid="98" definition="(1)" name="L1_J18" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="J18_x1" triggerthreshold="J18"/>
+    </TriggerItem>
+    <TriggerItem ctpid="99" definition="(1)" name="L1_J23" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="J23_x1" triggerthreshold="J23"/>
+    </TriggerItem>
+    <TriggerItem ctpid="100" definition="(1)" name="L1_J35" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="J35_x1" triggerthreshold="J35"/>
+    </TriggerItem>
+    <TriggerItem ctpid="101" definition="(1)" name="L1_J42" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="J42_x1" triggerthreshold="J42"/>
+    </TriggerItem>
+    <TriggerItem ctpid="102" definition="(1)" name="L1_J70" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="J70_x1" triggerthreshold="J70"/>
+    </TriggerItem>
+    <TriggerItem ctpid="103" definition="(1)" name="L1_J100" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="J100_x1" triggerthreshold="J100"/>
+    </TriggerItem>
+    <TriggerItem ctpid="104" definition="(1)" name="L1_3J10" trigger_type="0" version="1.0">
+      <TriggerCondition multi="3" name="J10_x3" triggerthreshold="J10"/>
+    </TriggerItem>
+    <TriggerItem ctpid="105" definition="(1)" name="L1_4J10" trigger_type="0" version="1.0">
+      <TriggerCondition multi="4" name="J10_x4" triggerthreshold="J10"/>
+    </TriggerItem>
+    <TriggerItem ctpid="106" definition="(1)" name="L1_3J18" trigger_type="0" version="1.0">
+      <TriggerCondition multi="3" name="J18_x3" triggerthreshold="J18"/>
+    </TriggerItem>
+    <TriggerItem ctpid="107" definition="(1)" name="L1_4J18" trigger_type="0" version="1.0">
+      <TriggerCondition multi="4" name="J18_x4" triggerthreshold="J18"/>
+    </TriggerItem>
+    <TriggerItem ctpid="108" definition="(1)" name="L1_4J23" trigger_type="0" version="1.0">
+      <TriggerCondition multi="4" name="J23_x4" triggerthreshold="J23"/>
+    </TriggerItem>
+    <TriggerItem ctpid="112" definition="(1)" name="L1_FJ10" trigger_type="0" version="1.0">
+      <OR>
+        <TriggerCondition multi="1" name="JF10_x1" triggerthreshold="JF10"/>
+        <TriggerCondition multi="1" name="JB10_x1" triggerthreshold="JB10"/>
+      </OR>
+    </TriggerItem>
+    <TriggerItem ctpid="113" definition="(1)" name="L1_FJ18" trigger_type="0" version="1.0">
+      <OR>
+        <TriggerCondition multi="1" name="JF18_x1" triggerthreshold="JF18"/>
+        <TriggerCondition multi="1" name="JB18_x1" triggerthreshold="JB18"/>
+      </OR>
+    </TriggerItem>
+    <TriggerItem ctpid="114" definition="(1)" name="L1_FJ26" trigger_type="0" version="1.0">
+      <OR>
+        <TriggerCondition multi="1" name="JF26_x1" triggerthreshold="JF26"/>
+        <TriggerCondition multi="1" name="JB26_x1" triggerthreshold="JB26"/>
+      </OR>
+    </TriggerItem>
+    <TriggerItem ctpid="115" definition="(1)" name="L1_FJ65" trigger_type="0" version="1.0">
+      <OR>
+        <TriggerCondition multi="1" name="JF65_x1" triggerthreshold="JF65"/>
+        <TriggerCondition multi="1" name="JB65_x1" triggerthreshold="JB65"/>
+      </OR>
+    </TriggerItem>
+    <TriggerItem ctpid="116" definition="(1)" name="L1_2FJ10" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="JF10_x1" triggerthreshold="JF10"/>
+        <TriggerCondition multi="1" name="JB10_x1" triggerthreshold="JB10"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="117" definition="(1)" name="L1_2FJ18" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="JF18_x1" triggerthreshold="JF18"/>
+        <TriggerCondition multi="1" name="JB18_x1" triggerthreshold="JB18"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="118" definition="(1)" name="L1_2FJ26" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="JF26_x1" triggerthreshold="JF26"/>
+        <TriggerCondition multi="1" name="JB26_x1" triggerthreshold="JB26"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="128" definition="(1)" name="L1_XE15" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="XE15_x1" triggerthreshold="XE15"/>
+    </TriggerItem>
+    <TriggerItem ctpid="129" definition="(1)" name="L1_XE20" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="XE20_x1" triggerthreshold="XE20"/>
+    </TriggerItem>
+    <TriggerItem ctpid="130" definition="(1)" name="L1_XE25" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="XE25_x1" triggerthreshold="XE25"/>
+    </TriggerItem>
+    <TriggerItem ctpid="131" definition="(1)" name="L1_XE30" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+    </TriggerItem>
+    <TriggerItem ctpid="132" definition="(1)" name="L1_XE40" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="XE40_x1" triggerthreshold="XE40"/>
+    </TriggerItem>
+    <TriggerItem ctpid="133" definition="(1)" name="L1_XE50" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="XE50_x1" triggerthreshold="XE50"/>
+    </TriggerItem>
+    <TriggerItem ctpid="134" definition="(1)" name="L1_XE70" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="XE70_x1" triggerthreshold="XE70"/>
+    </TriggerItem>
+    <TriggerItem ctpid="135" definition="(1)" name="L1_XE80" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="XE80_x1" triggerthreshold="XE80"/>
+    </TriggerItem>
+    <TriggerItem ctpid="144" definition="(1)" name="L1_TE100" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="TE100_x1" triggerthreshold="TE100"/>
+    </TriggerItem>
+    <TriggerItem ctpid="145" definition="(1)" name="L1_TE200" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="TE200_x1" triggerthreshold="TE200"/>
+    </TriggerItem>
+    <TriggerItem ctpid="146" definition="(1)" name="L1_TE304" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="TE304_x1" triggerthreshold="TE304"/>
+    </TriggerItem>
+    <TriggerItem ctpid="147" definition="(1)" name="L1_TE380" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="TE380_x1" triggerthreshold="TE380"/>
+    </TriggerItem>
+    <TriggerItem ctpid="148" definition="(1)" name="L1_JE20" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="JE20_x1" triggerthreshold="JE20"/>
+    </TriggerItem>
+    <TriggerItem ctpid="149" definition="(1)" name="L1_JE80" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="JE80_x1" triggerthreshold="JE80"/>
+    </TriggerItem>
+    <TriggerItem ctpid="150" definition="(1)" name="L1_JE172" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="JE172_x1" triggerthreshold="JE172"/>
+    </TriggerItem>
+    <TriggerItem ctpid="151" definition="(1)" name="L1_JE256" trigger_type="0" version="1.0">
+      <TriggerCondition multi="1" name="JE256_x1" triggerthreshold="JE256"/>
+    </TriggerItem>
+    <TriggerItem ctpid="160" definition="(1)" name="L1_EM13_XE20" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="EM13_x1" triggerthreshold="EM13"/>
+        <TriggerCondition multi="1" name="XE20_x1" triggerthreshold="XE20"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="161" definition="(1)" name="L1_EM18_XE15" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="EM18_x1" triggerthreshold="EM18"/>
+        <TriggerCondition multi="1" name="XE15_x1" triggerthreshold="XE15"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="168" definition="(1)" name="L1_EM18_XE30" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="EM18_x1" triggerthreshold="EM18"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="162" definition="(1)" name="L1_2EM7_MU6" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="EM7_x2" triggerthreshold="EM7"/>
+        <TriggerCondition multi="1" name="MU6_x1" triggerthreshold="MU6"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="163" definition="(1)" name="L1_2EM13_MU6" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="EM13_x2" triggerthreshold="EM13"/>
+        <TriggerCondition multi="1" name="MU6_x1" triggerthreshold="MU6"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="164" definition="(1)" name="L1_2EM18_MU6" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="EM18_x2" triggerthreshold="EM18"/>
+        <TriggerCondition multi="1" name="MU6_x1" triggerthreshold="MU6"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="165" definition="(1)" name="L1_EM7_MU6" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="EM7_x1" triggerthreshold="EM7"/>
+        <TriggerCondition multi="1" name="MU6_x1" triggerthreshold="MU6"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="166" definition="(1)" name="L1_EM7_XE30" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="EM7_x1" triggerthreshold="EM7"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="167" definition="(1)" name="L1_2EM3_TAU6" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="EM3_x2" triggerthreshold="EM3"/>
+        <TriggerCondition multi="1" name="HA6_x1" triggerthreshold="HA6"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="170" definition="(1)" name="L1_2TAU6_EM7" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="HA6_x2" triggerthreshold="HA6"/>
+        <TriggerCondition multi="1" name="EM7_x1" triggerthreshold="EM7"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="171" definition="(1)" name="L1_2TAU6_TAU9I_EM7" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="HA6_x2" triggerthreshold="HA6"/>
+        <TriggerCondition multi="1" name="HA9I_x1" triggerthreshold="HA9I"/>
+        <TriggerCondition multi="1" name="EM7_x1" triggerthreshold="EM7"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="172" definition="(1)" name="L1_2TAU6_TAU11I_EM7" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="HA6_x2" triggerthreshold="HA6"/>
+        <TriggerCondition multi="1" name="HA11I_x1" triggerthreshold="HA11I"/>
+        <TriggerCondition multi="1" name="EM7_x1" triggerthreshold="EM7"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="173" definition="(1)" name="L1_2TAU9I_EM13I" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="HA9I_x2" triggerthreshold="HA9I"/>
+        <TriggerCondition multi="1" name="EM13I_x1" triggerthreshold="EM13I"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="176" definition="(1)" name="L1_MU11_XE15" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="MU11_x1" triggerthreshold="MU11"/>
+        <TriggerCondition multi="1" name="XE15_x1" triggerthreshold="XE15"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="183" definition="(1)" name="L1_MU20_XE30" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="MU20_x1" triggerthreshold="MU20"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="177" definition="(1)" name="L1_MU4_J10" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="MU4_x1" triggerthreshold="MU4"/>
+        <TriggerCondition multi="1" name="J10_x1" triggerthreshold="J10"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="178" definition="(1)" name="L1_MU4_J5" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="MU4_x1" triggerthreshold="MU4"/>
+        <TriggerCondition multi="1" name="J5_x1" triggerthreshold="J5"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="179" definition="(1)" name="L1_MU4_EM3" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="MU4_x1" triggerthreshold="MU4"/>
+        <TriggerCondition multi="1" name="EM3_x1" triggerthreshold="EM3"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="180" definition="(1)" name="L1_MU6_J5" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="MU6_x1" triggerthreshold="MU6"/>
+        <TriggerCondition multi="1" name="J5_x1" triggerthreshold="J5"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="181" definition="(1)" name="L1_MU6_EM3" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="MU6_x1" triggerthreshold="MU6"/>
+        <TriggerCondition multi="1" name="EM3_x1" triggerthreshold="EM3"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="182" definition="(1)" name="L1_2MU6_EM7" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="MU6_x2" triggerthreshold="MU6"/>
+        <TriggerCondition multi="1" name="EM7_x1" triggerthreshold="EM7"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="184" definition="(1)" name="L1_TAU9I_MU6" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA9I_x1" triggerthreshold="HA9I"/>
+        <TriggerCondition multi="1" name="MU6_x1" triggerthreshold="MU6"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="185" definition="(1)" name="L1_TAU9I_MU10" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA9I_x1" triggerthreshold="HA9I"/>
+        <TriggerCondition multi="1" name="MU10_x1" triggerthreshold="MU10"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="186" definition="(1)" name="L1_TAU11I_MU6" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA11I_x1" triggerthreshold="HA11I"/>
+        <TriggerCondition multi="1" name="MU6_x1" triggerthreshold="MU6"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="187" definition="(1)" name="L1_TAU11I_MU10" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA11I_x1" triggerthreshold="HA11I"/>
+        <TriggerCondition multi="1" name="MU10_x1" triggerthreshold="MU10"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="192" definition="(1)" name="L1_J70_XE30" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="J70_x1" triggerthreshold="J70"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="193" definition="(1)" name="L1_2J42_XE30" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="2" name="J42_x2" triggerthreshold="J42"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="194" definition="(1)" name="L1_J42_XE30_EM13I" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="J42_x1" triggerthreshold="J42"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+        <TriggerCondition multi="1" name="EM13I_x1" triggerthreshold="EM13I"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="195" definition="(1)" name="L1_J42_XE30_MU11" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="J42_x1" triggerthreshold="J42"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+        <TriggerCondition multi="1" name="MU11_x1" triggerthreshold="MU11"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="196" definition="(1)" name="L1_4J23_EM13I" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="4" name="J23_x4" triggerthreshold="J23"/>
+        <TriggerCondition multi="1" name="EM13I_x1" triggerthreshold="EM13I"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="197" definition="(1)" name="L1_4J23_MU11" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="4" name="J23_x4" triggerthreshold="J23"/>
+        <TriggerCondition multi="1" name="MU11_x1" triggerthreshold="MU11"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="208" definition="(1)" name="L1_TAU6_XE20" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA6_x1" triggerthreshold="HA6"/>
+        <TriggerCondition multi="1" name="XE20_x1" triggerthreshold="XE20"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="209" definition="(1)" name="L1_TAU9I_XE20" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA9I_x1" triggerthreshold="HA9I"/>
+        <TriggerCondition multi="1" name="XE20_x1" triggerthreshold="XE20"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="210" definition="(1)" name="L1_TAU9I_XE30" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA9I_x1" triggerthreshold="HA9I"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="211" definition="(1)" name="L1_TAU9I_XE40" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA9I_x1" triggerthreshold="HA9I"/>
+        <TriggerCondition multi="1" name="XE40_x1" triggerthreshold="XE40"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="212" definition="(1)" name="L1_TAU11I_XE30" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA11I_x1" triggerthreshold="HA11I"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="213" definition="(1)" name="L1_TAU16I_XE20" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA16I_x1" triggerthreshold="HA16I"/>
+        <TriggerCondition multi="1" name="XE20_x1" triggerthreshold="XE20"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="214" definition="(1)" name="L1_TAU16I_XE30" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA16I_x1" triggerthreshold="HA16I"/>
+        <TriggerCondition multi="1" name="XE30_x1" triggerthreshold="XE30"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="215" definition="(1)" name="L1_TAU16I_XE40" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA16I_x1" triggerthreshold="HA16I"/>
+        <TriggerCondition multi="1" name="XE40_x1" triggerthreshold="XE40"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="216" definition="(1)" name="L1_TAU25I_XE20" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA25I_x1" triggerthreshold="HA25I"/>
+        <TriggerCondition multi="1" name="XE20_x1" triggerthreshold="XE20"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="217" definition="(1)" name="L1_TAU25_XE40" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA25_x1" triggerthreshold="HA25"/>
+        <TriggerCondition multi="1" name="XE40_x1" triggerthreshold="XE40"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="218" definition="(1)" name="L1_TAU9I_2J5_J35" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA9I_x1" triggerthreshold="HA9I"/>
+        <TriggerCondition multi="2" name="J5_x2" triggerthreshold="J5"/>
+        <TriggerCondition multi="1" name="J35_x1" triggerthreshold="J35"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="219" definition="(1)" name="L1_TAU11I_2J5_J18" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA11I_x1" triggerthreshold="HA11I"/>
+        <TriggerCondition multi="2" name="J5_x2" triggerthreshold="J5"/>
+        <TriggerCondition multi="1" name="J35_x1" triggerthreshold="J35"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="220" definition="(1)" name="L1_TAU11I_2J5_J35" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA11I_x1" triggerthreshold="HA11I"/>
+        <TriggerCondition multi="2" name="J5_x2" triggerthreshold="J5"/>
+        <TriggerCondition multi="1" name="J18_x1" triggerthreshold="J18"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="221" definition="(1)" name="L1_TAU9I_4J23" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="HA9I_x1" triggerthreshold="HA9I"/>
+        <TriggerCondition multi="4" name="J23_x4" triggerthreshold="J23"/>
+      </AND>
+    </TriggerItem>
+    <TriggerItem ctpid="222" definition="(1)" name="L1_MBTS_1" trigger_type="0" version="1.0">
+      <OR>
+        <TriggerCondition multi="1" name="MBTS1_x1" triggerthreshold="MBTS_A"/>
+        <TriggerCondition multi="1" name="MBTS1_x1" triggerthreshold="MBTS_C"/>
+      </OR>
+    </TriggerItem>
+    <TriggerItem ctpid="223" definition="(1)" name="L1_MBTS_2" trigger_type="0" version="1.0">
+      <OR>
+        <TriggerCondition multi="2" name="MBTS1_x2" triggerthreshold="MBTS_A"/>
+        <TriggerCondition multi="2" name="MBTS1_x2" triggerthreshold="MBTS_C"/>
+      </OR>
+    </TriggerItem>
+    <TriggerItem ctpid="224" definition="(1)" name="L1_MBTS_1_1" trigger_type="0" version="1.0">
+      <AND>
+        <TriggerCondition multi="1" name="MBTS1_x1" triggerthreshold="MBTS_A"/>
+        <TriggerCondition multi="1" name="MBTS1_x1" triggerthreshold="MBTS_C"/>
+      </AND>
+    </TriggerItem>
+  </TriggerMenu>
+  <TriggerCounterList/>
+  <PrescaleSet name="standard" version="1.0">
+    <Prescale ctpid="0">
+      60
+    </Prescale>
+    <Prescale ctpid="1">
+      1
+    </Prescale>
+    <Prescale ctpid="2">
+      1
+    </Prescale>
+    <Prescale ctpid="3">
+      1
+    </Prescale>
+    <Prescale ctpid="4">
+      1
+    </Prescale>
+    <Prescale ctpid="5">
+      1
+    </Prescale>
+    <Prescale ctpid="6">
+      1
+    </Prescale>
+    <Prescale ctpid="7">
+      1
+    </Prescale>
+    <Prescale ctpid="8">
+      1
+    </Prescale>
+    <Prescale ctpid="9">
+      1
+    </Prescale>
+    <Prescale ctpid="10">
+      1
+    </Prescale>
+    <Prescale ctpid="11">
+      1
+    </Prescale>
+    <Prescale ctpid="12">
+      1
+    </Prescale>
+    <Prescale ctpid="13">
+      1
+    </Prescale>
+    <Prescale ctpid="14">
+      1
+    </Prescale>
+    <Prescale ctpid="15">
+      1
+    </Prescale>
+    <Prescale ctpid="16">
+      1
+    </Prescale>
+    <Prescale ctpid="17">
+      1
+    </Prescale>
+    <Prescale ctpid="18">
+      1
+    </Prescale>
+    <Prescale ctpid="19">
+      1
+    </Prescale>
+    <Prescale ctpid="20">
+      1
+    </Prescale>
+    <Prescale ctpid="21">
+      1
+    </Prescale>
+    <Prescale ctpid="22">
+      1
+    </Prescale>
+    <Prescale ctpid="23">
+      1
+    </Prescale>
+    <Prescale ctpid="24">
+      1
+    </Prescale>
+    <Prescale ctpid="25">
+      1
+    </Prescale>
+    <Prescale ctpid="26">
+      1
+    </Prescale>
+    <Prescale ctpid="27">
+      1
+    </Prescale>
+    <Prescale ctpid="28">
+      1
+    </Prescale>
+    <Prescale ctpid="29">
+      1
+    </Prescale>
+    <Prescale ctpid="30">
+      1
+    </Prescale>
+    <Prescale ctpid="31">
+      1
+    </Prescale>
+    <Prescale ctpid="32">
+      1
+    </Prescale>
+    <Prescale ctpid="33">
+      1
+    </Prescale>
+    <Prescale ctpid="34">
+      1
+    </Prescale>
+    <Prescale ctpid="35">
+      1
+    </Prescale>
+    <Prescale ctpid="36">
+      1
+    </Prescale>
+    <Prescale ctpid="37">
+      1
+    </Prescale>
+    <Prescale ctpid="38">
+      1
+    </Prescale>
+    <Prescale ctpid="39">
+      1
+    </Prescale>
+    <Prescale ctpid="40">
+      1
+    </Prescale>
+    <Prescale ctpid="41">
+      1
+    </Prescale>
+    <Prescale ctpid="42">
+      1
+    </Prescale>
+    <Prescale ctpid="43">
+      1
+    </Prescale>
+    <Prescale ctpid="44">
+      1
+    </Prescale>
+    <Prescale ctpid="45">
+      1
+    </Prescale>
+    <Prescale ctpid="46">
+      1
+    </Prescale>
+    <Prescale ctpid="47">
+      1
+    </Prescale>
+    <Prescale ctpid="48">
+      1
+    </Prescale>
+    <Prescale ctpid="49">
+      1
+    </Prescale>
+    <Prescale ctpid="50">
+      1
+    </Prescale>
+    <Prescale ctpid="51">
+      1
+    </Prescale>
+    <Prescale ctpid="52">
+      1
+    </Prescale>
+    <Prescale ctpid="53">
+      1
+    </Prescale>
+    <Prescale ctpid="54">
+      1
+    </Prescale>
+    <Prescale ctpid="55">
+      1
+    </Prescale>
+    <Prescale ctpid="56">
+      1
+    </Prescale>
+    <Prescale ctpid="57">
+      1
+    </Prescale>
+    <Prescale ctpid="58">
+      1
+    </Prescale>
+    <Prescale ctpid="59">
+      1
+    </Prescale>
+    <Prescale ctpid="60">
+      1
+    </Prescale>
+    <Prescale ctpid="61">
+      1
+    </Prescale>
+    <Prescale ctpid="62">
+      1
+    </Prescale>
+    <Prescale ctpid="63">
+      1
+    </Prescale>
+    <Prescale ctpid="64">
+      10000000
+    </Prescale>
+    <Prescale ctpid="65">
+      1500
+    </Prescale>
+    <Prescale ctpid="66">
+      1000000
+    </Prescale>
+    <Prescale ctpid="67">
+      1500
+    </Prescale>
+    <Prescale ctpid="68">
+      1000000
+    </Prescale>
+    <Prescale ctpid="69">
+      8
+    </Prescale>
+    <Prescale ctpid="70">
+      4
+    </Prescale>
+    <Prescale ctpid="71">
+      1
+    </Prescale>
+    <Prescale ctpid="72">
+      100
+    </Prescale>
+    <Prescale ctpid="73">
+      1
+    </Prescale>
+    <Prescale ctpid="74">
+      1
+    </Prescale>
+    <Prescale ctpid="75">
+      1
+    </Prescale>
+    <Prescale ctpid="76">
+      1
+    </Prescale>
+    <Prescale ctpid="77">
+      1
+    </Prescale>
+    <Prescale ctpid="78">
+      1
+    </Prescale>
+    <Prescale ctpid="79">
+      1
+    </Prescale>
+    <Prescale ctpid="80">
+      1
+    </Prescale>
+    <Prescale ctpid="81">
+      1
+    </Prescale>
+    <Prescale ctpid="82">
+      1
+    </Prescale>
+    <Prescale ctpid="83">
+      1
+    </Prescale>
+    <Prescale ctpid="84">
+      1
+    </Prescale>
+    <Prescale ctpid="85">
+      1
+    </Prescale>
+    <Prescale ctpid="86">
+      1
+    </Prescale>
+    <Prescale ctpid="87">
+      1
+    </Prescale>
+    <Prescale ctpid="88">
+      1
+    </Prescale>
+    <Prescale ctpid="89">
+      1
+    </Prescale>
+    <Prescale ctpid="90">
+      1
+    </Prescale>
+    <Prescale ctpid="91">
+      1
+    </Prescale>
+    <Prescale ctpid="92">
+      1
+    </Prescale>
+    <Prescale ctpid="93">
+      1
+    </Prescale>
+    <Prescale ctpid="94">
+      1
+    </Prescale>
+    <Prescale ctpid="95">
+      1
+    </Prescale>
+    <Prescale ctpid="96">
+      1000000
+    </Prescale>
+    <Prescale ctpid="97">
+      42000
+    </Prescale>
+    <Prescale ctpid="98">
+      6000
+    </Prescale>
+    <Prescale ctpid="99">
+      2000
+    </Prescale>
+    <Prescale ctpid="100">
+      500
+    </Prescale>
+    <Prescale ctpid="101">
+      50
+    </Prescale>
+    <Prescale ctpid="102">
+      5
+    </Prescale>
+    <Prescale ctpid="103">
+      1
+    </Prescale>
+    <Prescale ctpid="104">
+      150
+    </Prescale>
+    <Prescale ctpid="105">
+      30
+    </Prescale>
+    <Prescale ctpid="106">
+      1
+    </Prescale>
+    <Prescale ctpid="107">
+      1
+    </Prescale>
+    <Prescale ctpid="108">
+      1
+    </Prescale>
+    <Prescale ctpid="109">
+      1
+    </Prescale>
+    <Prescale ctpid="110">
+      1
+    </Prescale>
+    <Prescale ctpid="111">
+      1
+    </Prescale>
+    <Prescale ctpid="112">
+      9000
+    </Prescale>
+    <Prescale ctpid="113">
+      1500
+    </Prescale>
+    <Prescale ctpid="114">
+      700
+    </Prescale>
+    <Prescale ctpid="115">
+      1
+    </Prescale>
+    <Prescale ctpid="116">
+      1500
+    </Prescale>
+    <Prescale ctpid="117">
+      30
+    </Prescale>
+    <Prescale ctpid="118">
+      1
+    </Prescale>
+    <Prescale ctpid="119">
+      1
+    </Prescale>
+    <Prescale ctpid="120">
+      1
+    </Prescale>
+    <Prescale ctpid="121">
+      1
+    </Prescale>
+    <Prescale ctpid="122">
+      1
+    </Prescale>
+    <Prescale ctpid="123">
+      1
+    </Prescale>
+    <Prescale ctpid="124">
+      1
+    </Prescale>
+    <Prescale ctpid="125">
+      1
+    </Prescale>
+    <Prescale ctpid="126">
+      1
+    </Prescale>
+    <Prescale ctpid="127">
+      1
+    </Prescale>
+    <Prescale ctpid="128">
+      30000
+    </Prescale>
+    <Prescale ctpid="129">
+      7000
+    </Prescale>
+    <Prescale ctpid="130">
+      1500
+    </Prescale>
+    <Prescale ctpid="131">
+      200
+    </Prescale>
+    <Prescale ctpid="132">
+      20
+    </Prescale>
+    <Prescale ctpid="133">
+      2
+    </Prescale>
+    <Prescale ctpid="134">
+      1
+    </Prescale>
+    <Prescale ctpid="135">
+      1
+    </Prescale>
+    <Prescale ctpid="136">
+      1
+    </Prescale>
+    <Prescale ctpid="137">
+      1
+    </Prescale>
+    <Prescale ctpid="138">
+      1
+    </Prescale>
+    <Prescale ctpid="139">
+      1
+    </Prescale>
+    <Prescale ctpid="140">
+      1
+    </Prescale>
+    <Prescale ctpid="141">
+      1
+    </Prescale>
+    <Prescale ctpid="142">
+      1
+    </Prescale>
+    <Prescale ctpid="143">
+      1
+    </Prescale>
+    <Prescale ctpid="144">
+      86000
+    </Prescale>
+    <Prescale ctpid="145">
+      1800
+    </Prescale>
+    <Prescale ctpid="146">
+      19
+    </Prescale>
+    <Prescale ctpid="147">
+      1
+    </Prescale>
+    <Prescale ctpid="148">
+      21000
+    </Prescale>
+    <Prescale ctpid="149">
+      1000
+    </Prescale>
+    <Prescale ctpid="150">
+      28
+    </Prescale>
+    <Prescale ctpid="151">
+      1
+    </Prescale>
+    <Prescale ctpid="152">
+      1
+    </Prescale>
+    <Prescale ctpid="153">
+      1
+    </Prescale>
+    <Prescale ctpid="154">
+      1
+    </Prescale>
+    <Prescale ctpid="155">
+      1
+    </Prescale>
+    <Prescale ctpid="156">
+      1
+    </Prescale>
+    <Prescale ctpid="157">
+      1
+    </Prescale>
+    <Prescale ctpid="158">
+      1
+    </Prescale>
+    <Prescale ctpid="159">
+      1
+    </Prescale>
+    <Prescale ctpid="160">
+      1
+    </Prescale>
+    <Prescale ctpid="161">
+      1
+    </Prescale>
+    <Prescale ctpid="162">
+      1
+    </Prescale>
+    <Prescale ctpid="163">
+      1
+    </Prescale>
+    <Prescale ctpid="164">
+      1
+    </Prescale>
+    <Prescale ctpid="165">
+      1
+    </Prescale>
+    <Prescale ctpid="166">
+      1
+    </Prescale>
+    <Prescale ctpid="167">
+      1
+    </Prescale>
+    <Prescale ctpid="168">
+      1
+    </Prescale>
+    <Prescale ctpid="169">
+      1
+    </Prescale>
+    <Prescale ctpid="170">
+      1000000
+    </Prescale>
+    <Prescale ctpid="171">
+      1
+    </Prescale>
+    <Prescale ctpid="172">
+      1
+    </Prescale>
+    <Prescale ctpid="173">
+      1
+    </Prescale>
+    <Prescale ctpid="174">
+      1
+    </Prescale>
+    <Prescale ctpid="175">
+      1
+    </Prescale>
+    <Prescale ctpid="176">
+      1
+    </Prescale>
+    <Prescale ctpid="177">
+      1
+    </Prescale>
+    <Prescale ctpid="178">
+      1
+    </Prescale>
+    <Prescale ctpid="179">
+      1
+    </Prescale>
+    <Prescale ctpid="180">
+      1
+    </Prescale>
+    <Prescale ctpid="181">
+      1
+    </Prescale>
+    <Prescale ctpid="182">
+      1
+    </Prescale>
+    <Prescale ctpid="183">
+      1
+    </Prescale>
+    <Prescale ctpid="184">
+      1
+    </Prescale>
+    <Prescale ctpid="185">
+      1
+    </Prescale>
+    <Prescale ctpid="186">
+      1
+    </Prescale>
+    <Prescale ctpid="187">
+      1
+    </Prescale>
+    <Prescale ctpid="188">
+      1
+    </Prescale>
+    <Prescale ctpid="189">
+      1
+    </Prescale>
+    <Prescale ctpid="190">
+      1
+    </Prescale>
+    <Prescale ctpid="191">
+      1
+    </Prescale>
+    <Prescale ctpid="192">
+      1
+    </Prescale>
+    <Prescale ctpid="193">
+      1
+    </Prescale>
+    <Prescale ctpid="194">
+      1
+    </Prescale>
+    <Prescale ctpid="195">
+      1
+    </Prescale>
+    <Prescale ctpid="196">
+      1
+    </Prescale>
+    <Prescale ctpid="197">
+      1
+    </Prescale>
+    <Prescale ctpid="198">
+      1
+    </Prescale>
+    <Prescale ctpid="199">
+      1
+    </Prescale>
+    <Prescale ctpid="200">
+      1
+    </Prescale>
+    <Prescale ctpid="201">
+      1
+    </Prescale>
+    <Prescale ctpid="202">
+      1
+    </Prescale>
+    <Prescale ctpid="203">
+      1
+    </Prescale>
+    <Prescale ctpid="204">
+      1
+    </Prescale>
+    <Prescale ctpid="205">
+      1
+    </Prescale>
+    <Prescale ctpid="206">
+      1
+    </Prescale>
+    <Prescale ctpid="207">
+      1
+    </Prescale>
+    <Prescale ctpid="208">
+      1000000
+    </Prescale>
+    <Prescale ctpid="209">
+      1
+    </Prescale>
+    <Prescale ctpid="210">
+      1
+    </Prescale>
+    <Prescale ctpid="211">
+      1
+    </Prescale>
+    <Prescale ctpid="212">
+      1
+    </Prescale>
+    <Prescale ctpid="213">
+      1000000
+    </Prescale>
+    <Prescale ctpid="214">
+      1000000
+    </Prescale>
+    <Prescale ctpid="215">
+      1
+    </Prescale>
+    <Prescale ctpid="216">
+      1000000
+    </Prescale>
+    <Prescale ctpid="217">
+      1
+    </Prescale>
+    <Prescale ctpid="218">
+      1
+    </Prescale>
+    <Prescale ctpid="219">
+      1
+    </Prescale>
+    <Prescale ctpid="220">
+      1
+    </Prescale>
+    <Prescale ctpid="221">
+      1
+    </Prescale>
+    <Prescale ctpid="222">
+      1
+    </Prescale>
+    <Prescale ctpid="223">
+      1
+    </Prescale>
+    <Prescale ctpid="224">
+      1
+    </Prescale>
+    <Prescale ctpid="225">
+      1
+    </Prescale>
+    <Prescale ctpid="226">
+      1
+    </Prescale>
+    <Prescale ctpid="227">
+      1
+    </Prescale>
+    <Prescale ctpid="228">
+      1
+    </Prescale>
+    <Prescale ctpid="229">
+      1
+    </Prescale>
+    <Prescale ctpid="230">
+      1
+    </Prescale>
+    <Prescale ctpid="231">
+      1
+    </Prescale>
+    <Prescale ctpid="232">
+      1
+    </Prescale>
+    <Prescale ctpid="233">
+      1
+    </Prescale>
+    <Prescale ctpid="234">
+      1
+    </Prescale>
+    <Prescale ctpid="235">
+      1
+    </Prescale>
+    <Prescale ctpid="236">
+      1
+    </Prescale>
+    <Prescale ctpid="237">
+      1
+    </Prescale>
+    <Prescale ctpid="238">
+      1
+    </Prescale>
+    <Prescale ctpid="239">
+      1
+    </Prescale>
+    <Prescale ctpid="240">
+      1
+    </Prescale>
+    <Prescale ctpid="241">
+      1
+    </Prescale>
+    <Prescale ctpid="242">
+      1
+    </Prescale>
+    <Prescale ctpid="243">
+      1
+    </Prescale>
+    <Prescale ctpid="244">
+      1
+    </Prescale>
+    <Prescale ctpid="245">
+      1
+    </Prescale>
+    <Prescale ctpid="246">
+      1
+    </Prescale>
+    <Prescale ctpid="247">
+      1
+    </Prescale>
+    <Prescale ctpid="248">
+      1
+    </Prescale>
+    <Prescale ctpid="249">
+      1
+    </Prescale>
+    <Prescale ctpid="250">
+      1
+    </Prescale>
+    <Prescale ctpid="251">
+      1
+    </Prescale>
+    <Prescale ctpid="252">
+      1
+    </Prescale>
+    <Prescale ctpid="253">
+      1
+    </Prescale>
+    <Prescale ctpid="254">
+      1
+    </Prescale>
+    <Prescale ctpid="255">
+      1
+    </Prescale>
+  </PrescaleSet>
+  <PrioritySet name="standard" version="1.0">
+    <Priority ctpid="0">
+      LOW
+    </Priority>
+    <Priority ctpid="1">
+      LOW
+    </Priority>
+    <Priority ctpid="2">
+      LOW
+    </Priority>
+    <Priority ctpid="3">
+      LOW
+    </Priority>
+    <Priority ctpid="4">
+      LOW
+    </Priority>
+    <Priority ctpid="5">
+      LOW
+    </Priority>
+    <Priority ctpid="6">
+      LOW
+    </Priority>
+    <Priority ctpid="7">
+      LOW
+    </Priority>
+    <Priority ctpid="8">
+      LOW
+    </Priority>
+    <Priority ctpid="9">
+      LOW
+    </Priority>
+    <Priority ctpid="10">
+      LOW
+    </Priority>
+    <Priority ctpid="11">
+      LOW
+    </Priority>
+    <Priority ctpid="12">
+      LOW
+    </Priority>
+    <Priority ctpid="13">
+      LOW
+    </Priority>
+    <Priority ctpid="14">
+      LOW
+    </Priority>
+    <Priority ctpid="15">
+      LOW
+    </Priority>
+    <Priority ctpid="16">
+      LOW
+    </Priority>
+    <Priority ctpid="17">
+      LOW
+    </Priority>
+    <Priority ctpid="18">
+      LOW
+    </Priority>
+    <Priority ctpid="19">
+      LOW
+    </Priority>
+    <Priority ctpid="20">
+      LOW
+    </Priority>
+    <Priority ctpid="21">
+      LOW
+    </Priority>
+    <Priority ctpid="22">
+      LOW
+    </Priority>
+    <Priority ctpid="23">
+      LOW
+    </Priority>
+    <Priority ctpid="24">
+      LOW
+    </Priority>
+    <Priority ctpid="25">
+      LOW
+    </Priority>
+    <Priority ctpid="26">
+      LOW
+    </Priority>
+    <Priority ctpid="27">
+      LOW
+    </Priority>
+    <Priority ctpid="28">
+      LOW
+    </Priority>
+    <Priority ctpid="29">
+      LOW
+    </Priority>
+    <Priority ctpid="30">
+      LOW
+    </Priority>
+    <Priority ctpid="31">
+      LOW
+    </Priority>
+    <Priority ctpid="32">
+      LOW
+    </Priority>
+    <Priority ctpid="33">
+      LOW
+    </Priority>
+    <Priority ctpid="34">
+      LOW
+    </Priority>
+    <Priority ctpid="35">
+      LOW
+    </Priority>
+    <Priority ctpid="36">
+      LOW
+    </Priority>
+    <Priority ctpid="37">
+      LOW
+    </Priority>
+    <Priority ctpid="38">
+      LOW
+    </Priority>
+    <Priority ctpid="39">
+      LOW
+    </Priority>
+    <Priority ctpid="40">
+      LOW
+    </Priority>
+    <Priority ctpid="41">
+      LOW
+    </Priority>
+    <Priority ctpid="42">
+      LOW
+    </Priority>
+    <Priority ctpid="43">
+      LOW
+    </Priority>
+    <Priority ctpid="44">
+      LOW
+    </Priority>
+    <Priority ctpid="45">
+      LOW
+    </Priority>
+    <Priority ctpid="46">
+      LOW
+    </Priority>
+    <Priority ctpid="47">
+      LOW
+    </Priority>
+    <Priority ctpid="48">
+      LOW
+    </Priority>
+    <Priority ctpid="49">
+      LOW
+    </Priority>
+    <Priority ctpid="50">
+      LOW
+    </Priority>
+    <Priority ctpid="51">
+      LOW
+    </Priority>
+    <Priority ctpid="52">
+      LOW
+    </Priority>
+    <Priority ctpid="53">
+      LOW
+    </Priority>
+    <Priority ctpid="54">
+      LOW
+    </Priority>
+    <Priority ctpid="55">
+      LOW
+    </Priority>
+    <Priority ctpid="56">
+      LOW
+    </Priority>
+    <Priority ctpid="57">
+      LOW
+    </Priority>
+    <Priority ctpid="58">
+      LOW
+    </Priority>
+    <Priority ctpid="59">
+      LOW
+    </Priority>
+    <Priority ctpid="60">
+      LOW
+    </Priority>
+    <Priority ctpid="61">
+      LOW
+    </Priority>
+    <Priority ctpid="62">
+      LOW
+    </Priority>
+    <Priority ctpid="63">
+      LOW
+    </Priority>
+    <Priority ctpid="64">
+      LOW
+    </Priority>
+    <Priority ctpid="65">
+      LOW
+    </Priority>
+    <Priority ctpid="66">
+      LOW
+    </Priority>
+    <Priority ctpid="67">
+      LOW
+    </Priority>
+    <Priority ctpid="68">
+      LOW
+    </Priority>
+    <Priority ctpid="69">
+      LOW
+    </Priority>
+    <Priority ctpid="70">
+      LOW
+    </Priority>
+    <Priority ctpid="71">
+      LOW
+    </Priority>
+    <Priority ctpid="72">
+      LOW
+    </Priority>
+    <Priority ctpid="73">
+      LOW
+    </Priority>
+    <Priority ctpid="74">
+      LOW
+    </Priority>
+    <Priority ctpid="75">
+      LOW
+    </Priority>
+    <Priority ctpid="76">
+      LOW
+    </Priority>
+    <Priority ctpid="77">
+      LOW
+    </Priority>
+    <Priority ctpid="78">
+      LOW
+    </Priority>
+    <Priority ctpid="79">
+      LOW
+    </Priority>
+    <Priority ctpid="80">
+      LOW
+    </Priority>
+    <Priority ctpid="81">
+      LOW
+    </Priority>
+    <Priority ctpid="82">
+      LOW
+    </Priority>
+    <Priority ctpid="83">
+      LOW
+    </Priority>
+    <Priority ctpid="84">
+      LOW
+    </Priority>
+    <Priority ctpid="85">
+      LOW
+    </Priority>
+    <Priority ctpid="86">
+      LOW
+    </Priority>
+    <Priority ctpid="87">
+      LOW
+    </Priority>
+    <Priority ctpid="88">
+      LOW
+    </Priority>
+    <Priority ctpid="89">
+      LOW
+    </Priority>
+    <Priority ctpid="90">
+      LOW
+    </Priority>
+    <Priority ctpid="91">
+      LOW
+    </Priority>
+    <Priority ctpid="92">
+      LOW
+    </Priority>
+    <Priority ctpid="93">
+      LOW
+    </Priority>
+    <Priority ctpid="94">
+      LOW
+    </Priority>
+    <Priority ctpid="95">
+      LOW
+    </Priority>
+    <Priority ctpid="96">
+      LOW
+    </Priority>
+    <Priority ctpid="97">
+      LOW
+    </Priority>
+    <Priority ctpid="98">
+      LOW
+    </Priority>
+    <Priority ctpid="99">
+      LOW
+    </Priority>
+    <Priority ctpid="100">
+      LOW
+    </Priority>
+    <Priority ctpid="101">
+      LOW
+    </Priority>
+    <Priority ctpid="102">
+      LOW
+    </Priority>
+    <Priority ctpid="103">
+      LOW
+    </Priority>
+    <Priority ctpid="104">
+      LOW
+    </Priority>
+    <Priority ctpid="105">
+      LOW
+    </Priority>
+    <Priority ctpid="106">
+      LOW
+    </Priority>
+    <Priority ctpid="107">
+      LOW
+    </Priority>
+    <Priority ctpid="108">
+      LOW
+    </Priority>
+    <Priority ctpid="109">
+      LOW
+    </Priority>
+    <Priority ctpid="110">
+      LOW
+    </Priority>
+    <Priority ctpid="111">
+      LOW
+    </Priority>
+    <Priority ctpid="112">
+      LOW
+    </Priority>
+    <Priority ctpid="113">
+      LOW
+    </Priority>
+    <Priority ctpid="114">
+      LOW
+    </Priority>
+    <Priority ctpid="115">
+      LOW
+    </Priority>
+    <Priority ctpid="116">
+      LOW
+    </Priority>
+    <Priority ctpid="117">
+      LOW
+    </Priority>
+    <Priority ctpid="118">
+      LOW
+    </Priority>
+    <Priority ctpid="119">
+      LOW
+    </Priority>
+    <Priority ctpid="120">
+      LOW
+    </Priority>
+    <Priority ctpid="121">
+      LOW
+    </Priority>
+    <Priority ctpid="122">
+      LOW
+    </Priority>
+    <Priority ctpid="123">
+      LOW
+    </Priority>
+    <Priority ctpid="124">
+      LOW
+    </Priority>
+    <Priority ctpid="125">
+      LOW
+    </Priority>
+    <Priority ctpid="126">
+      LOW
+    </Priority>
+    <Priority ctpid="127">
+      LOW
+    </Priority>
+    <Priority ctpid="128">
+      LOW
+    </Priority>
+    <Priority ctpid="129">
+      LOW
+    </Priority>
+    <Priority ctpid="130">
+      LOW
+    </Priority>
+    <Priority ctpid="131">
+      LOW
+    </Priority>
+    <Priority ctpid="132">
+      LOW
+    </Priority>
+    <Priority ctpid="133">
+      LOW
+    </Priority>
+    <Priority ctpid="134">
+      LOW
+    </Priority>
+    <Priority ctpid="135">
+      LOW
+    </Priority>
+    <Priority ctpid="136">
+      LOW
+    </Priority>
+    <Priority ctpid="137">
+      LOW
+    </Priority>
+    <Priority ctpid="138">
+      LOW
+    </Priority>
+    <Priority ctpid="139">
+      LOW
+    </Priority>
+    <Priority ctpid="140">
+      LOW
+    </Priority>
+    <Priority ctpid="141">
+      LOW
+    </Priority>
+    <Priority ctpid="142">
+      LOW
+    </Priority>
+    <Priority ctpid="143">
+      LOW
+    </Priority>
+    <Priority ctpid="144">
+      LOW
+    </Priority>
+    <Priority ctpid="145">
+      LOW
+    </Priority>
+    <Priority ctpid="146">
+      LOW
+    </Priority>
+    <Priority ctpid="147">
+      LOW
+    </Priority>
+    <Priority ctpid="148">
+      LOW
+    </Priority>
+    <Priority ctpid="149">
+      LOW
+    </Priority>
+    <Priority ctpid="150">
+      LOW
+    </Priority>
+    <Priority ctpid="151">
+      LOW
+    </Priority>
+    <Priority ctpid="152">
+      LOW
+    </Priority>
+    <Priority ctpid="153">
+      LOW
+    </Priority>
+    <Priority ctpid="154">
+      LOW
+    </Priority>
+    <Priority ctpid="155">
+      LOW
+    </Priority>
+    <Priority ctpid="156">
+      LOW
+    </Priority>
+    <Priority ctpid="157">
+      LOW
+    </Priority>
+    <Priority ctpid="158">
+      LOW
+    </Priority>
+    <Priority ctpid="159">
+      LOW
+    </Priority>
+    <Priority ctpid="160">
+      LOW
+    </Priority>
+    <Priority ctpid="161">
+      LOW
+    </Priority>
+    <Priority ctpid="162">
+      LOW
+    </Priority>
+    <Priority ctpid="163">
+      LOW
+    </Priority>
+    <Priority ctpid="164">
+      LOW
+    </Priority>
+    <Priority ctpid="165">
+      LOW
+    </Priority>
+    <Priority ctpid="166">
+      LOW
+    </Priority>
+    <Priority ctpid="167">
+      LOW
+    </Priority>
+    <Priority ctpid="168">
+      LOW
+    </Priority>
+    <Priority ctpid="169">
+      LOW
+    </Priority>
+    <Priority ctpid="170">
+      LOW
+    </Priority>
+    <Priority ctpid="171">
+      LOW
+    </Priority>
+    <Priority ctpid="172">
+      LOW
+    </Priority>
+    <Priority ctpid="173">
+      LOW
+    </Priority>
+    <Priority ctpid="174">
+      LOW
+    </Priority>
+    <Priority ctpid="175">
+      LOW
+    </Priority>
+    <Priority ctpid="176">
+      LOW
+    </Priority>
+    <Priority ctpid="177">
+      LOW
+    </Priority>
+    <Priority ctpid="178">
+      LOW
+    </Priority>
+    <Priority ctpid="179">
+      LOW
+    </Priority>
+    <Priority ctpid="180">
+      LOW
+    </Priority>
+    <Priority ctpid="181">
+      LOW
+    </Priority>
+    <Priority ctpid="182">
+      LOW
+    </Priority>
+    <Priority ctpid="183">
+      LOW
+    </Priority>
+    <Priority ctpid="184">
+      LOW
+    </Priority>
+    <Priority ctpid="185">
+      LOW
+    </Priority>
+    <Priority ctpid="186">
+      LOW
+    </Priority>
+    <Priority ctpid="187">
+      LOW
+    </Priority>
+    <Priority ctpid="188">
+      LOW
+    </Priority>
+    <Priority ctpid="189">
+      LOW
+    </Priority>
+    <Priority ctpid="190">
+      LOW
+    </Priority>
+    <Priority ctpid="191">
+      LOW
+    </Priority>
+    <Priority ctpid="192">
+      LOW
+    </Priority>
+    <Priority ctpid="193">
+      LOW
+    </Priority>
+    <Priority ctpid="194">
+      LOW
+    </Priority>
+    <Priority ctpid="195">
+      LOW
+    </Priority>
+    <Priority ctpid="196">
+      LOW
+    </Priority>
+    <Priority ctpid="197">
+      LOW
+    </Priority>
+    <Priority ctpid="198">
+      LOW
+    </Priority>
+    <Priority ctpid="199">
+      LOW
+    </Priority>
+    <Priority ctpid="200">
+      LOW
+    </Priority>
+    <Priority ctpid="201">
+      LOW
+    </Priority>
+    <Priority ctpid="202">
+      LOW
+    </Priority>
+    <Priority ctpid="203">
+      LOW
+    </Priority>
+    <Priority ctpid="204">
+      LOW
+    </Priority>
+    <Priority ctpid="205">
+      LOW
+    </Priority>
+    <Priority ctpid="206">
+      LOW
+    </Priority>
+    <Priority ctpid="207">
+      LOW
+    </Priority>
+    <Priority ctpid="208">
+      LOW
+    </Priority>
+    <Priority ctpid="209">
+      LOW
+    </Priority>
+    <Priority ctpid="210">
+      LOW
+    </Priority>
+    <Priority ctpid="211">
+      LOW
+    </Priority>
+    <Priority ctpid="212">
+      LOW
+    </Priority>
+    <Priority ctpid="213">
+      LOW
+    </Priority>
+    <Priority ctpid="214">
+      LOW
+    </Priority>
+    <Priority ctpid="215">
+      LOW
+    </Priority>
+    <Priority ctpid="216">
+      LOW
+    </Priority>
+    <Priority ctpid="217">
+      LOW
+    </Priority>
+    <Priority ctpid="218">
+      LOW
+    </Priority>
+    <Priority ctpid="219">
+      LOW
+    </Priority>
+    <Priority ctpid="220">
+      LOW
+    </Priority>
+    <Priority ctpid="221">
+      LOW
+    </Priority>
+    <Priority ctpid="222">
+      LOW
+    </Priority>
+    <Priority ctpid="223">
+      LOW
+    </Priority>
+    <Priority ctpid="224">
+      LOW
+    </Priority>
+    <Priority ctpid="225">
+      LOW
+    </Priority>
+    <Priority ctpid="226">
+      LOW
+    </Priority>
+    <Priority ctpid="227">
+      LOW
+    </Priority>
+    <Priority ctpid="228">
+      LOW
+    </Priority>
+    <Priority ctpid="229">
+      LOW
+    </Priority>
+    <Priority ctpid="230">
+      LOW
+    </Priority>
+    <Priority ctpid="231">
+      LOW
+    </Priority>
+    <Priority ctpid="232">
+      LOW
+    </Priority>
+    <Priority ctpid="233">
+      LOW
+    </Priority>
+    <Priority ctpid="234">
+      LOW
+    </Priority>
+    <Priority ctpid="235">
+      LOW
+    </Priority>
+    <Priority ctpid="236">
+      LOW
+    </Priority>
+    <Priority ctpid="237">
+      LOW
+    </Priority>
+    <Priority ctpid="238">
+      LOW
+    </Priority>
+    <Priority ctpid="239">
+      LOW
+    </Priority>
+    <Priority ctpid="240">
+      LOW
+    </Priority>
+    <Priority ctpid="241">
+      LOW
+    </Priority>
+    <Priority ctpid="242">
+      LOW
+    </Priority>
+    <Priority ctpid="243">
+      LOW
+    </Priority>
+    <Priority ctpid="244">
+      LOW
+    </Priority>
+    <Priority ctpid="245">
+      LOW
+    </Priority>
+    <Priority ctpid="246">
+      LOW
+    </Priority>
+    <Priority ctpid="247">
+      LOW
+    </Priority>
+    <Priority ctpid="248">
+      LOW
+    </Priority>
+    <Priority ctpid="249">
+      LOW
+    </Priority>
+    <Priority ctpid="250">
+      LOW
+    </Priority>
+    <Priority ctpid="251">
+      LOW
+    </Priority>
+    <Priority ctpid="252">
+      LOW
+    </Priority>
+    <Priority ctpid="253">
+      LOW
+    </Priority>
+    <Priority ctpid="254">
+      LOW
+    </Priority>
+    <Priority ctpid="255">
+      LOW
+    </Priority>
+  </PrioritySet>
+  <TriggerThresholdList>
+    <TriggerThreshold active="1" bitnum="2" id="1" mapping="0" name="JF10" type="JF" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JFfull" phimax="64" phimin="0" priority="1" thresholdval="1023" type="JF" window="8"/>
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="0" had_isolation="63" had_veto="63" name="JFfull" phimax="64" phimin="0" priority="2" thresholdval="10" type="JF" window="8"/>
+      <Cable connector="CON1" ctpin="SLOT8" name="JEP2">
+        <Signal range_begin="8" range_end="9"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="2" id="2" mapping="0" name="JB10" type="JB" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JBfull" phimax="64" phimin="0" priority="1" thresholdval="1023" type="JB" window="8"/>
+      <TriggerThresholdValue em_isolation="63" etamax="0" etamin="-49" had_isolation="63" had_veto="63" name="JBfull" phimax="64" phimin="0" priority="2" thresholdval="10" type="JB" window="8"/>
+      <Cable connector="CON1" ctpin="SLOT8" name="JEP2">
+        <Signal range_begin="0" range_end="1"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="3" mapping="0" name="JE20" type="JE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JEfull" phimax="64" phimin="0" priority="0" thresholdval="20" type="JE" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="24" range_end="24"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="4" mapping="0" name="TE100" type="TE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TEfull" phimax="64" phimin="0" priority="0" thresholdval="100" type="TE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="0" range_end="0"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="5" mapping="0" name="XE15" type="XE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="XEfull" phimax="64" phimin="0" priority="0" thresholdval="15" type="XE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="4" range_end="4"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="6" mapping="0" name="J5" type="JET" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JETfull" phimax="64" phimin="0" priority="0" thresholdval="5" type="JET" window="4"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="0" range_end="2"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="7" mapping="0" name="HA5" type="TAU" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TAUfull" phimax="64" phimin="0" priority="1" thresholdval="5" type="TAU" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT7" name="CP2">
+        <Signal range_begin="0" range_end="2"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="8" mapping="0" name="MU4" type="MUON" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="MUONfull" phimax="64" phimin="0" priority="0" thresholdval="4" type="MUON" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT9" name="MU">
+        <Signal range_begin="0" range_end="2"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="9" mapping="1" name="EM7" type="EM" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="EMfull" phimax="64" phimin="0" priority="1" thresholdval="7" type="EM" window="0"/>
+      <Cable connector="CON1" ctpin="SLOT7" name="CP1">
+        <Signal range_begin="3" range_end="5"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="10" mapping="1" name="MU6" type="MUON" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="MUONfull" phimax="64" phimin="0" priority="0" thresholdval="5" type="MUON" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT9" name="MU">
+        <Signal range_begin="3" range_end="5"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="11" mapping="1" name="HA6" type="TAU" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TAUfull" phimax="64" phimin="0" priority="1" thresholdval="6" type="TAU" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT7" name="CP2">
+        <Signal range_begin="3" range_end="5"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="12" mapping="1" name="J10" type="JET" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JETfull" phimax="64" phimin="0" priority="0" thresholdval="10" type="JET" window="8"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="3" range_end="5"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="13" mapping="1" name="XE20" type="XE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="XEfull" phimax="64" phimin="0" priority="0" thresholdval="20" type="XE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="5" range_end="5"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="14" mapping="1" name="TE200" type="TE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TEfull" phimax="64" phimin="0" priority="0" thresholdval="200" type="TE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="1" range_end="1"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="15" mapping="1" name="JE80" type="JE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JEfull" phimax="64" phimin="0" priority="0" thresholdval="80" type="JE" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="25" range_end="25"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="2" id="16" mapping="1" name="JB18" type="JB" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JBfull" phimax="64" phimin="0" priority="1" thresholdval="1023" type="JB" window="8"/>
+      <TriggerThresholdValue em_isolation="63" etamax="0" etamin="-49" had_isolation="63" had_veto="63" name="JBfull" phimax="64" phimin="0" priority="2" thresholdval="18" type="JB" window="8"/>
+      <Cable connector="CON1" ctpin="SLOT8" name="JEP2">
+        <Signal range_begin="2" range_end="3"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="2" id="17" mapping="1" name="JF18" type="JF" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JFfull" phimax="64" phimin="0" priority="1" thresholdval="1023" type="JF" window="8"/>
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="0" had_isolation="63" had_veto="63" name="JFfull" phimax="64" phimin="0" priority="2" thresholdval="18" type="JF" window="8"/>
+      <Cable connector="CON1" ctpin="SLOT8" name="JEP2">
+        <Signal range_begin="10" range_end="11"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="18" mapping="2" name="EM13" type="EM" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="EMfull" phimax="64" phimin="0" priority="1" thresholdval="13" type="EM" window="0"/>
+      <Cable connector="CON1" ctpin="SLOT7" name="CP1">
+        <Signal range_begin="6" range_end="8"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="19" mapping="2" name="MU10" type="MUON" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="MUONfull" phimax="64" phimin="0" priority="0" thresholdval="10" type="MUON" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT9" name="MU">
+        <Signal range_begin="6" range_end="8"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="20" mapping="2" name="HA9I" type="TAU" version="1.0">
+      <TriggerThresholdValue em_isolation="6" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TAUfull" phimax="64" phimin="0" priority="1" thresholdval="9" type="TAU" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT7" name="CP2">
+        <Signal range_begin="6" range_end="8"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="21" mapping="2" name="J18" type="JET" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JETfull" phimax="64" phimin="0" priority="0" thresholdval="18" type="JET" window="8"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="6" range_end="8"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="22" mapping="2" name="XE25" type="XE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="XEfull" phimax="64" phimin="0" priority="0" thresholdval="25" type="XE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="6" range_end="6"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="23" mapping="2" name="TE304" type="TE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TEfull" phimax="64" phimin="0" priority="0" thresholdval="304" type="TE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="2" range_end="2"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="24" mapping="2" name="JE172" type="JE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JEfull" phimax="64" phimin="0" priority="0" thresholdval="172" type="JE" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="26" range_end="26"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="2" id="25" mapping="2" name="JB26" type="JB" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JBfull" phimax="64" phimin="0" priority="1" thresholdval="1023" type="JB" window="8"/>
+      <TriggerThresholdValue em_isolation="63" etamax="0" etamin="-49" had_isolation="63" had_veto="63" name="JBfull" phimax="64" phimin="0" priority="2" thresholdval="26" type="JB" window="8"/>
+      <Cable connector="CON1" ctpin="SLOT8" name="JEP2">
+        <Signal range_begin="4" range_end="5"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="2" id="26" mapping="2" name="JF26" type="JF" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JFfull" phimax="64" phimin="0" priority="1" thresholdval="1023" type="JF" window="8"/>
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="0" had_isolation="63" had_veto="63" name="JFfull" phimax="64" phimin="0" priority="2" thresholdval="26" type="JF" window="8"/>
+      <Cable connector="CON1" ctpin="SLOT8" name="JEP2">
+        <Signal range_begin="12" range_end="13"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="27" mapping="3" name="EM13I" type="EM" version="1.0">
+      <TriggerThresholdValue em_isolation="4" etamax="49" etamin="-49" had_isolation="3" had_veto="2" name="EMfull" phimax="64" phimin="0" priority="1" thresholdval="13" type="EM" window="0"/>
+      <Cable connector="CON1" ctpin="SLOT7" name="CP1">
+        <Signal range_begin="9" range_end="11"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="28" mapping="3" name="MU11" type="MUON" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="MUONfull" phimax="64" phimin="0" priority="0" thresholdval="11" type="MUON" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT9" name="MU">
+        <Signal range_begin="9" range_end="11"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="29" mapping="3" name="HA11I" type="TAU" version="1.0">
+      <TriggerThresholdValue em_isolation="6" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TAUfull" phimax="64" phimin="0" priority="1" thresholdval="11" type="TAU" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT7" name="CP2">
+        <Signal range_begin="9" range_end="11"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="30" mapping="3" name="J23" type="JET" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JETfull" phimax="64" phimin="0" priority="0" thresholdval="23" type="JET" window="8"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="9" range_end="11"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="31" mapping="3" name="XE30" type="XE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="XEfull" phimax="64" phimin="0" priority="0" thresholdval="30" type="XE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="7" range_end="7"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="32" mapping="3" name="TE380" type="TE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TEfull" phimax="64" phimin="0" priority="0" thresholdval="380" type="TE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="3" range_end="3"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="33" mapping="3" name="JE256" type="JE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JEfull" phimax="64" phimin="0" priority="0" thresholdval="256" type="JE" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="27" range_end="27"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="2" id="34" mapping="3" name="JB65" type="JB" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JBfull" phimax="64" phimin="0" priority="1" thresholdval="1023" type="JB" window="8"/>
+      <TriggerThresholdValue em_isolation="63" etamax="0" etamin="-49" had_isolation="63" had_veto="63" name="JBfull" phimax="64" phimin="0" priority="2" thresholdval="65" type="JB" window="8"/>
+      <Cable connector="CON1" ctpin="SLOT8" name="JEP2">
+        <Signal range_begin="6" range_end="7"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="2" id="35" mapping="3" name="JF65" type="JF" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JFfull" phimax="64" phimin="0" priority="1" thresholdval="1023" type="JF" window="8"/>
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="0" had_isolation="63" had_veto="63" name="JFfull" phimax="64" phimin="0" priority="2" thresholdval="65" type="JF" window="8"/>
+      <Cable connector="CON1" ctpin="SLOT8" name="JEP2">
+        <Signal range_begin="14" range_end="15"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="36" mapping="4" name="EM18" type="EM" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="EMfull" phimax="64" phimin="0" priority="1" thresholdval="18" type="EM" window="0"/>
+      <Cable connector="CON1" ctpin="SLOT7" name="CP1">
+        <Signal range_begin="12" range_end="14"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="37" mapping="4" name="MU20" type="MUON" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="MUONfull" phimax="64" phimin="0" priority="0" thresholdval="20" type="MUON" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT9" name="MU">
+        <Signal range_begin="12" range_end="14"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="38" mapping="4" name="HA16I" type="TAU" version="1.0">
+      <TriggerThresholdValue em_isolation="6" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TAUfull" phimax="64" phimin="0" priority="1" thresholdval="16" type="TAU" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT7" name="CP2">
+        <Signal range_begin="12" range_end="14"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="39" mapping="4" name="J35" type="JET" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JETfull" phimax="64" phimin="0" priority="0" thresholdval="35" type="JET" window="8"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="12" range_end="14"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="40" mapping="4" name="XE40" type="XE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="XEfull" phimax="64" phimin="0" priority="0" thresholdval="40" type="XE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="8" range_end="8"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="41" mapping="5" name="EM18I" type="EM" version="1.0">
+      <TriggerThresholdValue em_isolation="4" etamax="49" etamin="-49" had_isolation="3" had_veto="2" name="EMfull" phimax="64" phimin="0" priority="1" thresholdval="12" type="EM" window="0"/>
+      <Cable connector="CON1" ctpin="SLOT7" name="CP1">
+        <Signal range_begin="15" range_end="17"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="42" mapping="5" name="MU40" type="MUON" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="MUONfull" phimax="64" phimin="0" priority="0" thresholdval="40" type="MUON" window="0"/>
+      <Cable connector="CON0" ctpin="SLOT9" name="MU">
+        <Signal range_begin="15" range_end="17"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="43" mapping="5" name="HA25" type="TAU" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TAUfull" phimax="64" phimin="0" priority="1" thresholdval="21" type="TAU" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT7" name="CP2">
+        <Signal range_begin="15" range_end="17"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="44" mapping="5" name="J42" type="JET" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JETfull" phimax="64" phimin="0" priority="0" thresholdval="42" type="JET" window="8"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="15" range_end="17"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="45" mapping="5" name="XE50" type="XE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="XEfull" phimax="64" phimin="0" priority="0" thresholdval="50" type="XE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="9" range_end="9"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="46" mapping="6" name="EM23I" type="EM" version="1.0">
+      <TriggerThresholdValue em_isolation="4" etamax="49" etamin="-49" had_isolation="3" had_veto="2" name="EMfull" phimax="64" phimin="0" priority="1" thresholdval="23" type="EM" window="0"/>
+      <Cable connector="CON1" ctpin="SLOT7" name="CP1">
+        <Signal range_begin="18" range_end="20"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="47" mapping="6" name="HA25I" type="TAU" version="1.0">
+      <TriggerThresholdValue em_isolation="6" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TAUfull" phimax="64" phimin="0" priority="1" thresholdval="21" type="TAU" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT7" name="CP2">
+        <Signal range_begin="18" range_end="20"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="48" mapping="6" name="J70" type="JET" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JETfull" phimax="64" phimin="0" priority="0" thresholdval="70" type="JET" window="8"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="18" range_end="20"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="49" mapping="6" name="XE70" type="XE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="XEfull" phimax="64" phimin="0" priority="0" thresholdval="70" type="XE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="10" range_end="10"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="50" mapping="7" name="EM100" type="EM" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="EMfull" phimax="64" phimin="0" priority="1" thresholdval="100" type="EM" window="0"/>
+      <Cable connector="CON1" ctpin="SLOT7" name="CP1">
+        <Signal range_begin="21" range_end="23"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="51" mapping="7" name="HA40" type="TAU" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="TAUfull" phimax="64" phimin="0" priority="1" thresholdval="35" type="TAU" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT7" name="CP2">
+        <Signal range_begin="21" range_end="23"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="52" mapping="7" name="J100" type="JET" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="JETfull" phimax="64" phimin="0" priority="0" thresholdval="100" type="JET" window="8"/>
+      <Cable connector="CON0" ctpin="SLOT8" name="JEP1">
+        <Signal range_begin="21" range_end="23"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="1" id="53" mapping="7" name="XE80" type="XE" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="XEfull" phimax="64" phimin="0" priority="0" thresholdval="80" type="XE" window="0"/>
+      <Cable connector="CON2" ctpin="SLOT8" name="JEP3">
+        <Signal range_begin="11" range_end="11"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="3" id="54" mapping="0" name="EM3" type="EM" version="1.0">
+      <TriggerThresholdValue em_isolation="63" etamax="49" etamin="-49" had_isolation="63" had_veto="63" name="EMfull" phimax="64" phimin="0" priority="1" thresholdval="3" type="EM" window="0"/>
+      <Cable connector="CON1" ctpin="SLOT7" name="CP1">
+        <Signal range_begin="0" range_end="2"/>
+      </Cable>
+    </TriggerThreshold>
+
+    <TriggerThreshold active="1" bitnum="5" id="55" mapping="0" name="MBTS_A" type="MBTS" version="1.0">
+      <TriggerThresholdValue type="MBTS" thresholdval="65.0"/>
+      <Cable connector="CON1" ctpin="SLOT9" name="NIM">
+        <Signal range_begin="0" range_end="4"/>
+      </Cable>
+    </TriggerThreshold>
+    <TriggerThreshold active="1" bitnum="5" id="56" mapping="0" name="MBTS_C" type="MBTS" version="1.0">
+      <TriggerThresholdValue type="MBTS" thresholdval="65.0"/>
+      <Cable connector="CON1" ctpin="SLOT9" name="NIM">
+        <Signal range_begin="5" range_end="9"/>
+      </Cable>
+    </TriggerThreshold>
+  </TriggerThresholdList>
+  <Random name="" rate1="0" rate2="0" seed1="1" seed2="1"/>
+  <Deadtime complex1_level="0" complex1_rate="0" complex2_level="0" complex2_rate="0" name="" simple="0"/>
+  <BunchGroupSet name=""/>
+  <PrescaledClock clock1="0" clock2="0"/>
+  <MuctpiInfo>
+    <low_pt>
+      1
+    </low_pt>
+    <high_pt>
+      1
+    </high_pt>
+    <max_cand>
+      13
+    </max_cand>
+  </MuctpiInfo>
+  <CaloInfo global_scale="1">
+    <JetWeight num="1">
+      5
+    </JetWeight>
+    <JetWeight num="2">
+      6
+    </JetWeight>
+    <JetWeight num="3">
+      6
+    </JetWeight>
+    <JetWeight num="4">
+      8
+    </JetWeight>
+    <JetWeight num="5">
+      9
+    </JetWeight>
+    <JetWeight num="6">
+      17
+    </JetWeight>
+    <JetWeight num="7">
+      29
+    </JetWeight>
+    <JetWeight num="8">
+      30
+    </JetWeight>
+    <JetWeight num="9">
+      0
+    </JetWeight>
+    <JetWeight num="10">
+      0
+    </JetWeight>
+    <JetWeight num="11">
+      0
+    </JetWeight>
+    <JetWeight num="12">
+      0
+    </JetWeight>
+  </CaloInfo>
+</LVL1Config>
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/data/hlt_menu.dtd b/Trigger/TrigConfiguration/TrigConfigSvc/data/hlt_menu.dtd
new file mode 100755
index 0000000000000000000000000000000000000000..fde4afb5cee2bed332fb5b18230c555c5b33ac97
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/data/hlt_menu.dtd
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!ELEMENT HLT_MENU (CHAIN_LIST, SEQUENCE_LIST)>
+
+<!ELEMENT CHAIN_LIST (CHAIN)*>
+
+<!ELEMENT CHAIN (TRIGGERTYPE_LIST?, STREAMTAG_LIST, GROUP_LIST?, SIGNATURE_LIST)>
+<!ATTLIST CHAIN
+    chain_name       CDATA #REQUIRED
+    chain_counter    CDATA #REQUIRED
+    lower_chain_name CDATA #REQUIRED
+    level            CDATA #REQUIRED
+    prescale         CDATA #REQUIRED
+    pass_through     CDATA #REQUIRED
+>
+
+<!ELEMENT TRIGGERTYPE_LIST (TRIGGERTYPE*)>
+
+<!ELEMENT TRIGGERTYPE EMPTY>
+<!ATTLIST TRIGGERTYPE
+    bit   CDATA      #REQUIRED>
+
+<!ELEMENT STREAMTAG_LIST (STREAMTAG)+>
+
+<!ELEMENT STREAMTAG EMPTY>
+<!ATTLIST STREAMTAG
+    stream    CDATA      #REQUIRED
+    type      CDATA      #REQUIRED
+    obeyLB    CDATA      #REQUIRED
+    prescale  CDATA      #REQUIRED
+>
+
+<!ELEMENT GROUP_LIST (GROUP*)>
+<!ELEMENT GROUP EMPTY>
+<!ATTLIST GROUP
+    name    CDATA      #REQUIRED
+>
+
+
+
+<!ELEMENT SIGNATURE_LIST (SIGNATURE)*>
+
+<!ELEMENT SIGNATURE (TRIGGERELEMENT)*>
+<!ATTLIST SIGNATURE
+    logic             CDATA      #REQUIRED
+    signature_counter CDATA      #REQUIRED
+>
+
+<!ELEMENT TRIGGERELEMENT EMPTY>
+<!ATTLIST TRIGGERELEMENT
+    te_name   CDATA      #REQUIRED
+>
+
+
+
+<!ELEMENT SEQUENCE_LIST (SEQUENCE)*>
+
+<!ELEMENT SEQUENCE EMPTY>
+<!ATTLIST SEQUENCE
+     input        CDATA      #REQUIRED
+     topo_start_from CDATA      #IMPLIED
+     algorithm    CDATA      #REQUIRED
+     output       ID         #REQUIRED >
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/data/hlt_menu.xml b/Trigger/TrigConfiguration/TrigConfigSvc/data/hlt_menu.xml
new file mode 100755
index 0000000000000000000000000000000000000000..566563e9430b5e377429b42421a226c2b0d432e0
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/data/hlt_menu.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<!DOCTYPE HLT_MENU SYSTEM "hlt_menu.dtd">
+<HLT_MENU>
+<!-- File is autogenerated by python config (TriggerMenu class) -->
+<!-- By: eifert on: Mon Nov 27 16:18:42 2006 -->
+<!-- No. L1 thresholds defined: 18 -->
+<!-- No. L1 items defined: 2 -->
+<!-- No. if L2 HLT chains:2 -->
+<!-- No. if EF HLT chains:1 -->
+
+
+<!-- chains -->
+<CHAIN_LIST>
+
+  <CHAIN chain_name="em10L2" chain_counter="67" lower_chain_name="EM10" level="L2" prescale="1" pass_through="0">
+    <TRIGGERTYPE_LIST>
+      <TRIGGERTYPE bit="4"/>
+    </TRIGGERTYPE_LIST>
+
+    <STREAMTAG_LIST>
+      <STREAMTAG stream="electrons"  type="physics"  obeyLB="yes"  prescale="1"/>
+    </STREAMTAG_LIST>
+    <GROUP_LIST>
+     <GROUP name="egamma"/>
+     <GROUP name="lowPt"/>
+    </GROUP_LIST>
+    <SIGNATURE_LIST>
+      <SIGNATURE  logic="1" signature_counter="0">
+        <TRIGGERELEMENT te_name="EM10"/>
+      </SIGNATURE>
+      <SIGNATURE  logic="1" signature_counter="1">
+        <TRIGGERELEMENT te_name="em10t2calo"/>
+      </SIGNATURE>
+      <SIGNATURE  logic="1" signature_counter="2">
+        <TRIGGERELEMENT te_name="em10t2caloi"/>
+      </SIGNATURE>
+      <SIGNATURE  logic="1" signature_counter="3" />
+      <SIGNATURE  logic="1" signature_counter="4">
+        <TRIGGERELEMENT te_name="em10t2track"/>
+      </SIGNATURE>
+    </SIGNATURE_LIST>
+  </CHAIN>
+
+  <CHAIN chain_name="myChain" chain_counter="32" lower_chain_name="EM10*EM20i" level="L2" prescale="1" pass_through="0">
+    <TRIGGERTYPE_LIST>
+      <TRIGGERTYPE bit="4"/>
+      <TRIGGERTYPE bit="8"/>
+    </TRIGGERTYPE_LIST>
+
+    <STREAMTAG_LIST>
+      <STREAMTAG stream="electrons"  type="physics"  obeyLB="yes"  prescale="1"/>
+      <STREAMTAG stream="lar"  type="calibration"  obeyLB="no"  prescale="1"/>
+    </STREAMTAG_LIST>
+    <GROUP_LIST>
+     <GROUP name="testchain"/>
+    </GROUP_LIST>
+    <SIGNATURE_LIST>
+      <SIGNATURE  logic="1" signature_counter="0">
+        <TRIGGERELEMENT te_name="EM10"/>
+        <TRIGGERELEMENT te_name="EM20i"/>
+      </SIGNATURE>
+      <SIGNATURE  logic="1" signature_counter="1">
+        <TRIGGERELEMENT te_name="em10t2calo"/>
+        <TRIGGERELEMENT te_name="em20t2caloi"/>
+      </SIGNATURE>
+      <SIGNATURE  logic="1" signature_counter="2">
+        <TRIGGERELEMENT te_name="em10t2track"/>
+        <TRIGGERELEMENT te_name="em20t2track"/>
+      </SIGNATURE>
+    </SIGNATURE_LIST>
+  </CHAIN>
+
+  <CHAIN chain_name="em10EF" chain_counter="3" lower_chain_name="em10L2" level="EF" prescale="1" pass_through="0">
+    <TRIGGERTYPE_LIST>
+      <TRIGGERTYPE bit="4"/>
+    </TRIGGERTYPE_LIST>
+
+    <STREAMTAG_LIST>
+      <STREAMTAG stream="electrons"  type="physics"  obeyLB="yes"  prescale="1"/>
+    </STREAMTAG_LIST>
+    <GROUP_LIST>
+     <GROUP name="egamma"/>
+    </GROUP_LIST>
+    <SIGNATURE_LIST>
+      <SIGNATURE  logic="1" signature_counter="0">
+        <TRIGGERELEMENT te_name="em10track"/>
+      </SIGNATURE>
+      <SIGNATURE  logic="1" signature_counter="1" />
+      <SIGNATURE  logic="1" signature_counter="2">
+        <TRIGGERELEMENT te_name="em10match"/>
+      </SIGNATURE>
+    </SIGNATURE_LIST>
+  </CHAIN>
+
+</CHAIN_LIST>
+
+
+<!-- sequences -->
+<SEQUENCE_LIST>
+ <SEQUENCE  input="EM10"           output="em10t2calo"     algorithm="T2CaloRec T2CaloHypo" />
+ <SEQUENCE  input="em10t2calo"     output="em10t2caloi"    algorithm="T2CaloIsol T2CaloIsolHypo" />
+ <SEQUENCE  input="em10t2caloi"    output="em10t2track"    algorithm="IDScan IDHypo" />
+ <SEQUENCE  input="em10t2track"    output="em10match"      algorithm="IDScan IDHypo" />
+</SEQUENCE_LIST>
+
+</HLT_MENU>
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/data/seqlistnew_newconfig.xml b/Trigger/TrigConfiguration/TrigConfigSvc/data/seqlistnew_newconfig.xml
new file mode 100755
index 0000000000000000000000000000000000000000..96632b5d580bee7ba347a0131052bc5a80f874c5
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/data/seqlistnew_newconfig.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- hlt_setup.name="dummy", hlt_setup.version="0.0" -->
+<!-- hlt_release.name="11.0.4" -->
+
+<SEQUENCE_LIST>
+
+<SEQUENCE input="EMTAUROI"          algorithm="dummyAlgL2/gamma/g4"                            output="g"          />
+<SEQUENCE input="g"                 algorithm="dummyAlgEF/gamma4/g3"                           output="g4"         />
+<SEQUENCE input="g4"                algorithm="dummyAlgEF/gamma40/g1"                          output="g40"        />
+<SEQUENCE input="g40"               algorithm="dummyAlgEF/gamma40i/g1"                         output="g40i"       />
+
+<SEQUENCE input="EMTAUROI"          algorithm="dummyAlgL2/elec/e4"                             output="e_cand"     />
+<SEQUENCE input="sc_hits"           algorithm="dummyAlgL2/sc/sc1"                              output="track_cand" />
+
+<SEQUENCE input="e_cand track_cand" algorithm="dummyAlgEF/neweleccand/e3"                      output="e_tr"       />
+<SEQUENCE input="e_tr"              algorithm="dummyAlgEF/newelec20/e1"                        output="e20_tr"     />
+<SEQUENCE input="e20_tr"            algorithm="dummyAlgEF/newelec20i/e1"                       output="e20i_tr"    />
+ 
+<SEQUENCE input="MUONROI"           algorithm="dummyAlgL2/muon/m1"                             output="mu"         />
+<SEQUENCE input="mu"                algorithm="dummyAlgL2/muon20/m2"                           output="mu20"       />
+<SEQUENCE input="mu20"              algorithm="dummyAlgEF/muon20iA/m2 dummyAlgEF/muon20iB/m2"  output="mu20i"      />
+
+</SEQUENCE_LIST>
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/data/seqlistnew_oldconfig.xml b/Trigger/TrigConfiguration/TrigConfigSvc/data/seqlistnew_oldconfig.xml
new file mode 100755
index 0000000000000000000000000000000000000000..0d3759db81d6b8bc1e1e19d95116e7faedf49ef6
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/data/seqlistnew_oldconfig.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+
+<!DOCTYPE SEQUENCE_LIST SYSTEM "sequencelist.dtd">
+
+<SEQUENCE_LIST>
+
+<SEQUENCE level="L2" input="EMTAUROI" algorithm="dummyAlgL2/gamma/g4"    output="g" />
+<SEQUENCE level="EF" input="g"        algorithm="dummyAlgEF/gamma4/g3"   output="g4" />
+<SEQUENCE level="EF" input="g4"       algorithm="dummyAlgEF/gamma40/g1"  output="g40" />
+<SEQUENCE level="EF" input="g40"      algorithm="dummyAlgEF/gamma40i/g1" output="g40i" />
+
+<SEQUENCE level="L2" input="EMTAUROI"  algorithm="dummyAlgL2/elec/e4"   output="e_cand"     />
+<SEQUENCE level="L2" input="sc_hits"   algorithm="dummyAlgL2/sc/sc1"    output="track_cand" />
+
+<SEQUENCE level="EF" input="e_cand track_cand" algorithm="dummyAlgEF/neweleccand/e3" output="e_tr" />
+<SEQUENCE level="EF" input="e_tr"              algorithm="dummyAlgEF/newelec20/e1"   output="e20_tr" />
+<SEQUENCE level="EF" input="e20_tr"            algorithm="dummyAlgEF/newelec20i/e1"  output="e20i_tr" />
+
+<SEQUENCE level="L2" input="MUONROI"  algorithm="dummyAlgL2/muon/m1"                              output="mu" /> 
+<SEQUENCE level="L2" input="mu"       algorithm="dummyAlgL2/muon20/m2"                            output="mu20" />
+<SEQUENCE level="EF" input="mu20"     algorithm="dummyAlgEF/muon20iA/m2 dummyAlgEF/muon20iB/m2"   output="mu20i" />
+
+</SEQUENCE_LIST>
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/data/siglistnew_newconfig.xml b/Trigger/TrigConfiguration/TrigConfigSvc/data/siglistnew_newconfig.xml
new file mode 100755
index 0000000000000000000000000000000000000000..064e332db1ed15116bb8a94a7238c47a4f0ecca3
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/data/siglistnew_newconfig.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<!-- hlt_master_table.name="dummy",  hlt_master_table.version="0.0" -->
+<!-- hlt_trigger_menu.name="dummy1",  hlt_trigger_menu.version="0.0" -->
+<!-- hlt_prescale_set.name="dummy2",  hlt_prescale_set.version="0.0" -->
+
+<CHAIN_LIST>
+
+<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  -->
+
+<CHAIN chain_id="gL2" chain_counter="1" lower_chain_id="EM40" level="L2" prescale="1" pass_through="0">
+
+  <SIGNATURE_LIST>
+  <SIGNATURE signature_counter="1" logic="1"> <TRIGGERELEMENT te_name="g" /> </SIGNATURE>
+  </SIGNATURE_LIST>
+
+</CHAIN>
+
+<CHAIN chain_id="gEF" chain_counter="1" lower_chain_id="gL2" level="EF" prescale="1" pass_through="0">
+
+  <SIGNATURE_LIST>
+  <SIGNATURE signature_counter="1" logic="1"> <TRIGGERELEMENT te_name="g4"   /> </SIGNATURE>
+  <SIGNATURE signature_counter="2" logic="1"> <TRIGGERELEMENT te_name="g40"  /> </SIGNATURE>
+  <SIGNATURE signature_counter="3" logic="1"> <TRIGGERELEMENT te_name="g40i" /> </SIGNATURE>
+  </SIGNATURE_LIST>
+
+</CHAIN>
+
+<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  -->
+
+<CHAIN chain_id="gmuL2" chain_counter="2" lower_chain_id="EM40_MU20" level="L2" prescale="1" pass_through="0">
+
+  <SIGNATURE_LIST>
+  <SIGNATURE signature_counter="1" logic="1"> <TRIGGERELEMENT te_name="g" /> <TRIGGERELEMENT te_name="mu"   /> </SIGNATURE>
+  <SIGNATURE signature_counter="2" logic="1"> <TRIGGERELEMENT te_name="g" /> <TRIGGERELEMENT te_name="mu20" /> </SIGNATURE>
+  </SIGNATURE_LIST>
+
+</CHAIN>
+
+<CHAIN chain_id="gmuEF" chain_counter="2" lower_chain_id="gmuL2" level="EF" prescale="1" pass_through="0">
+
+  <SIGNATURE_LIST>
+  <SIGNATURE signature_counter="1" logic="1"> <TRIGGERELEMENT te_name="g4"   /> <TRIGGERELEMENT te_name="mu20i" /> </SIGNATURE>
+  <SIGNATURE signature_counter="2" logic="1"> <TRIGGERELEMENT te_name="g40"  /> <TRIGGERELEMENT te_name="mu20i" /> </SIGNATURE>
+  <SIGNATURE signature_counter="3" logic="1"> <TRIGGERELEMENT te_name="g40i" /> <TRIGGERELEMENT te_name="mu20i" /> </SIGNATURE>
+  </SIGNATURE_LIST>
+
+</CHAIN>
+
+<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  -->
+
+<CHAIN chain_id="newelecL2" chain_counter="3" lower_chain_id="EM20" level="L2" prescale="1" pass_through="0">
+
+  <SIGNATURE_LIST>
+  <SIGNATURE signature_counter="1" logic="1"> <TRIGGERELEMENT te_name="e_cand"    /> 
+                                              <TRIGGERELEMENT te_name="track_cand"/> 
+  </SIGNATURE>
+  </SIGNATURE_LIST>
+
+</CHAIN>
+
+<CHAIN chain_id="newelecEF" chain_counter="2" lower_chain_id="newelecL2" level="EF" prescale="1" pass_through="0">
+
+  <SIGNATURE_LIST>
+  <SIGNATURE signature_counter="1" logic="1"> <TRIGGERELEMENT te_name="e"       /> </SIGNATURE>
+  <SIGNATURE signature_counter="2" logic="1"> <TRIGGERELEMENT te_name="e_tr"    /> </SIGNATURE>
+  <SIGNATURE signature_counter="3" logic="1"> <TRIGGERELEMENT te_name="e20_tr"  /> </SIGNATURE>
+  <SIGNATURE signature_counter="4" logic="1"> <TRIGGERELEMENT te_name="e20i_tr" /> </SIGNATURE>
+  </SIGNATURE_LIST>
+
+</CHAIN>
+
+<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  -->
+
+<CHAIN chain_id="gamma_elec_muL2" chain_counter="4" lower_chain_id="EM20_EM40_MU20" level="L2" prescale="1" pass_through="0">
+
+  <SIGNATURE_LIST>
+  <SIGNATURE signature_counter="1" logic="1"> <TRIGGERELEMENT te_name="e_cand"    /> 
+                                              <TRIGGERELEMENT te_name="track_cand"/> 
+                                              <TRIGGERELEMENT te_name="g"         />
+                                              <TRIGGERELEMENT te_name="mu"        /> 
+  </SIGNATURE>
+  <SIGNATURE signature_counter="2" logic="1"> <TRIGGERELEMENT te_name="e_cand"    /> 
+                                              <TRIGGERELEMENT te_name="track_cand"/> 
+                                              <TRIGGERELEMENT te_name="g"         />
+                                              <TRIGGERELEMENT te_name="mu20" /> 
+  </SIGNATURE>
+  </SIGNATURE_LIST>
+
+</CHAIN>
+
+<CHAIN chain_id="gmuEF" chain_counter="2" lower_chain_id="gmuL2" level="EF" prescale="1" pass_through="0">
+
+  <SIGNATURE_LIST>
+  <SIGNATURE signature_counter="1" logic="1"> <TRIGGERELEMENT te_name="e"       /> 
+                                              <TRIGGERELEMENT te_name="g4"      /> 
+                                              <TRIGGERELEMENT te_name="mu20i"   />
+  </SIGNATURE>
+  <SIGNATURE signature_counter="2" logic="1"> <TRIGGERELEMENT te_name="e_tr"    /> 
+                                              <TRIGGERELEMENT te_name="g40"     /> 
+                                              <TRIGGERELEMENT te_name="mu20i"   />
+  </SIGNATURE>
+  <SIGNATURE signature_counter="3" logic="1"> <TRIGGERELEMENT te_name="e20_tr"  /> 
+                                              <TRIGGERELEMENT te_name="g40i"    /> 
+                                              <TRIGGERELEMENT te_name="mu20i"   />
+  </SIGNATURE>
+  <SIGNATURE signature_counter="4" logic="1"> <TRIGGERELEMENT te_name="e20i_tr" /> 
+                                              <TRIGGERELEMENT te_name="g40i"    /> 
+                                              <TRIGGERELEMENT te_name="mu20i"   />
+  </SIGNATURE>
+  </SIGNATURE_LIST>
+
+</CHAIN>
+
+<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  -->
+
+</CHAIN_LIST>
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/data/siglistnew_oldconfig.xml b/Trigger/TrigConfiguration/TrigConfigSvc/data/siglistnew_oldconfig.xml
new file mode 100755
index 0000000000000000000000000000000000000000..1e1ee6e15effb99733cb990d9cd02d757bd5fa49
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/data/siglistnew_oldconfig.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+
+<!DOCTYPE SIGNATURE_LIST SYSTEM "signaturelist.dtd">
+
+<SIGNATURE_LIST>
+
+<!-- 000000000000000000000000000000000000000000000 -->
+
+<SIGNATURE signature_id="g" prescale="1" pass_through="0">
+      <TRIGGERELEMENT te_name="g40i" />
+</SIGNATURE>
+
+<SIGNATURE signature_id="gmu" prescale="1" pass_through="0">
+      <TRIGGERELEMENT te_name="g40i" />
+      <TRIGGERELEMENT te_name="mu20i" />
+</SIGNATURE>
+
+<!-- 000000000000000000000000000000000000000000000 -->
+
+<SIGNATURE signature_id="newelec" prescale="1" pass_through="0">
+      <TRIGGERELEMENT te_name="e20i_tr" />
+</SIGNATURE>
+
+<!-- 000000000000000000000000000000000000000000000 -->
+
+<SIGNATURE signature_id="gamma_newelec_mu" prescale="1" pass_through="0">
+      <TRIGGERELEMENT te_name="e20i_tr" />
+      <TRIGGERELEMENT te_name="g40i" />
+      <TRIGGERELEMENT te_name="mu20i" />
+</SIGNATURE>
+
+
+</SIGNATURE_LIST>                 
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/DoDBConfig.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/DoDBConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..0f435b8d08720511b32ed235d89e4d952b438b04
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/DoDBConfig.py
@@ -0,0 +1,61 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+## @file  DoDBConfig.py
+## @brief Configure services to extract the trigger configuration for DB upload
+## $Id: DoDBConfig.py,v 1.4 2009-03-05 14:52:41 pbell Exp $
+
+def _doDBConfig():
+   from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+   from AthenaCommon.AppMgr import theApp
+   from TriggerJobOpts.TriggerFlags import TriggerFlags
+   from AthenaCommon.Logging import logging
+
+   log = logging.getLogger( 'TrigConfigSvc::DoDBConfig:' )
+
+   if TriggerFlags.doLVL2(): SetupOutput = "l2"
+   else: SetupOutput = "ef"
+   SetupOutput += "_" + TriggerFlags.Online.doDBConfigBaseName() + "_setup.txt"
+
+   if hasattr(svcMgr,'LVL1ConfigSvc'):
+      log.info("DBCONFIG LVL1XML %s" % svcMgr.LVL1ConfigSvc.XMLFile)
+   if hasattr(svcMgr,'HLTConfigSvc'):            
+      log.info("DBCONFIG HLTXML  %s" % svcMgr.HLTConfigSvc.XMLMenuFile)
+
+   log.info("DBCONFIG SETUP   %s" % SetupOutput)   
+   
+   # Replace the common HistorySvc by the TrigHistorySvc
+   from TrigConfOffline.TrigHistorySvc import TrigHistorySvc
+   if not svcMgr.__dict__.has_key('HistorySvc') or not isinstance( svcMgr.HistorySvc, TrigHistorySvc) :
+      if svcMgr.__dict__.has_key('HistorySvc'): del svcMgr.HistorySvc
+      svcMgr += TrigHistorySvc('HistorySvc')
+   
+   svcMgr.HistorySvc.OutputFile = SetupOutput
+   svcMgr.HistorySvc.Dump       = True
+   svcMgr.HistorySvc.Activate   = True
+   theApp.ActivateHistory = True
+
+   # Fill the meta data from the PSC configuration if available
+   try:
+      from TrigPSC import PscConfig      
+   except:
+      log.warning('Cannot import TrigPSC.PscConfig. TrigConfMetaData will not be filled.')
+      pass
+
+   if 'PscConfig' in dir():
+      from TrigConfigSvc.TrigConfMetaData import TrigConfMetaData
+      meta = TrigConfMetaData()      
+      meta.PreCommand = PscConfig.optmap['PRECOMMAND']
+      meta.JobOptions = PscConfig.optmap['JOBOPTIONSPATH']
+   
+   return
+
+# Create meta data configurable (needs to be at module-level)
+from TrigConfigSvc.TrigConfMetaData import TrigConfMetaData
+meta = TrigConfMetaData()
+
+# configure
+_doDBConfig()
+
+# clean-up
+del _doDBConfig
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOL.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOL.py
new file mode 100644
index 0000000000000000000000000000000000000000..0daeef5bfb6b02f023a58c5c8d1b7a04a56e8680
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOL.py
@@ -0,0 +1,28 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+## @file TrigCond2COOL.py
+## $Id: TrigConf2COOL.py,v 1.14 2009-05-06 13:09:27 stelzer Exp $
+###############################################################
+#
+# The jobOptions to enable reading and writing of configuration
+# data from COOL into AOD
+#
+#
+#==============================================================
+#
+# Required libs:
+import os.path
+import threading
+
+from . import TrigConf2COOLLib as _impl
+
+from AthenaCommon.AppMgr import theApp
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+svcMgr += _impl.TrigConf2CoolSyncSvc()
+theApp.CreateSvc.insert(0,svcMgr.TrigConf2CoolSyncSvc.getFullJobOptName())
+
+theConfCOOLWriter = _impl.ConfToCoolSQlite()
+
+del _impl
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOLLib.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOLLib.py
new file mode 100644
index 0000000000000000000000000000000000000000..b2c575d4c905d9b2f7dc41deefad5a0a9f99fc26
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2COOLLib.py
@@ -0,0 +1,171 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+## @file TrigCond2COOLLib.py
+## $Id: TrigConf2COOL.py,v 1.14 2009-05-06 13:09:27 stelzer Exp $
+###############################################################
+#
+# The jobOptions to enable reading and writing of configuration
+# data from COOL into AOD
+#
+#
+#==============================================================
+#
+# Required libs:
+import os.path
+import threading
+
+import AthenaCommon.Logging as L
+from AthenaCommon.JobProperties import jobproperties as jp
+
+from AthenaPython import PyAthena
+                                
+class TmpThr(threading.Thread):
+    def __init__(self, syscmd):
+        threading.Thread.__init__(self)
+        self.syscmd = syscmd
+    def run(self):    
+        msg = L.logging.getLogger( 'TrigConf2COOLLib.py' )
+        output = os.popen(self.syscmd).readlines()
+        maxlevel = 0
+        for line in output:
+            if 'warning' in line.lower():
+                maxlevel = max(1,maxlevel)
+            if 'error' in line.lower():
+                maxlevel = max(2,maxlevel)
+            elif 'fatal' in line.lower() or 'exception' in line.lower():
+                maxlevel = max(3,maxlevel)
+        output = ''.join(output)
+        if maxlevel==1:
+            msg.warning(output)
+        elif maxlevel==2:
+            msg.error(output)
+        elif maxlevel==3:
+            msg.fatal(output)
+        else:
+            msg.debug(output)
+
+class TrigConf2CoolSyncSvc(PyAthena.Svc):
+    def __init__(self, name="TrigConf2CoolSyncSvc",**kw):
+        kw['name'] = name
+        super(TrigConf2CoolSyncSvc,self).__init__(**kw)
+        self.conf2CoolThr = []
+
+    def initialize(self):
+        self.msg.info("initializing [%s]", self.name())
+        if len(self.conf2CoolThr):
+            self.msg.info("wait until TrigConf2Cool thread terminates")
+            for tmpThr in self.conf2CoolThr:
+                tmpThr.join()
+        return PyAthena.StatusCode.Success
+
+    def setThread(self,thr):
+        self.conf2CoolThr.append(thr)
+
+    def __getstate__(self):
+        if self.conf2CoolThr:
+            self.msg.info("wait until TrigConf2Cool thread terminates")
+            for thr in self.conf2CoolThr:
+                thr.join()
+        self.conf2CoolThr = []
+        return PyAthena.Svc.__getstate__(self)
+    
+class ConfToCoolSQlite:
+    """Writes the trigger configuration information to COOL/SQlite"""
+
+    __instance = None
+
+    class __single:
+
+        def __init__(self):
+            from tempfile import mktemp
+            self.dbfilename      = mktemp('.db','hltMenu.')
+            from AthenaCommon.GlobalFlags import globalflags
+            if (globalflags.DataSource()=='data'):
+                # real data
+                self.dbname='COMP200'
+            else:
+                # Monte Carlo
+                self.dbname='OFLP200'
+            self.dbConnection    = "<dbConnection>sqlite://;schema=%s;dbname=%s</dbConnection>" % (self.dbfilename,self.dbname)
+            self.isWritingNeeded = False
+            from RecExConfig.RecFlags import jobproperties as jp
+            from TriggerJobOpts.TriggerFlags import jobproperties as jp
+            from TriggerJobOpts.TriggerFlags import TriggerFlags as tf
+            if jp.Rec.Trigger.readLVL1configFromXML():
+                self.lvl1menu    = jp.Rec.Trigger.inputLVL1configFile()
+            else:
+                self.lvl1menu    = jp.Rec.Trigger.outputLVL1configFile()
+            if jp.Rec.Trigger.readHLTconfigFromXML():
+                self.hltmenu         = jp.Rec.Trigger.inputHLTconfigFile()
+            else:
+                self.hltmenu         = jp.Rec.Trigger.outputHLTconfigFile()
+            self.menusource = 'xml'  # either db or xml
+            self.trigdb = ''
+            self.smk    = 0
+            self.l1psk  = 0
+            self.hltpsk = 0
+            self.useFrontier = tf.triggerUseFrontier()
+            
+        def setTriggerDBConnection(self,trigDbConnectionParameters):
+            self.menusource = 'db'
+            if "alias" in trigDbConnectionParameters:
+                coolcon = trigDbConnectionParameters["alias"]
+            else:
+                technology = trigDbConnectionParameters["techno"]
+                if technology == 'sqlite':
+                    coolcon = 'sqlite:%s' % trigDbConnectionParameters["filename"]
+                if technology == 'oracle':
+                    server = trigDbConnectionParameters["server"]
+                    schema = trigDbConnectionParameters["schema"]
+                    user   = trigDbConnectionParameters["user"  ]
+                    passwd = trigDbConnectionParameters["passwd"]
+                    coolcon = technology+'://'+server+'/'+schema+';user='+user+';passwd='+passwd+';'
+            # log.info(coolcon)
+            self.trigdb     = coolcon
+            
+        def writeConf2COOL(self):
+            msg = L.logging.getLogger( 'TrigConf2COOLLib.py' )
+            if not self.isWritingNeeded:
+                msg.info('Writing of trigger configuration to SQlite COOL is not needed')
+                return
+            # we write COOL sqlite file from given HLT and LVL1 menu xml
+            if self.menusource == 'xml':
+                msg.info("Writing menu %s and %s to COOL (%s)" % (self.lvl1menu, self.hltmenu, self.dbfilename) )
+                syscmd  = "rm -f %s; TrigConfReadWrite -i %s %s -o cool '%s;%s'" % (self.dbfilename, self.hltmenu, self.lvl1menu, self.dbfilename, self.dbname)
+            else:  # db
+                if self.smk==0 or self.l1psk==0 or self.hltpsk==0:
+                    raise RuntimeError, "Source of trigger menu configuration is the TriggerDB, but no keys are specified: %i/%i/%i" % (self.smk, self.l1psk, self.hltpsk)
+                msg.info("Writing menu (keys: %i/%i/%i) from triggerDB (%s) to COOL (%s)" % (self.smk, self.l1psk, self.hltpsk, self.trigdb, self.dbfilename) )
+                syscmd  = "rm -f %s; TrigConf2COOLApp -e createwrite" % self.dbfilename
+                syscmd += " --cooldb 'sqlite://;schema=%s;dbname=%s'" % (self.dbfilename,self.dbname)
+                syscmd += " --trigdb '%s' --configkey %i --prescalekeylvl1 %i --prescalekeyhlt %i" % (self.trigdb, self.smk, self.l1psk, self.hltpsk)
+                if self.useFrontier:
+                    syscmd += " --usefrontier"
+                syscmd += " --infiov"
+                
+            
+            msg.info('executing system command to create COOL SQlite file %s with trigger configuration' % self.dbfilename)
+            msg.info("> " + syscmd)
+
+            tmpThr = TmpThr(syscmd)
+            tmpThr.start()
+            from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+            svcMgr.TrigConf2CoolSyncSvc.setThread(tmpThr)
+            
+                
+    def __init__(self):
+        """ Create singleton instance """
+        if self.__instance is None:
+            ConfToCoolSQlite.__instance = ConfToCoolSQlite.__single()
+
+        # Store instance reference as the only member in the handle, not sure if this is needed
+        self.__dict__['_ConfToCoolSQlite__instance'] = ConfToCoolSQlite.__instance
+
+    def __getattr__(self, attr):
+        """ Delegate access to implementation """
+        return getattr(self.__instance, attr)
+
+    def __setattr__(self, attr, value):
+        """ Delegate access to implementation """
+        return setattr(self.__instance, attr, value)
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2XML.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2XML.py
new file mode 100644
index 0000000000000000000000000000000000000000..e18a9ab921c0dfd41968297cff367431a61a7536
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConf2XML.py
@@ -0,0 +1,73 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+## @file TrigCond2XML.py
+## @brief Core job python configurable to setup IOVDbSvc
+## @author RD Schaffer <R.D.Schaffer@cern.ch>
+## $Id: TrigConf2XML.py,v 1.3 2008-03-07 22:40:23 stelzer Exp $
+###############################################################
+#
+# The jobOptions to enable writing of configuration
+# data from the DB to XML#
+#
+#==============================================================
+#
+# Required libs:
+import os.path
+
+from AthenaCommon.JobProperties import jobproperties as jp
+from AthenaCommon.Logging import logging
+
+class ConfToXML:
+    """Writes the trigger configuration information to XML"""
+
+    __instance = None
+
+    class __single:
+
+        def __init__(self):
+            
+            self.trigdb          = ""
+            self.dbuser          = ""
+            self.dbpass          = ""
+            self.dbkey           = 1
+            self.lvl1pskey       = 1
+            self.hltpskey        = 1
+            self.outputfile      = "dbOutput"
+            
+        def writeConf2XML(self):
+            msg = logging.getLogger( 'TriggerConfig(2XML)' )
+            msg.info("Writing HLT XML file %s" % (self.outputfile) )
+
+            syscmd  = "TrigConf2XMLApp"
+            syscmd += " --trigdb %s"          % (self.trigdb)
+            syscmd += " --u %s"               % self.dbuser
+            syscmd += " --p %s         "      % self.dbpass
+            syscmd += " --configkey %i"       % self.dbkey
+            syscmd += " --prescalekeylvl1 %i" % self.lvl1pskey
+            syscmd += " --prescalekeyhlt %i"  % self.hltpskey
+            syscmd += " --outputfile %s"      % self.outputfile
+                        
+            msg.info('executing system command to create XML file')
+            msg.info("> " + syscmd)
+            
+            output = os.popen(syscmd).readlines()
+            for line in output:
+                msg.info(line.strip())
+                
+    def __init__(self):
+        """ Create singleton instance """
+        if self.__instance is None:
+            ConfToXML.__instance = ConfToXML.__single()
+
+        # Store instance reference as the only member in the handle, not sure if this is needed
+        self.__dict__['_ConfToXML__instance'] = ConfToXML.__instance
+
+    def __getattr__(self, attr):
+        """ Delegate access to implementation """
+        return getattr(self.__instance, attr)
+
+    def __setattr__(self, attr, value):
+        """ Delegate access to implementation """
+        return setattr(self.__instance, attr, value)
+
+theConfXMLWriter = ConfToXML()
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfFrontier.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfFrontier.py
new file mode 100755
index 0000000000000000000000000000000000000000..3cc4abbc13cf5bfc550bad07003a9f1189bdf4d6
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfFrontier.py
@@ -0,0 +1,324 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+from AthenaCommon.Logging import logging
+import time
+
+def getFrontierCursor(url, schema, loglevel = logging.INFO):
+    log = logging.getLogger( "TrigConfFrontier.py" )
+    log.setLevel(loglevel)
+    try:
+        from TrigConfDBConnection import frontier_client
+        return FrontierCursor2( url = url, schema = schema)
+    except:
+        log.warning("Couldn't import frontier_client from TrigConfDBConnection, falling back to pure python implementation without proper url resolution")
+        return FrontierCursor( url = url, schema = schema)
+        
+
+class FrontierCursor2:
+    def __init__(self, url, schema, refreshFlag=False):
+        log = logging.getLogger( "TrigConfFrontier.py" )
+        self.url = url
+        self.schema = schema
+        self.refreshFlag = refreshFlag
+        from TrigConfDBConnection import frontier_client as fc
+        fc.init("PyFrontier","debug")
+        log.debug("Frontier URL      : %s" % self.url)
+        log.debug("Schema            : %s" % self.schema)
+        log.debug("Refresh cache     : %s" % self.refreshFlag)
+
+    @classmethod
+    def resolvebindvars(cls, query, bindvars):
+        """Replaces the bound variables :xyz with a ? in the query and
+        adding the value behind a : at the end"""
+        log = logging.getLogger( "TrigConfFrontier.py" )
+        import re
+        varsextract = re.findall(':([A-z0-9]*)',query)
+        values = map(bindvars.get, varsextract)
+        log.debug("Resolving bound variable %r with %r" % (varsextract,values))
+        appendix = ":".join([str(v) for v in values])
+        queryWithQuestionMarks = re.sub(':[A-z0-9]*','?', query)
+        query = queryWithQuestionMarks + ':' + appendix
+        return query
+
+    @classmethod
+    def replacebindvars(cls, query, bindvars):
+        """Replaces the bound variables with the specified values,
+        disables variable binding
+        """
+        log = logging.getLogger( "TrigConfFrontier.py" )
+        for var,val in bindvars.items():
+            if query.find(":%s" % var)<0:
+                raise NameError("variable '%s' is not a bound variable in this query: %s" % (var, query) )
+            query = query.replace(":%s" % var,"%r" % val)
+            log.debug("Resolving bound variable '%s' with %r" % (var,val))
+        log.debug("Resolved query: %s" % query)
+        return query
+
+    def execute(self, query, bindvars={}):
+        if len(bindvars)>0:
+            query = FrontierCursor2.resolvebindvars(query,bindvars)
+            
+        from TrigConfDBConnection import frontier_client as fc
+        log = logging.getLogger( "TrigConfFrontier.py" )
+        log.debug("Executing query : %s" % query)
+
+        conn = fc.Connection(self.url)
+        session = fc.Session(conn)
+
+        doReload = self.refreshFlag
+        conn.setReload(doReload)
+        
+        queryStart = time.localtime()
+        log.debug("Query started: %s" % time.strftime("%m/%d/%y %H:%M:%S %Z", queryStart))
+
+        t1 = time.time()
+        req = fc.Request("frontier_request:1:DEFAULT", fc.encoding_t.BLOB)
+        param = fc.Request.encodeParam(query)
+        req.addKey("p1",param)
+        
+        session.getData([req])
+        t2 = time.time()
+
+        #session.printHeader()
+        
+        #nfield = session.getNumberOfFields()
+        #print "\nNumber of fields:", nfield, "\n"
+    
+        #nrec = session.getNumberOfRecords()
+        #print "\nResult contains", nrec, "objects.\n"
+        
+        #session.printRecords2()
+        queryEnd = time.localtime()
+        
+        self.result = [r for r in session.getRecords2()]
+        log.debug("Query ended: %s" % time.strftime("%m/%d/%y %H:%M:%S %Z", queryEnd))
+        log.debug("Query time: %s seconds" % (t2-t1))
+        log.debug("Result size: %i entries" % len(self.result))
+            
+    def fetchall(self):
+        return self.result
+
+    def __str__(self):
+        return """FrontierCursor2:
+Using Frontier URL: %s
+Schema: %s
+Refresh cache:  %s""" % (self.url, self.schema, self.refreshFlag)
+
+
+
+    
+class FrontierCursor:
+    def __init__(self, url, schema, refreshFlag=False, doDecode=True, retrieveZiplevel="zip"):
+        log = logging.getLogger( "TrigConfFrontier.py" )
+        if url.startswith('('):
+            self.servertype, self.url  = FrontierCursor.getServerUrls(url)[0]
+            self.url += "/Frontier"
+        else:
+            self.url = url
+        self.schema = schema
+        self.refreshFlag = refreshFlag
+        self.retrieveZiplevel = retrieveZiplevel
+        self.doDecode = doDecode
+        # connstr='frontier://ATLF/%s;schema=%s;dbname=TRIGCONF' % (connectionParameters['url'],connectionParameters["schema"])
+
+    def __str__(self):
+        return """FrontierCursor:
+Using Frontier URL: %s
+Refresh cache:  %s""" % (self.url, self.refreshFlag)
+
+    @classmethod
+    def getServerUrls(cls, frontier_servers):
+        from re import findall
+        return findall('\((serverurl)=(.*?)\)',frontier_servers)
+
+    @classmethod
+    def testUrl(cls, url):
+        import urllib2
+        try:
+            urllib2.urlopen(url)
+        except urllib2.URLError, e:
+            print e
+            
+    def execute(self, query, bindvars={}):
+        if len(bindvars)>0:
+            query = FrontierCursor2.replacebindvars(query,bindvars)
+        
+        log = logging.getLogger( "TrigConfFrontier.py" )
+        log.debug("Using Frontier URL: %s" % self.url)
+        log.debug("Refresh cache     : %s" % self.refreshFlag)
+        log.debug("Query             : %s" % query)
+        
+        import base64, zlib, urllib2, time
+
+        self.result = None
+
+        encQuery = base64.binascii.b2a_base64(zlib.compress(query,9)).replace("+", ".").replace("\n","").replace("/","-").replace("=","_")
+
+        frontierRequest="%s/type=frontier_request:1:DEFAULT&encoding=BLOB%s&p1=%s" % (self.url, self.retrieveZiplevel, encQuery)
+        request = urllib2.Request(frontierRequest)
+
+        if self.refreshFlag:
+            request.add_header("pragma", "no-cache")
+
+        frontierId = "TrigConfFrontier 1.0"
+        request.add_header("X-Frontier-Id", frontierId)
+
+        queryStart = time.localtime()
+        log.debug("Query started: %s" % time.strftime("%m/%d/%y %H:%M:%S %Z", queryStart))
+
+        t1 = time.time()
+        result = urllib2.urlopen(request,None,10).read()
+        t2 = time.time()
+
+        queryEnd = time.localtime()
+        log.debug("Query ended: %s" % time.strftime("%m/%d/%y %H:%M:%S %Z", queryEnd))
+        log.debug("Query time: %s [seconds]" % (t2-t1))
+        log.debug("Result size: %i [seconds]" % len(result))
+        self.result = result
+
+    def fetchall(self):
+        if self.doDecode: self.decodeResult()
+        return self.result
+
+
+    def decodeResult(self):
+        log = logging.getLogger( "TrigConfFrontier.py" )
+        from xml.dom.minidom import parseString
+        import base64,zlib, curses.ascii
+        #print "Query result:\n", self.result
+        dom = parseString(self.result)
+        dataList = dom.getElementsByTagName("data")
+        keepalives = 0
+        # Control characters represent records, but I won't bother with that now,
+        # and will simply replace those by space.
+        for data in dataList:
+            for node in data.childNodes:
+                # <keepalive /> elements may be present, combined with whitespace text
+                if node.nodeName == "keepalive":
+                    # this is of type Element
+                    keepalives += 1
+                    continue
+                # else assume of type Text
+                if node.data.strip() == "":
+                    continue
+                if keepalives > 0:
+                    print keepalives, "keepalives received\n"
+                    keepalives = 0
+            
+                row = base64.decodestring(node.data)
+                if self.retrieveZiplevel != "":
+                    row = zlib.decompress(row)
+            
+                endFirstRow = row.find('\x07')
+                firstRow = row[:endFirstRow]
+                for c in firstRow:
+                    if curses.ascii.isctrl(c):
+                        firstRow = firstRow.replace(c, ' ')
+                fields = [x for i,x in enumerate(firstRow.split()) if i%2==0]
+                types = [x for i,x in enumerate(firstRow.split()) if i%2==1]
+                Nfields = len(fields)
+                ptypes = [int if t.startswith("NUMBER") else str for t in types]
+                log.debug("Fields      : %r" % fields)
+                log.debug("DB Types    : %r" % types)
+                log.debug("Python Types: %r" % ptypes)
+                
+                row = str(row[endFirstRow+1:])
+
+                row_h = row.rstrip('\x07')
+
+                import re
+                row_h = row_h.replace("\x07\x06",'.nNn.\x06')
+
+                pattern = re.compile("\x06\x00\x00\x00.",flags=re.S)
+                row_h = pattern.sub('.xXx.',row_h)
+                row_h = row_h.replace("\x86", '.xXx.')
+
+                row_h = row_h.split('.nNn.')
+                row_h = [r.split('.xXx.') for r in row_h]
+
+                result = []
+                for r in row_h:
+                    if r[0]=='': r[0:1]=[]
+                    r = tuple([t(v) for t,v in zip(ptypes,r)])
+                    result.append( r )
+
+        self.result = result
+
+
+def testConnection():
+    import os
+    log = logging.getLogger( "TrigConfFrontier.py::testConnection()" )
+    log.setLevel(logging.DEBUG)
+
+    from TriggerJobOpts.TriggerFlags import TriggerFlags as tf
+    tf.triggerUseFrontier = True
+
+    from TrigConfigSvc.TrigConfigSvcUtils import interpretConnection
+    connectionParameters = interpretConnection("TRIGGERDBREPR")
+
+    cursor = FrontierCursor2( url = connectionParameters['url'], schema = connectionParameters['schema'])
+
+    query = "select distinct SM.SMT_ID, SM.SMT_NAME, SM.SMT_VERSION, SM.SMT_COMMENT, SM.SMT_ORIGIN, SM.SMT_USERNAME, SM.SMT_STATUS from ATLAS_CONF_TRIGGER_REPR.SUPER_MASTER_TABLE SM order by SM.SMT_ID"
+
+    cursor.execute(query)
+
+    for r in cursor.result[:20]:
+        print r
+
+    query = """
+SELECT DISTINCT
+CP.HCP_NAME,
+CP.HCP_ALIAS,
+TE2CP.HTE2CP_ALGORITHM_COUNTER,
+TE.HTE_ID,
+TE.HTE_NAME,
+TE2TE.HTE2TE_TE_INP_ID,
+TE2TE.HTE2TE_TE_INP_TYPE,
+TE2TE.HTE2TE_TE_COUNTER
+FROM
+ATLAS_CONF_TRIGGER_REPR.SUPER_MASTER_TABLE    SM,
+ATLAS_CONF_TRIGGER_REPR.HLT_MASTER_TABLE      HM,
+ATLAS_CONF_TRIGGER_REPR.HLT_TM_TO_TC          M2C,
+ATLAS_CONF_TRIGGER_REPR.HLT_TC_TO_TS          TC2TS,
+ATLAS_CONF_TRIGGER_REPR.HLT_TS_TO_TE          S2TE,
+ATLAS_CONF_TRIGGER_REPR.HLT_TRIGGER_ELEMENT   TE,
+ATLAS_CONF_TRIGGER_REPR.HLT_TE_TO_CP          TE2CP,
+ATLAS_CONF_TRIGGER_REPR.HLT_TE_TO_TE          TE2TE,
+ATLAS_CONF_TRIGGER_REPR.HLT_COMPONENT         CP
+WHERE
+SM.SMT_ID     = 539
+AND HM.HMT_ID = SM.SMT_HLT_MASTER_TABLE_ID
+AND HM.HMT_TRIGGER_MENU_ID = M2C.HTM2TC_TRIGGER_MENU_ID
+AND M2C.HTM2TC_TRIGGER_CHAIN_ID = TC2TS.HTC2TS_TRIGGER_CHAIN_ID
+AND TC2TS.HTC2TS_TRIGGER_SIGNATURE_ID = S2TE.HTS2TE_TRIGGER_SIGNATURE_ID
+AND TE.HTE_ID = S2TE.HTS2TE_TRIGGER_ELEMENT_ID
+AND TE.HTE_ID = TE2CP.HTE2CP_TRIGGER_ELEMENT_ID
+AND TE.HTE_ID = TE2TE.HTE2TE_TE_ID
+AND CP.HCP_ID = TE2CP.HTE2CP_COMPONENT_ID
+ORDER BY
+TE.HTE_ID ASC,
+TE2CP.HTE2CP_ALGORITHM_COUNTER DESC"""
+
+    cursor.execute(query)
+
+    for r in cursor.result[:20]:
+        print r
+
+    return 0
+
+
+def testBindVarResolution():
+    query = "SELECT :bar WHERE :foo = :bar sort by :ups asc, :foo"
+    bindvars = {"foo": 500, "bar": 8, "ups": 42 }
+    print "Query"
+    print query
+    print "is translated to"
+    print FrontierCursor2.resolvebindvars(query, bindvars)
+
+    
+if __name__=="__main__":
+    import sys
+    res = testBindVarResolution()
+    res = max(res, testConnection())
+    sys.exit(res)
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfMetaData.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfMetaData.py
new file mode 100644
index 0000000000000000000000000000000000000000..1bca4f187a010b2b4e6b7a5550142af9694932c7
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfMetaData.py
@@ -0,0 +1,30 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+## @file  TrigConfMetaData.py
+## @brief Meta data for the trigger configuration
+## $Id: $
+
+from GaudiKernel.GaudiHandles import *
+from GaudiKernel.Proxy.Configurable import *
+
+class TrigConfMetaData( ConfigurableUser ) :
+  """Configurable to store aribitray meta data in the job options
+  catalogue and the trigger database.
+  """
+  __slots__ = {      
+    'PreCommand' : '', # str
+    'JobOptions': '',  # str
+    'Modifiers': [ ],  # list
+  }
+  _propertyDocDct = { 
+    'PreCommand' : """ Command line flags used when creating the configuration """,
+    'JobOptions': """ Job options used when creating the configuraton """,
+    'Modifiers': """ List of modifiers used with runHLT_standalone.py """,
+  }
+  def __init__(self, name = Configurable.DefaultName, **kwargs):
+      super(TrigConfMetaData, self).__init__(name)
+      for n,v in kwargs.items():
+         setattr(self, n, v)
+
+  def getType( self ):
+      return 'TrigConfMetaData'
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigCheckInPool.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigCheckInPool.py
new file mode 100644
index 0000000000000000000000000000000000000000..cd4bc5ac174f6d817c1e1fe18d9ab82c4f0693ba
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigCheckInPool.py
@@ -0,0 +1,84 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import ROOT, PyCintex
+import AthenaROOTAccess.transientTree
+
+from AthenaCommon.Logging import logging
+mlog = logging.getLogger( 'TrigConfigCheckInPool.py' ) ## get the logger
+mlog.level=1
+
+MetaDataTree = ROOT.AthenaROOTAccess.TChainROOTAccess('MetaData')
+
+def _iter(self) :
+    sequential = self.begin()
+    end        = self.end()
+    while sequential != end :
+        yield sequential.__deref__()
+        sequential.__preinc__()
+    raise StopIteration
+
+_plcClass = PyCintex.makeClass("IOVPayloadContainer")
+_plcClass.iter  = _iter
+
+ROOT.IOVTime.__str__ = lambda x: "%i/%i" % (x.run(),x.event())
+ROOT.IOVRange.__str__ = lambda x: "%s - %s" % (x.start(),x.stop())
+
+
+def checkPoolFileForRunLevel(poolfilename):
+    folderName = {
+        "L1M"  : "_TRIGGER_LVL1_Menu",
+        "HLTM" : "_TRIGGER_HLT_Menu",
+        "L1K"  : "_TRIGGER_LVL1_Lvl1ConfigKey",
+        "HLTK" : "_TRIGGER_HLT_HltConfigKeys",
+        "L1PS" : "_TRIGGER_LVL1_Prescales"
+        }
+    MetaDataTree.Add(poolfilename+'/MetaData')
+    mdt = AthenaROOTAccess.transientTree.makeTree(MetaDataTree,
+                                                  persTreeName = 'MetaData',
+                                                  dhTreeName = 'MetaDataHdrDataHeader')
+    l1keys = []
+    hltkeys = []
+
+    if hasattr(mdt,folderName["L1K"]):
+        br = mdt.GetBranch(folderName["L1K"])
+        for i in xrange(mdt.GetEntries()):
+            br.GetEntry(i)
+            metaData = getattr(mdt, br.GetName())
+            plc = metaData.payloadContainer()
+            for payload in plc.iter():
+                for i in xrange(payload.size()):
+                    chanNum = int(payload.chanNum(i))
+                    iovr = payload.iovRange(chanNum)
+                    l1keys += [ payload.attributeList(chanNum)["Lvl1PrescaleConfigurationKey"].data("unsigned int")() ]
+
+    if hasattr(mdt,folderName["HLTK"]):
+        br = mdt.GetBranch(folderName["HLTK"])
+        for i in xrange(mdt.GetEntries()):
+            br.GetEntry(i)
+            metaData = getattr(mdt, br.GetName())
+            plc = metaData.payloadContainer()
+            for payload in plc.iter():
+                for i in xrange(payload.size()):
+                    chanNum = int(payload.chanNum(i))
+                    iovr = payload.iovRange(chanNum)
+                    hltkeys += [ payload.attributeList(chanNum)["HltPrescaleConfigurationKey"].data("unsigned int")() ]
+
+    mlog.info("File contained these LVL1 prescale keys: %r" % l1keys)
+    mlog.info("File contained these HLT prescale keys: %r" % hltkeys)
+
+    hasL1 = len(l1keys)>0 and not 0 in l1keys 
+    hasHLT = len(hltkeys)>0 and not 0 in hltkeys 
+
+    from TriggerJobOpts.TriggerFlags import TriggerFlags
+    if hasL1 or hasHLT:
+        if hasL1 and hasHLT:
+            TriggerFlags.dataTakingConditions='FullTrigger'
+        elif hasL1:
+            TriggerFlags.dataTakingConditions='Lvl1Only'
+        else:
+            TriggerFlags.dataTakingConditions='HltOnly'
+        mlog.info("Set TriggerFlags.dataTakingConditions to '%s'" % TriggerFlags.dataTakingConditions())
+
+
+
+    
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py
new file mode 100755
index 0000000000000000000000000000000000000000..8a108582a6093884666b4e048c3b4785434e11f5
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcConfig.py
@@ -0,0 +1,384 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TrigConfigSvc.TrigConfigSvcConf import *
+
+# Hack: xml.etree module is hidden by mistake in LCG56c
+from PyUtils.xmldict import import_etree
+etree = import_etree()
+import xml.etree.cElementTree as ET
+
+from string import find, split
+from os.path import exists, join, abspath
+
+from AthenaCommon.Logging import logging  # loads logger
+from PyUtils.Decorators import memoize
+
+@memoize
+def findFileInXMLPATH(filename):
+    """ Use XMLPATH to find files (cache result through memoize decorator)"""
+
+    if filename=="NONE":
+        return filename
+
+    filename = str(filename)
+
+    mlog = logging.getLogger("TrigConfigSvcConfig.py")
+    mlog.debug("Searching XML config file for HLT")
+    if filename.find('./') is 0: ## this expected to be local file, name starts from ./
+        return filename
+    else:
+        mlog.debug("Nonlocal XML config file for HLT")
+        from os import environ
+        ## even if ./ not as file name prefix look first in PWD
+        if exists(filename):
+            mlog.info(filename+" XML configuration file taken from working directory")
+            return filename
+
+        ## search XMLPATH path
+        if not environ.has_key('XMLPATH'): ## XMLPATH is not known ... no search is performed
+            mlog.info("XML file: "+filename + " not found and XMLPATH not given" )
+            return filename
+
+        xmlpath = environ['XMLPATH']
+        paths = split(xmlpath, ":")
+        for path in paths:
+
+            test = join(path, filename)
+            if exists(test):
+                mlog.info("Found XML file: " + abspath(test))
+                return abspath(test)
+
+            test = join(path, "TriggerMenuXML",filename)
+            if exists(test):
+                mlog.info("Found XML file: " + abspath(test))
+                return abspath(test)
+
+        return filename
+
+
+
+class DefaultHLTConfigSvc( TrigConf__HLTConfigSvc ):
+    #__slots__ = []
+    def __init__( self, name="HLTConfigSvc" ):
+        super( DefaultHLTConfigSvc, self ).__init__( name )  #
+
+
+    def getAlgorithmsByLevel(self):
+        """Produces pair of lists with algorithms scheduled for  L2 and EF"""
+
+        mlog = logging.getLogger("TrigConfigSvcConfig.py")
+        from TriggerJobOpts.TriggerFlags import TriggerFlags
+        if TriggerFlags.readMenuFromTriggerDb():
+            from TrigConfigSvc.TrigConfigSvcUtils import getAlgorithmsForMenu
+            mlog.info("Will load algos from DB")
+            l2algs, efalgs = getAlgorithmsForMenu(TriggerFlags.triggerDbConnection(),TriggerFlags.triggerDbKeys()[0])
+        else:
+            mlog.info("Will load algos from xml")
+            l2algs = []
+            efalgs = []
+            doc = ET.parse(self.XMLMenuFile)
+            algs = self.getAllAlgorithms(doc)
+            l2TEs, efTEs = self.getTEsByLevel(doc)
+            
+            for te in l2TEs:
+                if te in algs.keys():
+                    l2algs += algs[te]
+
+            for te in efTEs:
+                if te in algs.keys():
+                    efalgs += algs[te]
+                    
+        return l2algs, efalgs
+
+    def getTEsByLevel(self, doc = None):
+        """Produce 2 lists of all TEs used in signatures of level L2 and EF"""
+        l2TEs = []
+        efTEs = []
+        #print "INFO parsing: " + self.XMLMenuFile
+        if not doc: doc = ET.parse(self.XMLMenuFile)
+
+        #print "INFO got chains " + str(chainlist)
+        for ch in doc.getiterator("CHAIN"):
+            for te in ch.getiterator("TRIGGERELEMENT"):
+                if ch.get("level") == "L2":
+                    l2TEs.append(te.get("te_name"))
+                else:
+                    efTEs.append(te.get("te_name"))
+
+        # having TEs of each level which are mentioned in chains we need to scan sequences now
+        # and find if there are some recursive sequences to be called
+        seqinp = self.getAllSequenceInputs()
+        for te in l2TEs:
+            if te in seqinp.keys():
+                l2TEs.extend(seqinp[te]) # note that this recursive (we extend list on which we loop)
+
+        for te in efTEs:
+            if te in seqinp.keys():
+                efTEs.extend(seqinp[te]) # note that this recursive (we extend list on which we loop)
+
+        # make them unique
+        l2TEs = self.unique(l2TEs)
+        efTEs = self.unique(efTEs)
+
+        # eliminate from EF list those TEs mentioned in the L2
+        temp = []
+        for te in efTEs:
+            if te not in l2TEs:
+                temp.append(te)
+        efTEs = temp
+        return l2TEs, efTEs
+
+    def unique(self, l):
+        #d = {}
+        #for item in l:
+        #    d[item] = item
+        #return d.keys()
+        return list(set(l))
+
+
+    def getAllSequenceInputs (self, doc = None):
+        """ Produce dictionaries where key is outout TE name and values are tuples of TEs """
+        if not doc: doc = ET.parse(self.XMLMenuFile)
+        inp = {}
+        for seq in doc.getiterator("SEQUENCE"):
+            #print "INFO Discovered algorithms in the sequence: " + seq.getAttribute("algorithm")
+            inp[seq.get("output")] = seq.get("input").split()
+        return inp
+
+    def getAllAlgorithms(self, doc = None):
+        """ Produce dictionary where key is output TE name of the sequence and value is a list of algos in sequence"""
+        #print "INFO parsing: " + self.XMLMenuFile
+        if not doc: doc = ET.parse(self.XMLMenuFile)
+        #print "INFO getting sequences "
+        algos = {}
+        for seq in doc.getiterator("SEQUENCE"):
+            algos[seq.get("output")] = seq.get("algorithm").split()
+        
+        return algos
+
+
+
+class TestingHLTConfigSvc ( DefaultHLTConfigSvc ):
+    def __init__( self, name="HLTConfigSvc" ):
+        super( TestingHLTConfigSvc, self ).__init__( name )  #
+
+    def setDefaults(self, handle):
+        from AthenaCommon.Constants import VERBOSE
+        handle.OutputLevel=VERBOSE
+
+
+class HLTConfigSvc ( DefaultHLTConfigSvc ):
+    def __init__( self, name="HLTConfigSvc" ):
+        super( HLTConfigSvc, self ).__init__( name )  #
+
+    def setDefaults(self, handle):
+        pass
+
+
+
+class DefaultLVL1ConfigSvc ( TrigConf__LVL1ConfigSvc ):
+    __slots__ = []
+    def __init__( self, name="LVL1ConfigSvc" ):
+        super( DefaultLVL1ConfigSvc, self ).__init__( name )  #
+
+    def setDefaults(self, handle):
+        pass
+
+
+class TestingLVL1ConfigSvc ( TrigConf__LVL1ConfigSvc ):
+    __slots__ = []
+    def __init__( self, name="LVL1ConfigSvc" ):
+        super( TestingLVL1ConfigSvc, self ).__init__( name )  #
+
+    def setDefaults(self, handle):
+        from AthenaCommon.Constants import VERBOSE
+        handle.OutputLevel=VERBOSE
+
+
+
+
+class LVL1ConfigSvc ( DefaultLVL1ConfigSvc ):
+    __slots__ = []
+    def __init__( self, name="LVL1ConfigSvc" ):
+        super( LVL1ConfigSvc, self ).__init__( name )
+
+    @property
+    def XMLFile(self):
+        '''The xml file name for backward compatibility with old property name'''
+        return  self.XMLMenuFile
+
+    @XMLFile.setter
+    def XMLFile(self, xmlfile):
+        log = logging.getLogger("LVL1ConfigSvc")
+        log.warning( "LVL1ConfigSvc property XMLFile will soon be deprecated. Please use XMLMenuFile instead" )
+        self.XMLMenuFile = xmlfile
+    
+    def setDefaults(self, handle):
+        pass
+
+class L1TopoConfigSvc ( TrigConf__L1TopoConfigSvc ) :
+    """L1Topo configuration"""
+    __slots__ = []
+    def __init__(self, name="L1TopoConfigSvc" ):
+        super (L1TopoConfigSvc, self).__init__(name)
+
+    def setDetaults(self, handle):
+        pass
+
+class DSConfigSvc ( TrigConf__DSConfigSvc ) :
+    """Detector Store implementation of the TrigConfigSvc"""
+    __slots__ = []
+    def __init__(self, name="DSConfigSvc" ):
+        super (DSConfigSvc, self).__init__(name)
+
+    def setDetaults(self, handle):
+        pass
+
+class TrigConfigSvc( TrigConf__TrigConfigSvc ):
+    __slots__ = []
+    def __init__(self, name="TrigConfigSvc" ):
+        super( TrigConfigSvc, self).__init__(name)
+
+    def setDefaults(self, handle):
+        pass
+
+
+# singleton class used for all
+# clients of any TrigConfigSvc
+# usage:
+# from TrigConfigSvc.TrigConfigSvcConfig import SetupTrigConfigSvc
+# svc = SetupTrigConfigSvc()
+# svc.SetStates( ["ds"] )
+# svc.InitialiseSvc()
+#
+# after InitialiseSvc() is called, the state is fixed
+# possible states are: ds, xml
+try:
+    _set = set
+except NameError:
+    from sets import Set
+    _set = Set
+
+class SetupTrigConfigSvc:
+    """ A python singleton class for configuring the trigger configuration services"""
+
+    class __impl:
+        """ Implementation of the singleton interface """
+
+        def __init__(self):
+            """
+            state == xml -> read the trigger configuration from 2 xml files, one for L1, one for HLT
+            stats == ds  -> read the trigger configuration from the detector store = esd header
+            """
+            self.states = ["xml"]
+            self.allowedStates = _set(['xml','ds'])
+            self.initialised = False
+
+            from AthenaCommon.Logging import logging
+            self.mlog = logging.getLogger("TrigConfigSvcConfig.py")
+
+            # svc properties:
+            self.l1topoXmlFile = 'NONE'
+            self.hltXmlFile = 'HLT_XML_FILE_NOT_SET'
+            self.l1XmlFile  = 'L1_XML_FILE_NOT_SET'
+
+        def spam(self):
+            """ Test method, return singleton id """
+            return id(self)
+
+
+        def SetStates(self, state):
+            if self.initialised:
+                raise SetupTrigConfigSvc, 'state cannot be changed anymore, the athena service has already been added!'
+
+            if not type(state) is list:
+                state = [state]
+
+            if not _set(state) <= self.allowedStates:
+                raise SetupTrigConfigSvc, 'unknown state %s, cannot set it!' %state
+            else:
+                self.states = state
+
+        def GetConfigurable(self):
+            try:
+                self.InitialiseSvc()
+            except:
+                self.mlog.debug( 'ok, TrigConfigSvc already initialised' )
+
+            return self.GetPlugin()
+
+
+        def InitialiseSvc(self):
+            if self.initialised:
+                raise SetupTrigConfigSvc, 'athena service has already been added, do nothing.'
+
+            self.initialised = True
+
+            from AthenaCommon.AppMgr import ServiceMgr
+
+
+            self.mlog.info( "initialising TrigConfigSvc using state %s" % self.states )
+            if 'xml' in self.states:
+                from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+
+                if TriggerFlags.doLVL2() or TriggerFlags.doEF() or TriggerFlags.doHLT() or TriggerFlags.configForStartup()=='HLToffline':
+                    self.mlog.info( "setup HLTConfigSvc and add instance to ServiceMgr (xml file="+self.hltXmlFile+")" )
+                    hlt = HLTConfigSvc("HLTConfigSvc")
+                    hlt.XMLMenuFile = findFileInXMLPATH(self.hltXmlFile)
+                    hlt.doMergedHLT = TriggerFlags.doHLT()
+                    ServiceMgr += hlt
+                else:
+                    self.mlog.info( "Will not setup HLTConfigSvc, since TriggerFlags doLVL2(), doEF(), and doHLT() are all False" )
+                    self.states[self.states.index("xml")] = "xmll1"
+
+                self.mlog.info( "setup LVL1ConfigSvc and add instance to ServiceMgr (xml file="+self.l1XmlFile+")" )
+                l1 = LVL1ConfigSvc("LVL1ConfigSvc")
+                l1.XMLMenuFile = findFileInXMLPATH(self.l1XmlFile)
+                ServiceMgr += l1
+
+                self.mlog.info( "setup L1TopoConfigSvc and add instance to ServiceMgr (xml file="+self.l1topoXmlFile+")" )
+                l1topo = L1TopoConfigSvc()
+                l1topo.XMLMenuFile = findFileInXMLPATH(self.l1topoXmlFile)
+                ServiceMgr += l1topo
+
+
+            if 'ds' in self.states:
+
+                self.mlog.info( "setup DSConfigSvc and add instance to ServiceMgr" )
+                ds = DSConfigSvc("DSConfigSvc")
+                ServiceMgr += ds
+
+            self.mlog.info( "setup TrigConfigSvc and add instance to ServiceMgr" )
+            trigSvc = TrigConfigSvc("TrigConfigSvc")
+            trigSvc.PriorityList = self.states
+            ServiceMgr += trigSvc
+
+
+        def GetPlugin(self):
+            if not self.initialised:
+                raise SetupTrigConfigSvc, 'athena service has not been added, cannot return plugin!.'
+            from AthenaCommon.AppMgr import ServiceMgr
+            return ServiceMgr.TrigConfigSvc
+
+    # storage for the instance reference
+    __instance = None
+
+    def __init__(self):
+        """ Create singleton instance """
+        # Check whether we already have an instance
+        if SetupTrigConfigSvc.__instance is None:
+            # Create and remember instance
+            SetupTrigConfigSvc.__instance = SetupTrigConfigSvc.__impl()
+
+        # Store instance reference as the only member in the handle
+        self.__dict__['_SetupTrigConfigSvc__instance'] = SetupTrigConfigSvc.__instance
+
+    def __getattr__(self, attr):
+        """ Delegate access to implementation """
+        from AthenaCommon.Logging import logging
+        return getattr(self.__instance, attr)
+
+    def __setattr__(self, attr, value):
+        """ Delegate access to implementation """
+        return setattr(self.__instance, attr, value)
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcUtils.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcUtils.py
new file mode 100644
index 0000000000000000000000000000000000000000..b6f8a5a1f3b0357b59218391e1b9e6b0f53b0033
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigConfigSvcUtils.py
@@ -0,0 +1,752 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+from xml.dom import minidom
+import re
+import os
+
+try:
+    _set = set
+except NameError:
+    from sets import Set
+    _set = Set
+
+
+from AthenaCommon.Logging import logging
+from AthenaCommon.Utils.unixtools import FindFile
+
+if logging.getLogger( "TrigConfigSvcUtils.py" ).level==0:
+    logging.getLogger( "TrigConfigSvcUtils.py" ).setLevel(logging.INFO)
+
+#**
+# In this section:
+#
+# interpretation of DB alias and creating DB connection when running Reco transforms
+#**
+def _getFileLocalOrPath(filename, pathenv):
+    """looks for filename in local directory and then in all paths specified in environment variable 'pathenv'
+    returns path/filename if existing, otherwise None
+    """
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+    if os.path.exists(filename):
+        log.info( "Using local file %s" % filename)
+        return filename
+
+    pathlist = os.getenv(pathenv,'').split(os.pathsep)
+    resolvedfilename = FindFile(filename, pathlist, os.R_OK)
+    if resolvedfilename:
+        return resolvedfilename
+
+    log.fatal("No file %s found locally nor in %s" % (filename, os.getenv('CORAL_DBLOOKUP_PATH')) )
+    return None
+    
+
+def _getConnectionServicesForAlias(alias):
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+
+    connectionServices = None # list of services
+
+    dblookupfilename = _getFileLocalOrPath('dblookup.xml','CORAL_DBLOOKUP_PATH')
+    if dblookupfilename == None: return None
+
+    doc = minidom.parse(dblookupfilename)
+    for ls in doc.getElementsByTagName('logicalservice'):
+        if ls.attributes['name'].value != alias: continue
+        connectionServices = [str(s.attributes['name'].value) for s in ls.getElementsByTagName('service')]
+    doc.unlink()
+
+    log.info( "For alias '%s' found list of connections %r" % (alias,connectionServices) )
+    if connectionServices == None:
+        log.fatal("Trigger connection alias '%s' is not defined in %s" % (alias,dblookupfilename))
+    return connectionServices
+
+
+def _readAuthentication():
+    """ read authentication.xml, first from local directory, then from all paths specified in CORAL_AUTH_PATH
+
+    returns dictionary d with d[connection] -> (user,pw)
+    """
+
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+    authDict = {}
+
+    dbauthfilename = _getFileLocalOrPath('authentication.xml','CORAL_AUTH_PATH')
+    if dbauthfilename == None: return authDict
+
+    doc = minidom.parse(dbauthfilename)        
+    for cn in doc.getElementsByTagName('connection'):
+        user = ""
+        pw = ""
+        svc = cn.attributes['name'].value
+        for p in cn.getElementsByTagName('parameter'):
+            if p.attributes['name'].value == 'user': user = p.attributes['value'].value
+            if p.attributes['name'].value == 'password': pw = p.attributes['value'].value
+        authDict[cn.attributes['name'].value] = (user,pw)
+    doc.unlink()
+    return authDict
+
+
+
+authDict = None
+
+def _getConnectionParameters(connection):
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+    connection = str(connection)
+    connectionParameters = {}
+
+    if connection.startswith("sqlite_file:"):
+        filename = connection[connection.find(':')+1:]
+        connectionParameters["techno"] = "sqlite"
+        connectionParameters["filename"] = filename if os.path.exists(filename) else None
+        
+    elif connection.startswith("oracle://"):
+        if connection.count(';') == 2:
+            pattern = "(.*)://(.*)/(.*);username=(.*);password=(.*)"
+            m = re.match(pattern,connection)
+            #print 'Groups ', m
+            if not m:
+                log.fatal("connection string '%s' doesn't match the pattern '%s'?" % (connection,pattern))
+            (techno, server, schema, user, passwd) = m.groups()
+            #print (techno, server, schema, user, passwd)
+        else:
+            global authDict
+            if not authDict: authDict = _readAuthentication()
+            pattern = "oracle://(.*)/(.*)"
+            m = re.match(pattern,connection)
+            if not m:
+                log.fatal("connection string '%s' doesn't match the pattern '%s'?" % (connection,pattern))
+            (server, schema) = m.groups()
+            (user,passwd) = authDict[connection]
+        #info from auth file also unicode
+        connectionParameters["techno"] = 'oracle'
+        connectionParameters["server"] = str(server)
+        connectionParameters["schema"] = str(schema)
+        connectionParameters["user"  ] = str(user)
+        connectionParameters["passwd"] = str(passwd)
+
+    elif connection.startswith("mysql://"):
+        pattern = "mysql://(.*);dbname=(.*);user=(.*);passwd=(.*);"
+        m = re.match(pattern,connection)
+        if not m:
+            log.fatal("connection string '%s' doesn't match the pattern '%s'?" % (connection,pattern) )
+        (server, dbname, user, passwd) = m.groups()
+        connectionParameters["techno"] = 'mysql'
+        connectionParameters["server"] = server
+        connectionParameters["dbname"] = dbname
+        connectionParameters["user"  ] = user
+        connectionParameters["passwd"] = passwd
+
+    elif connection.startswith("frontier://"):
+        pattern = "frontier://ATLF/\(\)/(.*)"
+        m = re.match(pattern,connection)
+        if not m:
+            log.fatal("connection string '%s' doesn't match the pattern '%s'?" % (connection,pattern) )
+        (schema, ) = m.groups()
+        connectionParameters["techno"] = 'frontier'
+        connectionParameters["schema"] = schema
+
+    return connectionParameters
+
+
+def interpretConnection(connection, debug=False, resolveAlias=True):
+    # connection needs to be of the following format (this is also the order of checking)
+    # <ALIAS>                              -- any string without a colon ':' will be checked for in the dblookup.xml file
+    # type:<detail>                        -- no dblookup will be used, type has to be oracle, mysql, or sqlite_file
+    # sqlite_file:filename.db              -- an sqlite file, no authentication needed, will be opened in read-only mode
+    # oracle://ATLR/ATLAS_CONF_TRIGGER_V2  -- a service description without user and password, requires lookup in authentication.xml
+    # oracle://ATLR/ATLAS_CONF_TRIGGER_V2;username=ATLAS_CONF_TRIGGER_V2_R;password=<...>  -- a service description with user and password
+
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+    log.info("Specified connection string '%s'" % connection)
+
+    # not needed any longer
+    # connection = connection.lstrip("dblookup://")
+    # connection = connection.lstrip("dblookup:")
+    # connection = connection.rstrip(";")
+    #print connection
+
+    # what to return
+    connectionParameters = {}
+    connection = str(connection)
+
+    # connection explicitly specified (no DB alias)
+    if ':' in connection:
+        connectionParameters = _getConnectionParameters( connection )
+        return connectionParameters
+
+
+    # connection is a DB alias
+    connectionParameters["alias"] = connection
+    if not resolveAlias:
+        return connectionParameters
+
+    connectionServices = _getConnectionServicesForAlias( connection ) # alias resolution via dblookup
+    if connectionServices == None:
+        return connectionParameters
+
+
+    # If TriggerFlags.triggerUseFrontier=true then we remove sqlite files
+    from TriggerJobOpts.TriggerFlags import TriggerFlags as tf
+    if tf.triggerUseFrontier() or os.getenv('TRIGGER_USE_FRONTIER',False):
+        connectionServices = filter(lambda conn: not conn.startswith("sqlite_file"), connectionServices)
+        if 'ATLAS_TRIGGERDB_FORCESQLITE' in os.environ:
+            log.fatal("Inconsistent setup: environment variable ATLAS_TRIGGERDB_FORCESQLITE is defined and use of Frontier is requested" )
+
+
+    # SQLite
+    sqliteconnections = [conn for conn in connectionServices if conn.startswith("sqlite_file")]
+    if len(sqliteconnections)>0:
+        for conn in sqliteconnections:
+            connectionParameters = _getConnectionParameters( conn )
+            if connectionParameters["filename"] != None:
+                break # stop at the first sqlite file that exists
+        if connectionParameters["filename"] != None:
+            log.info("Using sqlite connection %s" % connectionParameters)
+            return connectionParameters
+        else:
+            if 'ATLAS_TRIGGERDB_FORCESQLITE' in os.environ:
+                log.fatal("environment ATLAS_TRIGGERDB_FORCESQLITE is defined but non of the sqlite files defined in dblookup.xml exists" )
+    else:
+        if 'ATLAS_TRIGGERDB_FORCESQLITE' in os.environ:
+            log.fatal("environment ATLAS_TRIGGERDB_FORCESQLITE is defined but no sqlite connection defined in dblookup.xml" )
+
+    # replicaList
+    from CoolConvUtilities.AtlCoolLib import replicaList
+    serverlist=['ATLAS_CONFIG' if s=='ATLAS_COOLPROD' else s for s in replicaList()]  # replicaList is for COOL, I need ATLAS_CONFIG instead of ATLAS_COOLPROD
+    log.info("Trying these servers in order %r" % serverlist)
+    for server in serverlist:
+        log.info("Trying server %s" % server)
+
+        if server=='ATLF':
+            if not tf.triggerUseFrontier() and not os.getenv('TRIGGER_USE_FRONTIER',False): continue
+            frontierconnections = [conn for conn in connectionServices if conn.startswith("frontier")]
+            if len(frontierconnections) == 0:
+                log.debug("FroNTier connection not defined for alias %s in dblookup" % connection )
+                continue
+            log.info("Environment FRONTIER_SERVER: %s" % os.getenv('FRONTIER_SERVER','not defined'))
+            frontierServer = os.getenv('FRONTIER_SERVER',None)
+            if not frontierServer:
+                log.debug("No environment variable FRONTIER_SERVER" )
+                continue
+            connectionParameters = _getConnectionParameters( frontierconnections[0] )
+            connectionParameters['url'] = frontierServer
+            log.info("Using frontier connection %s" % frontierconnections[0])
+            #connstr='frontier://ATLF/%s;schema=%s;dbname=TRIGCONF' % (connectionParameters['url'],connectionParameters["schema"])
+            break
+        elif server=='atlas_dd': continue
+        else:
+            oracleconnections = [conn for conn in connectionServices if conn.startswith("oracle://%s/" % server)]
+            if len(oracleconnections) == 0:
+                log.debug("Oracle connection not defined for server %s in dblookup" % server )
+                continue
+            connectionParameters = _getConnectionParameters( oracleconnections[0] )
+            log.info("Using oracle connection %s" % oracleconnections[0])
+            #connstr='oracle://%s;schema=ATLAS_%s;dbname=TRIGCONF' % (connectionParameters["server"],connectionParameters["schema"])
+            break
+
+    return connectionParameters
+
+
+def getTriggerDBCursor(connection):
+
+    connectionParameters = interpretConnection(connection)
+
+    technology = connectionParameters["techno"]
+
+    if technology == 'sqlite':
+        cursor = _get_sqlite_cursor(connectionParameters["filename"])
+        schema = ''
+
+    elif technology == 'oracle':
+        cursor = _get_oracle_cursor(connectionParameters["server"], connectionParameters["user"], connectionParameters["passwd"])
+        schema = connectionParameters["schema"].rstrip('.') + '.'
+
+    elif technology == 'frontier':
+        from TrigConfigSvc.TrigConfFrontier import getFrontierCursor 
+        cursor = getFrontierCursor(connectionParameters["url"], connectionParameters["schema"], logging.getLogger("TrigConfigSvcUtils.py").level)
+        schema = connectionParameters["schema"].rstrip('.') + '.'
+
+    elif technology == 'mysql':
+        cursor = _get_mysql_cursor(connectionParameters["server"], connectionParameters["dbname"], connectionParameters["user"], connectionParameters["passwd"]),''
+        schema = ''
+
+    return cursor,schema
+
+def _get_sqlite_cursor (filename):
+    try: import sqlite3
+    except ImportError: raise RuntimeError, "ERROR: Can't import sqlite3?"
+    os.lstat(filename)
+    connection = sqlite3.connect(filename)
+    return connection.cursor()
+
+def _get_oracle_cursor (tns, user, passwd=""):
+    if passwd=="":
+        from getpass import getpass
+        passwd = getpass("[Oracle] database password for %s@%s: " % (user, tns))
+
+    try: from cx_Oracle import connect
+    except ImportError: raise RuntimeError, "ERROR: Can't import cx_Oracle?"
+    connection = connect (user, passwd, tns, threaded=True)
+    return connection.cursor()
+
+
+def _get_mysql_cursor (host, db, user, passwd=""):
+    if passwd=="":
+        from getpass import getpass
+        passwd = getpass("[MySQL] `%s' database password for %s@%s: " % (db, user, host))
+
+    try: from MySQLdb import connect
+    except ImportError: raise RuntimeError, "ERROR: Can't import MySQLdb?"
+    connection = connect(host=host, user=user, passwd=passwd, db=db, connect_timeout=10)
+    return connection.cursor()
+
+def getUsedTables(output, condition, schemaname, tables):
+    usedtables = _set()
+    for o in output:
+        usedtables.add(o.split('.')[0])
+    for c in condition:
+        for p in c.split():
+            if '.' in p and not '\'' in p: usedtables.add(p.split('.')[0].lstrip('('))
+    return ["%s%s %s" % (schemaname,tables[t],t) for t in usedtables]
+
+
+def executeQuery(cursor, output, condition, schemaname, tables, bindvars=()):
+    query = 'select distinct %s from %s' % \
+            (', '.join(output),
+             ', '.join(getUsedTables(output, condition, schemaname, tables)))
+    
+    if condition:
+        query += ' where ' + ' and '.join(condition)
+
+
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+    
+    if len(bindvars)==0:
+        log.debug("Executing query %s" % query)
+        cursor.execute(str(query))
+    else:
+        log.debug("Executing query %s with bound variables %r" % (query, bindvars))
+        cursor.execute(str(query),bindvars)
+    return cursor.fetchall()
+
+
+
+def getAlgorithmsForMenu(connection, smk):
+    cursor,schemaname = getTriggerDBCursor(connection)
+
+    output = ['TC.HTC_L2_OR_EF', 'C.HCP_NAME', 'C.HCP_ALIAS' ]
+    
+    tables = {}
+    tables['SM']    = 'SUPER_MASTER_TABLE'
+    tables['HM']    = 'HLT_MASTER_TABLE'
+    tables['TM']    = 'HLT_TRIGGER_MENU'
+    tables['M2C']   = 'HLT_TM_TO_TC'
+    tables['TC']    = 'HLT_TRIGGER_CHAIN'
+    tables['C2S']   = 'HLT_TC_TO_TS'
+    tables['S2TE']  = 'HLT_TS_TO_TE'
+    tables['TE2C']  = 'HLT_TE_TO_CP'
+    tables['TE2TE'] = 'HLT_TE_TO_TE'
+    tables['C']     = 'HLT_COMPONENT'
+
+    condition = [ "SM.SMT_ID = '%i'" % smk,
+                  'SM.SMT_HLT_MASTER_TABLE_ID = HM.HMT_ID',
+                  'HM.HMT_TRIGGER_MENU_ID = M2C.HTM2TC_TRIGGER_MENU_ID',
+                  'M2C.HTM2TC_TRIGGER_CHAIN_ID = TC.HTC_ID',
+                  'M2C.HTM2TC_TRIGGER_CHAIN_ID = C2S.HTC2TS_TRIGGER_CHAIN_ID',
+                  'C2S.HTC2TS_TRIGGER_SIGNATURE_ID = S2TE.HTS2TE_TRIGGER_SIGNATURE_ID',
+                  'S2TE.HTS2TE_TRIGGER_ELEMENT_ID = TE2C.HTE2CP_TRIGGER_ELEMENT_ID',
+                  'TE2C.HTE2CP_COMPONENT_ID = C.HCP_ID' ]
+
+    res = executeQuery(cursor, output, condition, schemaname, tables)
+
+    l2algs=[]
+    efalgs=[]
+    for x in res:        
+        if x[0]=='L2':
+            l2algs += ["%s/%s" % (x[1],x[2])]
+        else:
+            efalgs += ["%s/%s" % (x[1],x[2])]
+
+    return l2algs, efalgs
+
+def getPropertyFromDB(connection, smk, component, parameter):
+    """Get property value from DB. smk can be a single SMK or a list/tuple of SMKs.
+    SQL wildcards (%) can be used in both component and parameter names.
+    Return [(SMK,Component,Parameter,Value,Level)]
+    """
+    
+    cursor,schemaname = getTriggerDBCursor(connection)
+
+    output = ['SM.SMT_ID', 'HCP.HCP_NAME', 'PAR.HPA_NAME', 'PAR.HPA_VALUE', 'HS.HST_ID', 'HM.HMT_L2_SETUP_ID']
+    
+    tables = {'SM' : 'SUPER_MASTER_TABLE',
+              'HM' : 'HLT_MASTER_TABLE',
+              'HCP': 'HLT_COMPONENT',
+              'HS' : 'HLT_SETUP',
+              'HST2CP' : 'HLT_ST_TO_CP',
+              'HCP2PA' : 'HLT_CP_TO_PA',
+              'PAR'    : 'HLT_PARAMETER'
+              }
+
+    if type(smk)!=list and type(smk)!=tuple:
+        smk = [smk]
+
+    condition = ["SM.SMT_ID IN (%s)" % ",".join([str(i) for i in smk]),
+                 'SM.SMT_HLT_MASTER_TABLE_ID = HM.HMT_ID',
+                 '(HM.HMT_L2_SETUP_ID = HS.HST_ID or HM.HMT_EF_SETUP_ID = HS.HST_ID)',
+                 'HST2CP.HST2CP_SETUP_ID = HS.HST_ID',
+                 'HST2CP.HST2CP_COMPONENT_ID = HCP2PA.HCP2PA_COMPONENT_ID',
+                 'HST2CP.HST2CP_COMPONENT_ID = HCP.HCP_ID',
+                 'HCP2PA.HCP2PA_PARAMETER_ID = PAR.HPA_ID',
+                 "HCP.HCP_NAME like '%s'" % component,
+                 "PAR.HPA_NAME like '%s'" % parameter]
+
+    res = executeQuery(cursor, output, condition, schemaname, tables)
+    return [ tuple(x[:4]+("L2" if x[4]==x[5] else "EF",) ) for x in res ]
+    
+def getMenuNameFromDB(connection, hltprescalekey):
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+
+    cursor,schemaname = getTriggerDBCursor(connection)
+
+    tables = { 'HPS' : 'HLT_PRESCALE_SET' }
+
+    output = ['HPS.HPS_NAME']
+
+    condition = [ "HPS.HPS_ID = '%i'" % hltprescalekey ]
+    
+    res = executeQuery(cursor, output, condition, schemaname, tables)
+
+    # now we need to do some logic, related to the 
+
+    hltpsName = str(res[0][0])
+
+    # temporarily here, but should use the function from TMP
+    m = re.match( "(.*)_default_prescale", hltpsName)
+    menuName = m.group(1) if m else hltpsName
+    # from TriggerMenuPython.TriggerPythonConfig import TriggerPythonConfig
+    # menuName = TriggerPythonConfig.getMenuNameFromHltpsName(hltpsName)
+
+    log.info("Interpreting menu name from HLT prescale key %i: %s" % (hltprescalekey,menuName))
+
+    return menuName
+
+def getKeysFromName(connection, name, MCOnly=False):
+    cursor,schemaname = getTriggerDBCursor(connection)
+    
+    output = ['SM.SMT_ID', 'SM.SMT_NAME']
+    
+    tables = {}
+    tables['SM']    = 'SUPER_MASTER_TABLE'
+
+    condition = [ "SM.SMT_NAME like '%s'" % name ]
+
+    res = executeQuery(cursor, output, condition, schemaname, tables)
+    return res
+
+def getKeysFromNameRelease(connection, name, release, l1only):
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+    
+    cursor,schemaname = getTriggerDBCursor(connection)
+    
+    smname = name.split('__')[0]
+    print 'SM name ', smname
+    print 'PS name ', name
+    print 'release ', release
+    keys = []
+
+    #Find the Release id
+    tables = {}
+    tables['RE'] = 'HLT_RELEASE'
+
+    output = ['RE.HRE_ID']
+    condition = [ "RE.HRE_NAME like '%s'" %release ]
+
+    rel = executeQuery(cursor, output, condition, schemaname, tables)
+    relid = (str(rel[-1])).lstrip('(').rstrip(')').split(',')[0]
+    
+    #Find the supermaster key
+    tables = {}
+    tables['SM']    = 'SUPER_MASTER_TABLE'
+    tables['SM2RE'] = 'HLT_SMT_TO_HRE'
+
+    output = ['SM.SMT_ID']
+    condition = [ "SM.SMT_NAME like '%s'" % smname,
+                  "SM.SMT_ID = SM2RE.SMT2RE_SUPER_MASTER_TABLE_ID",
+                  "SM2RE.SMT2RE_RELEASE_ID = '%s'" % relid]
+    
+    smk  = executeQuery(cursor, output, condition, schemaname, tables)
+    smid = (str(smk[-1])).lstrip('(').rstrip(')').split(',')[0]
+    #NB no check if we return more than one smk! (take the first here with the split!)
+
+    #Find the L1 prescale key with the name and linked to this L1 master
+    tables = {}
+    tables['LPS']   = 'L1_PRESCALE_SET'
+    tables['PS2RE'] = 'L1_HRE_TO_PS'
+    tables['RE']    = 'HLT_RELEASE'
+    
+    output = ['LPS.L1PS_ID']
+    condition = [ "PS2RE.L1RE2PS_RELEASE_ID = '%s'" % relid,
+                  "PS2RE.L1RE2PS_PRESCALE_ID = LPS.L1PS_ID",
+                  "LPS.L1PS_NAME like '%s'" % name]
+    
+    l1k  = executeQuery(cursor, output, condition, schemaname, tables)
+    l1id = (str(l1k[-1])).lstrip('(').rstrip(')').split(',')[0]
+
+    #Check the PSkey returned matches the SMK
+    tables = {}
+    tables['LPS']   = 'L1_PRESCALE_SET'
+    tables['TM2PS'] = 'L1_TM_TO_PS'
+    tables['LTM']  = 'L1_TRIGGER_MENU'
+    tables['LMT']    = 'L1_MASTER_TABLE'
+    tables['SM']    = 'SUPER_MASTER_TABLE'
+    
+    output = ['SM.SMT_ID']
+    condition = [ "LPS.L1PS_ID = '%s'" % l1id,
+                  "TM2PS.L1TM2PS_PRESCALE_SET_ID = '%s'" % l1id,
+                  "TM2PS.L1TM2PS_TRIGGER_MENU_ID = LTM.L1TM_ID",
+                  "LTM.L1TM_ID = LMT.L1MT_TRIGGER_MENU_ID",
+                  "LMT.L1MT_ID = SM.SMT_ID"]
+
+    l1chk  = executeQuery(cursor, output, condition, schemaname, tables)
+    smk_chk = (str(l1chk[-1])).lstrip('(').rstrip(')').split(',')[0]
+    if smk_chk != smid:
+        log.fatal("SMK returned by release, SMK '%s', does not match the one returned by L1PS key, SMK '%s' " %(smid,smk_chk) )
+
+    if not l1only:
+        #Find the HLT prescale key with the name and linked to this HLT master
+        tables = {}
+        tables['HPS']   = 'HLT_PRESCALE_SET'
+        tables['PS2RE'] = 'HLT_HRE_TO_PS'
+        tables['RE']    = 'HLT_RELEASE'
+        
+        output = ['HPS.HPS_ID']
+        condition = [ "PS2RE.HLTRE2PS_RELEASE_ID = '%s'" % relid,
+                      "PS2RE.HLTRE2PS_PRESCALE_ID = HPS.HPS_ID",
+                      "HPS.HPS_NAME like '%s'" % name]
+        
+        hltk  = executeQuery(cursor, output, condition, schemaname, tables)
+        hltid = (str(hltk[-1])).lstrip('(').rstrip(')').split(',')[0]
+        print 'HLT PS gotten ', hltid
+
+        keys = [int(smid), int(l1id), int(hltid)]
+
+        #Check the PSkey returned matches the SMK
+        tables = {}
+        tables['HPS']   = 'HLT_PRESCALE_SET'
+        tables['TM2PS'] = 'HLT_TM_TO_PS'
+        tables['HTM']  = 'HLT_TRIGGER_MENU'
+        tables['HMT']    = 'HLT_MASTER_TABLE'
+        tables['SM']    = 'SUPER_MASTER_TABLE'
+        
+        output = ['SM.SMT_ID']
+        condition = [ "HPS.HPS_ID = '%s'" % hltid,
+                      "TM2PS.HTM2PS_PRESCALE_SET_ID = '%s'" % hltid,
+                      "TM2PS.HTM2PS_TRIGGER_MENU_ID = HTM.HTM_ID",
+                      "HTM.HTM_ID = HMT.HMT_TRIGGER_MENU_ID",
+                      "HMT.HMT_ID = SM.SMT_ID"]
+        
+        hltchk  = executeQuery(cursor, output, condition, schemaname, tables)
+        smk_chk = (str(hltchk[-1])).lstrip('(').rstrip(')').split(',')[0]
+        if smk_chk != smid:
+            log.fatal("SMK returned by release, SMK '%s', does not match the one returned by L1PS key, SMK '%s' " %(smid,smk_chk) )
+
+            
+    else:
+        keys = [int(smid), int(l1id)]
+        
+    return keys
+
+def getChainsAndStreams(connection, smk):
+    l2, ef = getChains(connection, smk)
+    strm = getStreams(connection, smk)
+    return l2, ef, strm
+
+
+def getChains(connection, smk):
+    cursor,schemaname = getTriggerDBCursor(connection)
+        
+    output = ['TC.HTC_ID', 'TC.HTC_CHAIN_COUNTER', 'TC.HTC_NAME', 'TC.HTC_L2_OR_EF']
+    
+    tables = {}
+    tables['SM']    = 'SUPER_MASTER_TABLE'
+    tables['M2C']   = 'HLT_TM_TO_TC'
+    tables['TC']    = 'HLT_TRIGGER_CHAIN'
+    tables['MT']    = 'HLT_MASTER_TABLE'
+
+    condition = [ "SM.SMT_ID = :smk",
+                  'SM.SMT_HLT_MASTER_TABLE_ID = MT.HMT_ID',
+                  'MT.HMT_TRIGGER_MENU_ID = M2C.HTM2TC_TRIGGER_MENU_ID',
+                  'M2C.HTM2TC_TRIGGER_CHAIN_ID = TC.HTC_ID' ]
+    
+    bindvars = { "smk": smk }
+    
+    res = executeQuery(cursor, output, condition, schemaname, tables, bindvars)
+    
+    chainsl2 = {}
+    chainsef = {}
+    for x in res:
+        if x[3]=='L2': chainsl2[x[1]] = x[2]
+        else: chainsef[x[1]] = x[2]
+
+    return chainsl2, chainsef
+
+def getStreams(connection, smk):
+    cursor,schemaname = getTriggerDBCursor(connection)
+        
+    # now the streams
+    output = ['TS.HTR_NAME']
+    tables = {}
+    tables['SM']    = 'SUPER_MASTER_TABLE'
+    tables['M2C']   = 'HLT_TM_TO_TC'
+    tables['TC']    = 'HLT_TRIGGER_CHAIN'
+    tables['MT']    = 'HLT_MASTER_TABLE'
+    tables['TS']    = 'HLT_TRIGGER_STREAM'
+    tables['C2S']   = 'HLT_TC_TO_TR'
+
+
+    condition = [ "SM.SMT_ID = :smk",
+                  'SM.SMT_HLT_MASTER_TABLE_ID = MT.HMT_ID',
+                  'MT.HMT_TRIGGER_MENU_ID = M2C.HTM2TC_TRIGGER_MENU_ID',
+                  'M2C.HTM2TC_TRIGGER_CHAIN_ID = C2S.HTC2TR_TRIGGER_CHAIN_ID',
+                  'C2S.HTC2TR_TRIGGER_STREAM_ID = TS.HTR_ID' ]
+
+    bindvars = { "smk": smk }
+    
+    res = executeQuery(cursor, output, condition, schemaname, tables, bindvars)
+    streams = [x[0] for x in res]
+
+
+    return streams
+
+
+def getL1Prescales(connection, l1prescalekey): 
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+    
+    cursor,schemaname = getTriggerDBCursor(connection) 
+
+    tables = { 'L' : 'L1_PRESCALE_SET' } 
+
+    output = ['L.L1PS_NAME'] + ['L.L1PS_VAL%i' % i for i in xrange(1,257)] 
+
+    condition = [ "L.L1PS_ID = '%i'" % l1prescalekey ] 
+
+    res = executeQuery(cursor, output, condition, schemaname, tables) 
+
+    name,prescales = res[0][0], res[0][1:257]
+
+    return (name,prescales)
+
+
+def queryHLTPrescaleTable(connection,psk):
+    """returns content of prescale set table and prescale table for a
+    given HLT prescale key
+    @connection - connection string, e.g. TRIGGERDB
+    @psk - HLT prescale key
+
+    @return (ps name, [('L2/EF/express',chainId,prescale,pass-through),...])
+    In case of 'express', the express stream prescale is returned in the position of the pass-through
+    """
+
+    cursor,schemaname = getTriggerDBCursor(connection)
+
+    tables = { 'S' : 'HLT_PRESCALE_SET'
+               }
+    output = [ 'S.HPS_NAME' ]
+
+    condition = [
+        "S.HPS_ID = '%i'" % psk
+        ]
+
+    res = executeQuery(cursor, output, condition, schemaname, tables) 
+
+    name = res[0][0]
+
+    tables = { 'PS': 'HLT_PRESCALE'
+               }
+    output = ['PS.HPR_L2_OR_EF', 'PS.HPR_CHAIN_COUNTER', 'PS.HPR_PRESCALE', 'PS.HPR_PASS_THROUGH_RATE']
+
+    condition = [
+        "PS.HPR_PRESCALE_SET_ID = '%i'" % psk
+        ]
+
+    res = executeQuery(cursor, output, condition, schemaname, tables) 
+
+    return name, res
+
+
+def getHLTPrescales(connection,psk):
+    """returns set name, prescale and passthrough values for a
+    given HLT prescale key
+    @connection - connection string, e.g. TRIGGERDB
+    @psk - HLT prescale key
+
+    @return (ps name, [('L2/EF',chainId,prescale,pass-through),...])
+    """
+
+    name, res = queryHLTPrescaleTable(connection,psk)
+
+    return name, [r for r in res if r[0]!='express']
+
+
+def getExpressStreamPrescales(connection,psk):
+    """returns the express stream prescales for a
+    given HLT prescale key
+    @connection - connection string, e.g. TRIGGERDB
+    @psk - HLT prescale key
+
+    @return (ps name, [chainId,prescale),...])
+    """
+    
+    name, res = queryHLTPrescaleTable(connection,psk)
+
+    return name, [(r[1],r[3]) for r in res if r[0]=='express']
+
+
+def test():
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+    log.setLevel(logging.DEBUG)
+
+    ### oracle
+    print """####################################
+##
+##   Testing ORACLE
+##
+####################################"""
+    l2, ef = getChains("TRIGGERDBREPR", 539)
+    strm_oracle = getStreams("TRIGGERDBREPR", 539)
+    print "\nList of Streams in SMK 539",strm_oracle,"\n"
+
+    ### frontier
+    print """####################################
+##
+##   Testing FRONTIER
+##
+####################################"""
+    from TriggerJobOpts.TriggerFlags import TriggerFlags as tf
+    tf.triggerUseFrontier = True
+    strm_frontier = getStreams("TRIGGERDBREPR", 539)
+    print "\nList of Streams in SMK 539",strm_frontier,"\n"
+
+    if strm_oracle == strm_frontier:
+        print """####################################
+##
+##   ORACLE and FRONTIER give IDENTICAL results
+##
+####################################"""
+    else:
+        print """####################################
+##
+##   ERROR: ORACLE and FRONTIER give DIFFERENT results
+##
+####################################"""
+    
+
+
+#if __name__ == "__main__":
+#    print "Prescales and pass-throughs for PSK 7417\n",getHLTPrescales("TRIGGERDB",7417)
+#    print "Express stream prescales for PSK 7417\n",getExpressStreamPrescales("TRIGGERDB",7417)
+
+if __name__=="__main__":
+    import sys
+    sys.exit(test())
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigLVL1configExtented.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigLVL1configExtented.py
new file mode 100755
index 0000000000000000000000000000000000000000..2e126a8ba58a1a0c31596abd85c27a8d87870837
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TrigLVL1configExtented.py
@@ -0,0 +1,21 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+#import TrigConfigSvc.TriggerPythonConfig
+
+
+def extendLVL1config(triggerPythonConfig):
+    triggerPythonConfig.CTPInfo().setBunchGroupSet("MC")
+    triggerPythonConfig.CTPInfo().addBunchGroup( 'BCRVeto',           0, [1] )
+    triggerPythonConfig.CTPInfo().addBunchGroup( 'Filled',            1, [1] )
+    triggerPythonConfig.CTPInfo().addBunchGroup( 'EmptyCalib',        2, [] )
+    triggerPythonConfig.CTPInfo().addBunchGroup( 'Empty',             3, [] )
+    triggerPythonConfig.CTPInfo().addBunchGroup( 'UnpairedBeam1',     4, [] )
+    triggerPythonConfig.CTPInfo().addBunchGroup( 'UnpairedBeam2',     5, [] )
+    triggerPythonConfig.CTPInfo().addBunchGroup( 'EmptyAfterFilled',  6, [] )
+    triggerPythonConfig.CTPInfo().addBunchGroup( 'InTrain',           7, [1] )
+    triggerPythonConfig.CTPInfo().setDeadtime('Commissioning', 4, 0, 0, 0, 0)
+    triggerPythonConfig.CTPInfo().setRandom('rand01', 5, 0, 1, 1)
+    triggerPythonConfig.CTPInfo().setPrescaledClock('psc01', 10, 100)
+    triggerPythonConfig.Lvl1CaloInfo().setName('standard')
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerConfig.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..2c760097da7cab2122a75a2cfbe53232ed737d97
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerConfig.py
@@ -0,0 +1,268 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+
+## @file TriggerConfig.py
+## @brief Core job python configurable to setup the trigger configuration source
+## @author Till Eifert <eifert@cern.ch>
+## @author Joerg Stelzer <stelzer@cern.ch>
+## $Id: TriggerConfig.py,v 1.4 2008-03-10 13:03:47 stelzer Exp $
+
+###############################################################
+#
+# The jobOptions to enable reading and writing of configuration
+# data from COOL into AOD
+#
+#
+#==============================================================
+
+
+
+# Required libs:
+import os.path
+
+## all we need is the standard job to
+import AthenaCommon.AtlasUnixStandardJob
+from AthenaCommon.AppMgr import theApp
+
+## the environment for this module
+from AthenaCommon.JobProperties import jobproperties as jp
+import RecExConfig.RecFlags
+import TriggerJobOpts.TriggerFlags
+
+from AthenaCommon.Logging import logging as log
+ 
+def _setupConfig():
+    rf = {}
+    rf['readTAG'] = jp.Rec.readTAG()
+    rf['readESD'] = jp.Rec.readESD()
+    rf['readAOD'] = jp.Rec.readAOD()
+    rf['readBS']  = jp.Rec.Trigger.readBS()
+    rf['readRDO'] = jp.Rec.readRDO()
+    rf['DataSource'] = jp.Global.DataSource()
+    rf['readRDO'] = jp.Rec.readRDO()
+    rf['doWriteESD'] = jp.Rec.doWriteESD()
+    rf['doWriteAOD'] = jp.Rec.doWriteAOD()
+    rf['doWriteTAG'] = jp.Rec.doWriteTAG()
+    rf['TrigCoolSQLite'] = False
+
+    global readRDO
+    print "global readRDO=", readRDO
+    varInit = globals().keys()
+    print varInit
+    print rf.keys()
+    for o in [o for o in rf.keys() if o in varInit]:
+        rf[o] = eval(o)
+
+    #print "JJJJ DEBUG Print jobproperties"
+    #jp.print_JobProperties('tree&value')
+    #print "JJJJ DEBUG Print rec.jobproperties"
+    #jp.Rec.print_JobProperties('tree&value')
+    #print "JJJJ DEBUG Print rec.Trigger.jobproperties aka TriggerFlags"
+    #jp.Rec.Trigger.print_JobProperties('tree&value')
+
+    ## logging for this module
+    msg = log.getLogger( 'TriggerConfig.py' )
+
+    ## the generic trigger configuration service needs to be set up
+    from TrigConfigSvc.TrigConfigSvcConfig import SetupTrigConfigSvc
+    msg.info('Creating the trigger configuration service wrapper')
+    svc = SetupTrigConfigSvc()
+
+    ## ================================================================================
+    ## the service depends on the condition we are running in 
+    ##
+    ##     environment       ConfigSvc      Data input   Config input   Flags
+    ##     ---------------   ------------   ----------   ------------   -----
+    ## (1) data taking       HLTConfigSvc   BS           TriggerDB      DataSource='data',...
+    ##     
+    ## (2) MC simulation     HTLConfigSvc   BS, RDO      XML            DataSource='geant3/4' and (readBS=True or readRDO=True) and doFEX=True and doHypo=True
+    ##                       (to be replaced by DSConfigSvc later)
+    ##
+    ## (3) data processing   DSConfigSvc    BS, RDO      COOL/Oracle    readBS=True or readRDO=True
+    ##     
+    ## (4) AOD processing    DSConfigSvc    ESD/AOD      ESD/AOD(run)   (readESD=True or readAOD=True) and doFEX=False and doHypo=False
+    ##                       AODConfigSvc                ESD/AOD(ev)
+    ##     
+    ## (5) Trigger ESD/AOD   HLTConfigSvc   ESD/AOD      XML            (readESD or readAOD)=True and doFEX=True and doHypo=True
+    ##     
+    ## (6) Trigger rerun     HLTConfigSvc   ESD/AOD      XML            (readBS or readRDO or readESD or readAOD)=True and doFEX=False and doHypo=True
+    ##     
+    ## (7) TAG reading       HLTConfigSvc   TAG          XML            readTAG=True
+    ##     
+    ##
+    ## ================================================================================
+    ## In cases (2), (3) and (5) the configuration information needs to be written
+    ## into the header of the AOD file. This is completely independent of the configuration
+    ## service, but will depend on the flags readESD, readAOD, doWriteESD, doWriteAOD, doWriteTAG
+    ##
+    ## ================================================================================
+    ## two flags are steering the execution of the trigger, if neither
+    ## is True, no trigger is used
+    ##
+    ## - doTrigger: if True, "TriggerRelease/jobOfragment_forRecExCommon.py"
+    ## is included
+    ##
+    ## - doTriggerConfigOnly: if True, no TrigDecision is build/used
+    ##
+    ## ================================================================================
+    ## flags that control the setup of the trigger are
+    ##
+    ## boolean:
+    ## readBS,  readAOD,    readESD,    readRDO,    readTAG
+    ## writeBS, doWriteAOD, doWriteESD, doWriteRDO, doWriteTAG
+    ## readLVL1configFromXML, readHLTconfigFromXML
+    ##
+    ## string:
+    ## inputHLTconfigFile, inputLVL1configFile, outputHLTconfigFile, outputLVL1configFile
+    ##
+    ## on/offline:
+    ## DataSource: ['data','geant3','geant4']
+    ## ================================================================================
+
+    svc.hltXmlFile = lv1_menu_file_name = jp.Rec.Trigger.inputHLTconfigFile()
+    svc.l1XmlFile  = jp.Rec.Trigger.inputLVL1configFile()
+
+    myList = []
+    scenario = 0;
+    if len( jp.Rec.Trigger.configurationSourceList() ) > 0:
+        # take the user-defined list of trigger configuration sources:
+        myList = jp.Rec.Trigger.configurationSourceList()
+
+    else:
+        print jp.Rec
+        if rf['readTAG']:  # TAG
+            myList = ['xml']
+            
+        elif rf['readESD'] or rf['readAOD']:  # AOD/ESD
+            myList = ['ds','aod','xml']
+            
+        elif rf['readBS'] or rf['readRDO']: # RDO/BS
+            if rf['DataSource'] == 'data':
+                myList = ['ds','xml']
+            else:
+                myList = ['xml']
+
+        else:
+            msg.fatal('no reading of BS, RDO, AOD, ESD, or TAG specified')
+
+    message = 'setup the following services in order: ';
+    for s in myList: message += s + " "
+    msg.info(message)
+
+    try:
+        svc.SetStates( myList )
+    except:
+        msg.error( 'failed to set state of TrigConfigSvc ...')
+
+    try:
+        svc.InitialiseSvc()
+    except:
+        msg.error( 'failed to activate TrigConfigSvc ...')
+
+
+    if rf['doWriteESD'] or rf['doWriteAOD'] or rf['doWriteTAG'] or ('ds' in myList):
+
+        ## setup the copying of configuration data from input to output metadatastore
+        if rf['doWriteESD'] or rf['doWriteAOD'] or rf['doWriteTAG']:
+            msg.info( 'writing of ESD, AOD, or TAG requested, will setup IOVDbSvc to access configuration meta data')
+        else:
+            msg.info( 'DSConfigSvc enabled, will setup IOVDbSvc to access configuration meta data')
+
+        # first we need a new algorithm that triggers the copying
+        from AthenaCommon.AlgSequence import AlgSequence
+        from TrigConfigSvc.TrigConfigSvcConf import TrigConf__TrigConfDataIOVChanger as TrigConfDataIOVChanger
+        topAlgs = AlgSequence()
+        TrigConfDataIOVChanger = TrigConfDataIOVChanger('TrigConfDataIOVChanger')
+        topAlgs += TrigConfDataIOVChanger
+
+            
+        from AthenaCommon.AppMgr  import ServiceMgr as svcMgr
+        from AthenaCommon.AppMgr import ToolSvc
+
+        if not hasattr( ToolSvc, 'IOVDbMetaDataTool' ):
+            from IOVDbMetaDataTools.IOVDbMetaDataToolsConf import IOVDbMetaDataTool
+            ToolSvc += IOVDbMetaDataTool( "IOVDbMetaDataTool" )
+
+        
+        if not hasattr( svcMgr, 'MetaDataSvc' ):
+            from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import MetaDataSvc
+            svcMgr += MetaDataSvc( "MetaDataSvc" )
+            svcMgr.MetaDataSvc.MetaDataContainer = "MetaDataHdr"
+            svcMgr.MetaDataSvc.MetaDataTools += [ "IOVDbMetaDataTool" ]
+
+        # for debugging uncomment the following three lines
+        from AthenaCommon.Constants import VERBOSE
+        ToolSvc.IOVDbMetaDataTool.OutputLevel = VERBOSE
+        svcMgr.MetaDataSvc.OutputLevel = VERBOSE
+
+        dbConnection = "<dbConnection>impl=cool;techno=oracle;schema=ATLAS_COOLONL_READER;devdb10:COOLTEST:atlas_trig_stelzer</dbConnection>"
+
+        
+        ### when moving to configurable IOVDbSvc use the ### lines and remove those with ## at the end
+        ### import IOVDbSvc.IOVDb    
+        ### IOVDbSvc = svcMgr.IOVDbSvc
+        from AthenaCommon.Include import include      ##
+        include( "IOVDbSvc/IOVDbSvc_jobOptions.py" )  ##
+        IOVDbSvc = theApp.service( "IOVDbSvc" )       ##
+        #from AthenaCommon.Constants import VERBOSE
+        #IOVDbSvc.OutputLevel = VERBOSE
+
+        ## if we process MC from an XML file the dbConnection needs to
+        ## be set to a local SQlite file
+        
+        if (rf['readRDO'] or rf['readBS']) and (rf['DataSource']=='geant3' or rf['DataSource']=='geant4' or rf['TrigCoolSQLite']):
+            from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter
+            dbConnection = theConfCOOLWriter.dbConnection
+            theConfCOOLWriter.isWritingNeeded = True
+            TrigConfDataIOVChanger.AdjustIOV = True
+        
+        msg.info("COOL DBConnection: " + dbConnection )
+
+        ### svcMgr.IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/HLT/Menu <tag>HEAD</tag>"]
+        ### svcMgr.IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/HLT/HltConfigKeys <tag>HEAD</tag>"]
+        ### svcMgr.IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/LVL1/Lvl1ConfigKey <tag>HEAD</tag>"]
+        ### svcMgr.IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/LVL1/Menu <tag>HEAD</tag>"]
+        ### svcMgr.IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/LVL1/Prescales <tag>HEAD</tag>"]
+        ### svcMgr.IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/LVL1/ItemDef <tag>HEAD</tag>"]
+        ### svcMgr.IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/HLT/Prescales <tag>HEAD</tag>"]
+        ### svcMgr.IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/HLT/PrescaleKey <tag>HEAD</tag>"]
+
+        IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/HLT/Menu <tag>HEAD</tag>"]           ##
+        IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/HLT/HltConfigKeys <tag>HEAD</tag>"]  ##
+        IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/LVL1/Lvl1ConfigKey <tag>HEAD</tag>"] ##
+        IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/LVL1/Menu <tag>HEAD</tag>"]          ##
+        IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/LVL1/Prescales <tag>HEAD</tag>"]     ##
+        IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/LVL1/ItemDef <tag>HEAD</tag>"]       ##
+        IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/HLT/Prescales <tag>HEAD</tag>"]      ##
+        IOVDbSvc.Folders+=[dbConnection + "/TRIGGER/HLT/PrescaleKey <tag>HEAD</tag>"]    ##
+
+        
+        # only in jobs that write AOD or ESD
+        if rf['doWriteAOD'] or rf['doWriteESD']:
+            msg.info( 'writing of ESD or AOD enabled, will setup IOVDbSvc to write configuration meta data')
+            ### svcMgr.IOVDbSvc.FoldersToMetaData+=["/TRIGGER/HLT/Menu"]
+            ### svcMgr.IOVDbSvc.FoldersToMetaData+=["/TRIGGER/HLT/HltConfigKeys"]
+            ### svcMgr.IOVDbSvc.FoldersToMetaData+=["/TRIGGER/LVL1/Lvl1ConfigKey"]
+            ### svcMgr.IOVDbSvc.FoldersToMetaData+=["/TRIGGER/LVL1/Menu"]
+            ### svcMgr.IOVDbSvc.FoldersToMetaData+=["/TRIGGER/LVL1/Prescales"]
+            ### svcMgr.IOVDbSvc.FoldersToMetaData+=["/TRIGGER/LVL1/ItemDef"]
+            ### svcMgr.IOVDbSvc.FoldersToMetaData+=["/TRIGGER/HLT/Prescales"]
+            ### svcMgr.IOVDbSvc.FoldersToMetaData+=["/TRIGGER/HLT/PrescaleKey"]
+
+            IOVDbSvc.FoldersToMetaData+=["/TRIGGER/HLT/Menu"]           ##
+            IOVDbSvc.FoldersToMetaData+=["/TRIGGER/HLT/HltConfigKeys"]  ##
+            IOVDbSvc.FoldersToMetaData+=["/TRIGGER/LVL1/Lvl1ConfigKey"] ##
+            IOVDbSvc.FoldersToMetaData+=["/TRIGGER/LVL1/Menu"]          ##
+            IOVDbSvc.FoldersToMetaData+=["/TRIGGER/LVL1/Prescales"]     ##
+            IOVDbSvc.FoldersToMetaData+=["/TRIGGER/LVL1/ItemDef"]       ##
+            IOVDbSvc.FoldersToMetaData+=["/TRIGGER/HLT/Prescales"]      ##
+            IOVDbSvc.FoldersToMetaData+=["/TRIGGER/HLT/PrescaleKey"]    ##
+
+
+## load basic services configuration at module import
+_setupConfig()
+
+## clean-up: avoid running multiple times this method
+del _setupConfig
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerConfigARA.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerConfigARA.py
new file mode 100644
index 0000000000000000000000000000000000000000..33a1681d893c17c02ee81bce37cae3c034a5b451
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerConfigARA.py
@@ -0,0 +1,482 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+## @file TriggerConfig.py
+## @brief Configuration object to be used in python ARA
+## @author Joerg Stelzer <stelzer@cern.ch>
+## $Id: TriggerConfigARA.py,v 1.12 2009-03-11 15:13:27 stelzer Exp $
+
+import sys
+import copy
+import ROOT
+import PyCintex
+from PyCool import coral
+import AthenaROOTAccess.transientTree
+
+def _iter(self) :
+    sequential = self.begin()
+    end        = self.end()
+    while sequential != end :
+        yield sequential.__deref__()
+        sequential.__preinc__()
+    raise StopIteration
+
+def _chPrint(self):
+    s  = "%s (%s %i), ps %g   [streams: " % (self.chain_name(), self.level(), self.chain_counter(), self.prescale())
+    if len(self.streamTagList())>0:
+        for stag in self.streamTagList():
+            s += stag.stream() + "|"
+        s = s.rstrip('|')
+    else:
+        s += "-"
+    s+=']'
+    return s
+
+def _elemFilter(elem):
+    if elem.key().startswith('/TRIGGER/'):
+        return elem
+    return None
+
+
+class _TrigConfHolder:
+    """helper class to hold all configuration data in one place"""
+    def __init__(self):
+        self.SMK = -1
+        self.HltPSK = -1
+        self.L1PSK = -1
+        self.L1PS = []
+        self.L1Items = {}
+        self.HLTChains = {}
+        self.ConfigSrc = ""
+
+    def __str__(self):
+        s =  "SMK: %i, HLTpsk: %i, L1psk: %i\n" % (self.SMK, self.HltPSK, self.L1PSK)
+        s += "Config source: %s\n" % str(self.ConfigSrc)
+        s += "# L1 Items   : %i\n" % len(self.L1Items)
+        s += "# HLT Chains : %i" % len(self.HLTChains)
+        return s
+
+
+class TriggerConfigARA(object):
+    """class which the user should instantiate to get access to the trigger configuration in PyROOT"""
+
+    __cnv = ROOT.TrigConf.TrigConfigARA()
+    __keysInUpdateOrder = ['L1K','HLTK','HLTPSK','L1M','HLTM','L1PS']
+    __folderName = {
+        "L1M"    : "_TRIGGER_LVL1_Menu",
+        "HLTM"   : "_TRIGGER_HLT_Menu",
+        "L1K"    : "_TRIGGER_LVL1_Lvl1ConfigKey",
+        "HLTK"   : "_TRIGGER_HLT_HltConfigKeys",
+        "HLTPSK" : "_TRIGGER_HLT_PrescaleKey",
+        "L1PS"   : "_TRIGGER_LVL1_Prescales"
+        }
+
+
+    def __init__(self, poolfile, **args):
+        """An AOD file pointer (not a string) must be given as argument"""
+
+        self.__dict__.__setitem__("_TriggerConfigARA__curConf", _TrigConfHolder())
+        self.__currentIOV = {}
+        self.verbose = False
+        if 'verbose' in args: self.verbose = args['verbose']
+
+        plcClass = PyCintex.makeClass("IOVPayloadContainer")
+        plcClass.iter  = _iter
+
+        tiClass = PyCintex.makeClass("TrigConf::TriggerItem")
+        tiClass.__str__  = lambda x: "%s (ctpid %i), ps %g" % (x.name(), x.ctpId(), x.ps)
+
+        chClass = PyCintex.makeClass("TrigConf::HLTChain")
+        chClass.__str__  = _chPrint
+
+        ROOT.IOVTime.__str__ = lambda x: "%i/%i" % (x.run(),x.event())
+        ROOT.IOVTime.__lt__ = lambda s,o: s.run()<o.run() or s.run()==o.run() and s.event()<o.event()
+        ROOT.IOVTime.__eq__ = lambda s,o: s.run()==o.run() and s.event()==o.event()
+        ROOT.IOVTime.__le__ = lambda s,o: s<o or s==o
+        ROOT.IOVRange.__str__ = lambda x: "%s - %s" % (x.start(),x.stop())
+        ROOT.IOVRange.isInRange = lambda x,e: x.start()<=e and e<x.stop()
+        
+        print "Opening file(s) and creating transient metadata ..."
+        if type(poolfile) == list:
+            self._collection = ROOT.AthenaROOTAccess.TChainROOTAccess('MetaData')
+            for file in poolfile:
+                self._collection.Add(file)
+            self.mdt = AthenaROOTAccess.transientTree.makeTree(self._collection,
+                                                               persTreeName = 'MetaData',
+                                                               dhTreeName = 'MetaDataHdr',
+                                                               dhfilt = _elemFilter )
+        else:
+            treeNames = [k.GetName() for k in poolfile.GetListOfKeys()]
+            if "MetaDataHdrDataHeader" in treeNames:
+                dhTreeName = 'MetaDataHdrDataHeader' # old style
+            else:
+                dhTreeName = 'MetaDataHdr'
+            self.mdt = AthenaROOTAccess.transientTree.makeTree(poolfile,
+                                                               persTreeName = 'MetaData',
+                                                               dhTreeName = dhTreeName,
+                                                               dhfilt = _elemFilter )
+
+        for key in self.__class__.__keysInUpdateOrder:
+            if not hasattr(self.mdt,self.__class__.__folderName[key]):
+                print "No key %s in file %s, use checkFile.py to verify" % (self.__class__.__folderName[key],poolfile)
+                sys.exit(0)
+
+
+
+
+
+    def printfnc(self,chaindetails=False):
+        print self
+        if not chaindetails: return
+        for ef in self.HLTChains.values():
+            if ef.level()!='EF': continue
+            if ef.prescale()<0: continue;
+            fc = self.printFullChain(ef.chain_name())
+
+    def printFullChain(self, name):
+        fc = self.getFullChain(name)
+        efstr = "-"
+        l2str = "-"
+        l1str = "-"
+        ststr = ""
+        if fc[2]:
+            efstr = "%s (%1.2f)" % (fc[2].chain_name(), fc[2].prescale())
+            if len(fc[2].streamTagList())>0:
+                for stag in fc[2].streamTagList():
+                    ststr += stag.stream() + "|"
+                ststr = ststr.rstrip('|')
+            else:
+                ststr += "-"
+            ststr+=']'
+        if fc[1]: l2str = "%s (%1.2f)" % (fc[1].chain_name(), fc[1].prescale())
+        if fc[0]:
+            l1str = ""
+            if type(fc[0]) == type([]):
+                for i in fc[0]:
+                    l1str += "%s (%i) " % (i.name(), self.L1PS[i.ctpId()])
+            else:
+                l1str = "%s (%i)"    % (fc[0].name(), self.L1PS[fc[0].ctpId()])
+        print "EF: %s, L2: %s, L1: %s [streams: %s" % (efstr, l2str, l1str, ststr )
+        
+
+    def __str__(self):
+        s =  "SMK: %i, HLTpsk: %i, L1psk: %i\n" % (self.SMK, self.HltPSK, self.L1PSK)
+        s += "Config source: %s\n" % str(self.ConfigSrc)
+        s += "L1 Items   : %i\n" % len(self.L1Items)
+        s += "HLT Chains : %i" % len(self.HLTChains)
+        return s
+
+    def __getattr__(self, key):
+        """Forwards getting of unknown attributes to the configuration holder"""
+        if key in self.__dict__["_TriggerConfigARA__curConf"].__dict__:
+            return self.__dict__["_TriggerConfigARA__curConf"].__dict__.__getitem__(key)
+        raise AttributeError, "No configuration parameter %s" % key
+
+    def __setattr__(self, key, val):
+        """Forwards setting of unknown attributes to the configuration holder"""
+        if key in self.__dict__["_TriggerConfigARA__curConf"].__dict__:
+            self.__dict__["_TriggerConfigARA__curConf"].__dict__.__setitem__(key,val)
+        else:
+            self.__dict__.__setitem__(key, val)
+
+    def printFileSummary(self, chaindetails=False):
+        br = self.mdt.GetBranch(self.__class__.__folderName['HLTK'])
+        iovs = []
+        for i in xrange(self.mdt.GetEntries()):
+            br.GetEntry(i)
+            metaData = getattr(self.mdt, br.GetName())
+            plc = metaData.payloadContainer()
+            for payload in plc.iter():
+                for j in xrange(payload.size()):
+                    chanNum = int(payload.chanNum(j))
+                    iovr = payload.iovRange(chanNum)
+                    iovs += [iovr]
+
+        print "-----------------------------------------------------------------------"
+        for iov in iovs:
+            end = iov.stop().event()-1
+            if end==-1: end="MAX"
+            else: end="%3i" % end
+            print "Run: %6i  LBs: %3i - %s" % (iov.start().run(),iov.start().event(),end)
+            print "---------------------------"
+            currentEvent = ROOT.IOVTime(iov.start().run(), iov.start().event())
+            for key in self.__class__.__keysInUpdateOrder:
+                success = self.__loadData(key, currentEvent)
+            self.printfnc(chaindetails)
+            print "-----------------------------------------------------------------------"
+        self.__dict__.__setitem__("_TriggerConfigARA__curConf", _TrigConfHolder())
+        self.__currentIOV = {}
+
+    def update(self, run, lb):
+        """This is the function the user must call to trigger reloading of meta-data from the Tree.
+        Data is only reloaded if the IOV goes out of range. The valid IOVs are kept for each folder individually"""
+        updated = False
+        overallsucc = True
+        currentEvent = ROOT.IOVTime(run, lb)
+        # check if all the currently loaded folders are still covering the current run/lb
+        for key in self.__class__.__keysInUpdateOrder:
+            if (key in self.__currentIOV) and self.__currentIOV[key] and self.__currentIOV[key].isInRange(currentEvent):
+                continue
+            success = self.__loadData(key, currentEvent)
+            if not success:
+                overallsucc = False
+                print "Did not find valid IOV for %s" % self.__class__.__folderName[key]
+            updated = True
+        if updated:
+            if overallsucc:
+                print "Loaded new trigger configuration for run/lb = %i/%i" % (run,lb)
+            else:
+                print "ERROR: Loading of new trigger configuration for run/lb = %i/%i failed" % (run,lb)
+        if self.verbose:
+            print self
+        return updated
+
+    def isConfigured(self, name):
+        if name in self.L1Items: return True
+        if name in self.HLTChains: return True
+        return False
+
+    def getConfiguredChainNames(self):
+        nameList = []
+        nameList += self.L1Items.keys()
+        nameList += self.HLTChains.keys()
+        return nameList
+
+    def getFullChain(self, name):
+        if not self.isConfigured(name): return None
+
+        fullchain = [None,None,None] # L1,L2,EF
+
+        if name in self.L1Items:
+            fullchain[0] = self.L1Items[name]
+            return fullchain
+
+        hltchain = self.HLTChains[name]
+        if hltchain.level()=='EF':
+            fullchain[2] = hltchain
+            l2name = hltchain.lower_chain_name()
+            if l2name!="":
+                if not self.isConfigured(l2name):
+                    raise RuntimeError, "Lower chain %s as seed of %s not configured" % (l2name,name)
+                fullchain[1] = self.HLTChains[l2name]
+        else:
+            fullchain[1] = hltchain
+
+        if fullchain[1]:
+            l2name = fullchain[1].chain_name()
+            l1name = fullchain[1].lower_chain_name()
+            if l1name=="":
+                pass
+            elif ',' in l1name: # multiseeded L2 chain
+                fullchain[0] = []
+                itemlist = l1name.replace(' ','').split(',')
+                for item in itemlist:
+                    if not self.isConfigured(item):
+                        raise RuntimeError, "L1 item %s as seed of %s not configured" % (str(item),l2name)
+                    fullchain[0].append(self.L1Items[item])
+            else:
+                if not self.isConfigured(l1name):
+                    raise RuntimeError, "L1 item %s as seed of %s not configured" % (str(l1name),l2name)
+                fullchain[0] = self.L1Items[l1name]
+
+        return fullchain
+
+
+    def getFullChainPrescaleFactor(self, name):
+        if not self.isConfigured(name): return 0
+        # if name is a L1Item
+        if name in self.L1Items:
+            return self.L1PS[self.L1Items[lowname].ctpId()]
+
+        hltchain = self.HLTChains[name]
+        prescale = hltchain.prescale()
+        lowname  = hltchain.lower_chain_name()
+        if lowname=="": return prescale # unseeded
+        if not self.isConfigured(lowname):
+            raise RuntimeError, "Lower chain %s of %s not configured" % (lowname,name)
+
+        if hltchain.level()=='EF':
+            hltchain = self.HLTChains[lowname]
+            prescale *= hltchain.prescale()
+            lowname  = hltchain.lower_chain_name()
+            if lowname=="": return prescale # unseeded
+            if not self.isConfigured(lowname):
+                raise RuntimeError, "Lower item %s of %s not configured" % (lowname,name)
+
+        # hltchain should be of L2
+        prescale *= self.L1PS[self.L1Items[lowname].ctpId()]
+        return prescale
+
+    def getL1Items(self):
+        return self.L1Items
+
+    def getHLTChains(self):
+        return self.HLTChains
+
+    def getConfigKeys(self):
+        return (self.SMK, self.L1PSK, self.HltPSK)
+
+    def __loadData(self, key, currentEvent):
+        br = self.mdt.GetBranch(self.__class__.__folderName[key])
+        validIOV = getattr(self,"_load%s" % key)(br, currentEvent)
+        if self.verbose:
+            print "Loaded %s with iov %s" % (key, validIOV)
+        self.__currentIOV[key] = validIOV
+        return validIOV != None
+
+    def _loadHLTK(self, br, currentEvent):
+        validIOV = None
+        self.SMK = -1
+        self.HltPSK = -1
+        self.ConfigSrc = ""
+        for i in xrange(self.mdt.GetEntries()):
+            br.GetEntry(i)
+            metaData = getattr(self.mdt, br.GetName())
+            plc = metaData.payloadContainer()
+            for payload in plc.iter():
+                #payload.dump()
+                for i in xrange(payload.size()):
+                    chanNum = int(payload.chanNum(i))
+                    # first check the iov
+                    iovr = payload.iovRange(chanNum)
+                    if not iovr.isInRange(currentEvent): continue
+                    if not validIOV: validIOV = ROOT.IOVRange(iovr)
+                    al = payload.attributeList(chanNum)
+                    smk = ROOT.Long(0)
+                    hltpsk = ROOT.Long(0)
+                    configsrc = ROOT.std.string("")
+                    self.__class__.__cnv.readHltConfigKeysARA(al,smk,hltpsk,configsrc)
+                    self.SMK = smk
+                    self.HltPSK = hltpsk
+                    self.ConfigSrc = configsrc
+        return validIOV
+
+
+    def _loadHLTPSK(self, br, currentEvent):
+        validIOV = None
+        self.HltPSK = -1
+        for i in xrange(self.mdt.GetEntries()):
+            br.GetEntry(i)
+            metaData = getattr(self.mdt, br.GetName())
+            plc = metaData.payloadContainer()
+            for payload in plc.iter():
+                #payload.dump()
+                for i in xrange(payload.size()):
+                    chanNum = int(payload.chanNum(i))
+                    # first check the iov
+                    iovr = payload.iovRange(chanNum)
+                    if not iovr.isInRange(currentEvent): continue
+                    if not validIOV: validIOV = ROOT.IOVRange(iovr)
+                    al = payload.attributeList(chanNum)
+                    hltpsk = ROOT.Long(0)
+                    self.HltPSK = self.__class__.__cnv.readHltPrescaleKeyARA(al,hltpsk)
+                    self.HltPSK = hltpsk
+        return validIOV
+
+
+
+    def _loadL1K(self, br, currentEvent):
+        foundAnyIOV = False
+        self.L1PSK = -1
+        payloadList = []
+        for i in xrange(self.mdt.GetEntries()):
+            br.GetEntry(i)
+            metaData = getattr(self.mdt, br.GetName())
+            plc = metaData.payloadContainer()
+            for payload in plc.iter():
+                for i in xrange(payload.size()):
+                    chanNum = int(payload.chanNum(i))
+                    iovr = payload.iovRange(chanNum)
+                    payloadList += [[iovr,payload.attributeList(chanNum)]]
+                    foundAnyIOV = True
+        if not foundAnyIOV: return None
+        # sort the payload by IOV and remove the overlap
+        payloadList.sort(lambda x,y: cmp(x[0].start(),y[0].start()))
+        for i in xrange(len(payloadList)-1):
+            payloadList[i][0] = ROOT.IOVRange(payloadList[i][0].start(),payloadList[i+1][0].start())
+        # get the content
+        validIOV =  None
+        for pl in payloadList:
+            if pl[0].isInRange(currentEvent):
+                if not validIOV: validIOV = pl[0]
+                self.L1PSK = pl[1]['Lvl1PrescaleConfigurationKey']
+        return validIOV
+
+
+    def _loadL1PS(self, br, currentEvent):
+        foundAnyIOV = False
+        self.L1PS = 256*[0]
+        payloadList = [[] for x in xrange(256)]
+        for i in xrange(self.mdt.GetEntries()):
+            br.GetEntry(i)
+            metaData = getattr(self.mdt, br.GetName())
+            plc = metaData.payloadContainer()
+            for payload in plc.iter():
+                for i in xrange(payload.size()):
+                    chanNum = int(payload.chanNum(i))
+                    iovr = payload.iovRange(chanNum)
+                    payloadList[chanNum] += [[iovr,payload.attributeList(chanNum)]]
+                    foundAnyIOV = True
+        if not foundAnyIOV: return None
+        # sort the payload by IOV and remove the overlap
+        for ch in xrange(256):
+            x = payloadList[ch]
+            x.sort(lambda x,y: cmp(x[0].start(),y[0].start()))
+            for i in xrange(len(x)-1):
+                x[i][0] = ROOT.IOVRange(x[i][0].start(),x[i+1][0].start())
+        # read the payload
+        psset = 256 * [0]
+        validIOV =  None
+        for ch in xrange(256):
+            for pl in payloadList[ch]:
+                if pl[0].isInRange(currentEvent):
+                    if not validIOV: validIOV = pl[0]
+                    psset[ch] = pl[1]['Lvl1Prescale']
+                    
+        for item in self.L1Items.values():
+            item.ps = psset[item.ctpId()]
+        self.L1PS = psset
+        return validIOV
+
+    def _loadL1M(self, br, currentEvent):
+        validIOV = None
+        items = {}
+        for i in xrange(self.mdt.GetEntries()):
+            br.GetEntry(i)
+            metaData = getattr(self.mdt, br.GetName())
+            plc = metaData.payloadContainer()
+            for payload in plc.iter():
+                #payload.dump()
+                for i in xrange(payload.size()):
+                    chanNum = int(payload.chanNum(i))
+                    # first check the iov
+                    iovr = payload.iovRange(chanNum)
+                    if not iovr.isInRange(currentEvent): continue
+                    if not validIOV: validIOV = ROOT.IOVRange(iovr)
+                    al = payload.attributeList(chanNum)
+                    l1item = self.__class__.__cnv.createLvl1TriggerItemARA(al)
+                    l1item.setCtpId(chanNum)
+                    items[l1item.name()] = l1item
+        self.L1Items = items
+        return validIOV
+
+
+    def _loadHLTM(self, br, currentEvent):
+        validIOV = None
+        chains = {}
+        for i in xrange(self.mdt.GetEntries()):
+            br.GetEntry(i)
+            metaData = getattr(self.mdt, br.GetName())
+            plc = metaData.payloadContainer()
+            for payload in plc.iter():
+                #payload.dump()
+                for i in xrange(payload.size()):
+                    chanNum = int(payload.chanNum(i))
+                    # first check the iov
+                    iovr = payload.iovRange(chanNum)
+                    if not iovr.isInRange(currentEvent): continue
+                    if not validIOV: validIOV = ROOT.IOVRange(iovr)
+                    al = payload.attributeList(chanNum)
+                    chain = self.__class__.__cnv.createHLTChainARA(al)
+                    chains[chain.chain_name()] = chain
+        self.HLTChains = chains
+        return validIOV
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerPythonConfig.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerPythonConfig.py
new file mode 100755
index 0000000000000000000000000000000000000000..8e6e35672438194ba0645074f35b655835590722
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerPythonConfig.py
@@ -0,0 +1,39 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+
+# moved to TriggerMenuPython
+# here only a forward is kept
+
+
+from AthenaCommon.Logging import logging
+msg = logging.getLogger( 'TrigConfigSvc/TriggerPythonConfig.py' )
+
+msg.info('ATTENTION: TriggerPythonConfig.py has been moved from package TrigConfigSvc to package TriggerMenuPython')
+msg.info('           Pleace change your code according to the description in:')
+msg.info('           https://svnweb.cern.ch/trac/atlasoff/browser/Trigger/TrigConfiguration/TrigConfigSvc/trunk/python/TriggerPythonConfig.py')
+
+from TriggerMenuPython.TriggerPythonConfig import *
+
+## Moving to the new source is quite easy:
+
+# instead of
+#
+#    from TrigConfigSvc.TriggerPythonConfig import *
+#
+# use
+#
+#    from TriggerMenuPython.TriggerPythonConfig import *
+#
+# and instead of
+#
+#    import TrigConfigSvc.TriggerPythonConfig
+#    c = TrigConfigSvc.TriggerPythonConfig.CTPInfo
+#
+# use
+#
+#    import TriggerMenuPython.TriggerPythonConfig
+#    c = TriggerMenuPython.TriggerPythonConfig.CTPInfo
+#
+
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerPythonConfig_original_facedout.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerPythonConfig_original_facedout.py
new file mode 100755
index 0000000000000000000000000000000000000000..21ca66f9368c125956cd85ee36d0c0691ba7a4e1
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerPythonConfig_original_facedout.py
@@ -0,0 +1,2167 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+#########################################################################################
+# User interface for the configuration, nothing beneath this class need to be studied
+#
+import os
+import time
+from sys import settrace
+import xml.dom.minidom
+from AthenaCommon.Logging import logging  # loads logger
+from TrigConfigSvc.TrigLVL1configExtented import extendLVL1config
+
+class TriggerPythonConfig:
+    sCurrentTriggerConfig = None
+    def currentTriggerConfig():
+        return TriggerPythonConfig.sCurrentTriggerConfig
+    currentTriggerConfig = staticmethod(currentTriggerConfig)
+
+    def __init__(self, hltfile=None, l1file=None):
+        self.menuName = 'TestMenu'
+        self.__HLTFile = hltfile
+        self.__L1File = l1file
+        self.l1menuFromXML = None # l1menu read from XML file if any
+        self.theLVL1Thresholds = LVL1Thresholds()
+        self.theLVL1MenuItems  = LVL1MenuItems()
+        self.theCTPInfo = CTPInfo()
+        self.theMuctpiInfo = MuctpiInfo()
+        self.theLvl1CaloInfo = Lvl1CaloInfo()
+        self.allThresholds     = {}
+        self.allItems          = {}
+        self.allChains         = {}
+
+        self.theL2HLTChains    = []
+        self.theEFHLTChains    = []
+        self.theSeqLists       = []
+        self.setMuctpiInfo(low_pt=1, high_pt=1, max_cand=13)
+        self.Lvl1CaloInfo().setName('standard')
+        self.Lvl1CaloInfo().setGlobalScale(1)
+        #
+        TriggerPythonConfig.sCurrentTriggerConfig = self
+        # self.defineInternalThresholds()
+        extendLVL1config(self)
+        
+
+    ##########################################################################
+    # LVL1
+    #
+    def registerLvl1Threshold(self, name, type, mapping,
+                              slot='', connector='', active=1):
+        """Add LVL1 thresholds by giving the type/mapping information.
+        The cable input information will be calculated from them. And store it in
+        the list of available thresholds"""
+        (slot, connector, bitnum, range_begin, range_end) = self.cableInput(type, mapping)
+        thr = LVL1Thresholds.LVL1Threshold(name, type)
+        thr.active = active
+        thr.mapping = mapping
+        thr.setCableInput(bitnum, range_begin, range_end, slot, connector)
+        if name in self.allThresholds.keys():
+            logger().error('LVL1 threshold of name %s already exists' %
+                           name)
+            thr = self.allThresholds[name]
+        else:
+            self.allThresholds[name] = thr
+        return thr
+    def getLvl1Threshold(self, name):
+        thr = None
+        if name in self.allThresholds.keys():
+            thr = self.allThresholds[name]
+        return thr
+    
+    def registerLvl1Item(self, logical_name, item):
+        """ Adds a LVL1 item to the set of items which are registered for further use"""
+        if logical_name in self.allItems.keys():
+            logger().error('LVL1 item %s is already registered with ctpid=%d' % \
+                           (logical_name, self.allItems[logical_name].ctpid))
+        else:
+            self.allItems[logical_name] = item
+    def getLvl1Item(self, name):
+        item = None
+        if name in self.allItems.keys():
+            item = self.allItems[name]
+        return item
+        
+    def addLvl1Threshold(self, name, type, mapping,
+                         slot='', connector='', active=1):
+        """Add LVL1 thresholds by giving the type/mapping information.
+        The cable input information will be calculated from them."""
+        thr0 = self.theLVL1Thresholds.thresholdOfTypeMapping(type, mapping)
+        if thr0:
+            logger().warning('thr0 is name=%s' % thr0.name)
+            s = 'Replacing LVL1 threshold of type=%s, mapping=%d name=%s' % \
+                (type, mapping, thr0.name)
+            s = '%s with name=%s' % (s, name)
+            logger().warning(s)
+            self.theLVL1Thresholds.thresholds.remove(thr0)
+        (slot, connector, bitnum, range_begin, range_end) = self.cableInput(type, mapping)
+        thr = LVL1Thresholds.LVL1Threshold(name, type)
+        thr.active = active
+        thr.mapping = mapping
+        thr.setCableInput(bitnum, range_begin, range_end, slot, connector)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return thr
+    def addLvl1Threshold2(self, name, type, \
+                         bitnum=0, range_begin=0, range_end=0, \
+                         slot='', connector=''):
+        """Add LVL1 thresholds by giving the input cable information"""
+        thr = LVL1Thresholds.LVL1Threshold(name, type)
+        thr.setCableInput(bitnum, range_begin, range_end, slot, connector)
+        thr.mapping = LVL1Thresholds.cableMapping(type, range_begin)
+        thr.active = 1
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return thr
+    def addLvl1Item(self, it):
+        """Add LVL1 item of type LVL1MenuItem"""
+        v = self.theLVL1MenuItems.findItemByName(it.name)
+        if v:
+            logger().warning("Replacing LVL1 item (%s,%d) with (%s,%d)" % \
+                             (v.name, int(v.ctpid), it.name, int(it.ctpid)))
+        v = self.theLVL1MenuItems.findItemByCtpid(it.ctpid)
+        if v:
+            logger().warning("Replacing LVL1 item (%s,%d) with (%s,%d)" % \
+                             (v.name, int(v.ctpid), it.name, int(it.ctpid)))
+        self.theLVL1MenuItems.items.append(it)
+
+
+
+    def Lvl1ItemByTriggerType(self, triggertypebit, triggertypebitmask):
+        """For a triggertypebit between 0 and 7, returns a list of names of
+        those Lvl1 items that have that bit set in the triggertype"""
+        if triggertypebit<0 or triggertypebit>0xFF:
+            raise RuntimeError('TriggerPythonConfig.Lvl1ItemByTriggerType(triggertypebit,triggertypebitmask) needs to be called with 0<=triggertypebit<=0xFF, ' + \
+                               + 'but is called with triggertypebit=%i' % triggertypebit)
+        if triggertypebitmask<0 or triggertypebitmask>0xFF:
+            raise RuntimeError('TriggerPythonConfig.Lvl1ItemByTriggerType(triggertypebit,triggertypebitmask) needs to be called with 0<=triggertypebitmask<=0xFF, ' + \
+                               + 'but is called with triggertypebitmask=%i' % triggertypebitmask)
+
+        itemsForMenu = [item for item in self.allItems.values() if item.ctpid != -1]
+        
+        if not itemsForMenu:
+            logger().warning('No item defined for the L1 Menu, perhaps TriggerPythonConfig.Lvl1ItemByTriggerType() ' + \
+                             'is called too early (it needs to be called after Lvl1.generateMenu())')
+        res = [item.name for item in itemsForMenu if (triggertypebitmask & item.trigger_type)==triggertypebit ]
+        return res
+
+
+    def thresholdOfName(self, name):
+        """Return a threshold object of the given name"""
+        return self.Lvl1Thresholds().thresholdOfName(name)
+    def Lvl1Thresholds(self):
+        """Return LVL1Thresholds object"""
+        return self.theLVL1Thresholds
+    def CTPInfo(self):
+        """Return CTPInfo object"""
+        return self.theCTPInfo
+    def setMuctpiInfo(self, low_pt, high_pt, max_cand):
+        """Return Muctpi object"""
+        return self.theMuctpiInfo.set(low_pt, high_pt, max_cand)
+    def Lvl1CaloInfo(self):
+        """Return CaloInfo object"""
+        return self.theLvl1CaloInfo
+    def defineInternalThresholds(self):
+        """Define thresholds for internal triggers"""
+        self.addLvl1Threshold('RNDM0', 'RNDM', 0)
+        self.addLvl1Threshold('RNDM1', 'RNDM', 1)
+        self.addLvl1Threshold('PCLK0', 'PCLK', 0)
+        self.addLvl1Threshold('PCLK1', 'PCLK', 1)
+        self.addLvl1Threshold('BGRP0', 'BGRP', 0)
+        self.addLvl1Threshold('BGRP1', 'BGRP', 1)
+        self.addLvl1Threshold('BGRP2', 'BGRP', 2)
+        self.addLvl1Threshold('BGRP3', 'BGRP', 3)
+        self.addLvl1Threshold('BGRP4', 'BGRP', 4)
+        self.addLvl1Threshold('BGRP5', 'BGRP', 5)
+        self.addLvl1Threshold('BGRP6', 'BGRP', 6)
+        self.addLvl1Threshold('BGRP7', 'BGRP', 7)
+    def cableInput(self, type, mapping):
+        """Calculate (slot, connector, bitnum, range_begin, range_end) of the input cable of
+        the threshold to the CTP from its (type, mapping)"""
+        bitnum = 0
+        range_begin = 0
+        range_end = 0
+        slot = 0
+        connector = 0
+        bitnums = {
+            'MUON': 3,
+            'EM': 3,
+            'TAU': 3,
+            'JET': 3,
+            'JE': 1,
+            'JB': 2,
+            'JF': 2,
+            'TE': 1,
+            'XE': 1,
+            'MBTS': 3,
+            'MBTSSI': 1,
+            'NIM': 1,
+            'ZDC': 1,
+            'TRT': 1,
+            'BCM': 1,
+            'BCMCMB': 3,
+            'LUCID': 1,
+            'CALREQ': 1,
+            }
+
+        cables = { # type: [number of cables, slot, connector, start, stop ...]
+            'MUON': [1, 8, 1, 1, 30], 
+            'EM': [1, 7, 0, 0, 23],
+            'TAU': [1, 7, 1, 0, 23],
+            'JET': [1, 7, 2, 0, 23],
+            'JE': [1, 7, 2, 24, 27],
+            'JB': [1, 7, 3, 0, 7],
+            'JF': [1, 7, 3, 8, 15],
+            'TE': [1, 8, 0, 0, 3],
+            'XE': [1, 8, 0, 4, 7],
+            'MBTS': [2,
+                     9, 0, 16, 18,
+                     9, 1, 16, 18,
+                     ],
+            'MBTSSI': [2,
+                       9, 0, 0, 15,
+                       9, 1, 0, 15],
+            'NIM': [3,
+                    8, 2, 15, 27,
+                    9, 0, 19, 30,
+                    9, 1, 19, 30],
+            'ZDC': [1, 8, 2, 17, 19],
+            'TRT': [1, 8, 2, 22, 22],
+            'BCM': [1, 8, 2, 0, 8],
+            'BCMCMB': [1, 8, 2, 3, 5],
+            'LUCID': [1, 8, 2, 9, 14],
+            'CALREQ': [1, 8, 2, 28, 30],
+            }
+        
+        bitnum = bitnums[type]
+
+        for i in range(0,cables[type][0]):
+            slot = cables[type][1+i*4]
+            connector = cables[type][2+i*4]
+            offset = mapping
+            for j in range(0,i):
+                delta = (cables[type][4+j*4]-cables[type][3+j*4])/bitnum+1
+                print 'cable has room for '+str(delta)+' thresholds.'
+                offset-=delta
+            range_begin = cables[type][3+i*4]+offset*bitnum
+            range_end = range_begin+bitnum-1
+            if range_end <= cables[type][4+i*4]:
+                break            
+            else:
+                if i == cables[type][0]:
+                    print "Untreated threshold type %s for cable assignment" % type
+
+        print type+' threshold mapped at '+str(mapping)+' is set on SLOT: '+str(slot)+', connector: '+str(connector)+' in range: '+str(range_begin)+' - '+str(range_end)
+
+        return ('SLOT'+str(slot), 'CON'+str(connector), bitnum, range_begin, range_end)
+    #---------------------------------------------------------------------
+    # Below are obsolete functions
+    def addEMThreshold(self, name, value,
+                       phimin='0', phimax='64', etamin='-49', etamax='49',
+                       emiso='999', hadiso='999', hadveto='999',
+                       cable=None, range_begin=None, range_end=None):
+        """Obsolete, use addLvl1Threshold(...).addEMThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'EM')
+        thr.setCableInput(3, range_begin, range_end,slot='',connector='')
+        thr.addEMThresholdValue(value, etamin, etamax, phimin, phimax, \
+                                emiso, hadiso, hadveto)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addTauThreshold(self, name, value,
+                        phimin='0', phimax='64', etamin='-49', etamax='49',
+                        emiso='999', hadiso='999', hadveto='999',
+                        cable=None, range_begin=None, range_end=None):
+        """Obsolete, use addLvl1Threshold(...).addTauThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'TAU')
+        thr.setCableInput(3, range_begin, range_end,slot='',connector='')
+        thr.addTauThresholdValue(value, etamin, etamax, phimin, phimax, \
+                                 emiso, hadiso, hadveto)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addMuonThreshold(self, name, value,
+                         phimin='0', phimax='64', etamin='-49', etamax='49',
+                         cable=None, range_begin=None, range_end=None):
+        """Obsolete, use addLvl1Threshold(...).addMuonThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'MUON')
+        thr.setCableInput(3, range_begin, range_end,slot='',connector='')
+        thr.addMuonThresholdValue(value, etamin, etamax, phimin, phimax)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addJetThreshold(self, name, value,
+                        phimin='0', phimax='64', etamin='-49', etamax='49',
+                        window='8',
+                        cable=None, range_begin=None, range_end=None):
+        """Obsolete, use addLvl1Threshold(...).addJetThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'JET')
+        thr.setCableInput(3, range_begin, range_end,slot='',connector='')
+        thr.addJetThresholdValue(value, etamin, etamax, phimin, phimax, window)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addFwdJetThreshold(self, name, value,
+                           phimin='0', phimax='64', etamin='-49', etamax='49',
+                           window='8',
+                           cable=None, range_begin=None, range_end=None):
+        """Obsolete, use addLvl1Threshold(...).addJetThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'FJET')
+        thr.setCableInput(3, range_begin, range_end,slot='',connector='')
+        thr.addJetThresholdValue(value, etamin, etamax, phimin, phimax, window)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addFJLThreshold(self, name, value,
+                        phimin='0', phimax='64', etamin='-49', etamax='49',
+                        window='8',
+                        cable=None, range_begin=None, range_end=None):
+        """Obsolete, use addLvl1Threshold(...).addJetThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'JB')
+        thr.setCableInput(3, range_begin, range_end,slot='',connector='')
+        thr.addJetThresholdValue(value, etamin, etamax, phimin, phimax, window)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addFJRThreshold(self, name, value,
+                        phimin='0', phimax='64', etamin='-49', etamax='49',
+                        window='8',
+                        cable=None, range_begin=None, range_end=None):
+        """Obsolete, use addLvl1Threshold(...).addJetThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'JF')
+        thr.setCableInput(3, range_begin, range_end,slot='',connector='')
+        thr.addJetThresholdValue(value, etamin, etamax, phimin, phimax, window)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addEtMissThreshold(self, name, value,
+                           cable=None, range_begin=None, range_end=None):
+        """Obsolete, use addLvl1Threshold(...).addEnergyThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'XE')
+        thr.setCableInput(1, range_begin, range_end,slot='',connector='')
+        thr.addEnergyThresholdValue(value, etamin=-49, etamax=49, \
+                                    phimin=0, phimax=64)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addEtSumThreshold(self, name, value,
+                          cable=None, range_begin=None, range_end=None):
+        """Obsolete, use addLvl1Threshold(...).addEnergyThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'TE')
+        thr.setCableInput(1, range_begin, range_end,slot='',connector='')
+        thr.addEnergyThresholdValue(value, etamin=-49, etamax=49, \
+                                    phimin=0, phimax=64)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addJetSumThreshold(self, name, value):
+        """Obsolete, use addLvl1Threshold(...).addEnergyThresholdValue(...)"""
+        thr = LVL1Thresholds.LVL1Threshold(name, 'JE')
+        thr.setCableInput(1, range_begin, range_end,slot='',connector='')
+        thr.addEnergyThresholdValue(value, etamin=-49, etamax=49,\
+                                    phimin=0, phimax=64)
+        self.theLVL1Thresholds.thresholds.append(thr)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addThresholdScale(self, value=None):
+        self.theLVL1Thresholds.thresholdScale = LVL1Thresholds.ThresholdScale(value)
+
+    def addLVL1Threshold(self, th):
+        """Obsolete"""
+        self.theLVL1Thresholds.thresholds.append(th)
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def addThreshold(self, name, value, ttype, bitnum,
+                     etamin='-49', etamax='49', phimin='0', phimax='64',
+                     em_isolation='999', had_isolation='999', had_veto='999', window='8'):
+        """Obsolete, use addLvl1Threshold"""
+        self.theLVL1Thresholds.thresholds.append(
+            LVL1Thresholds.LVL1Threshold(name, value, ttype, bitnum,
+                                         etamin, etamax, phimin, phimax,
+                                         em_isolation, had_isolation, had_veto, window))
+        return self.theLVL1Thresholds.thresholds[-1]
+
+    def createLVL1Item(self, name, ctpid, group, prescale, priority):
+        """Obsolete, use addLvl1Item()"""
+        item = LVL1MenuItem(name, ctpid, group, prescale, priority)
+        self.addLvl1Item(item)
+        return item
+    def addLVL1Item(self, it):
+        """Obsolete, use addLvl1Item()"""
+        self.addLvl1Item(it);
+    def addItem(self, name, ctpid, group='1', prescale='1', priority='HIGH'):
+        """ Obsolete, use addLvl1Item(), (Adds LVL1 Trigger items)"""
+        if name in self.theLVL1MenuItems.itemNames():
+            raise Exception('LVL1 Item: '+name+' already exist')
+        self.theLVL1MenuItems.items.append( LVL1MenuItem(name, ctpid, group, prescale, priority))
+
+#
+# LVL1
+####################################################################################################
+
+####################################################################################################
+# HLT
+#
+
+    def addHLTChain(self, chain):
+        """ Adds HLT Trigger chain to the menu """
+        if chain.isL2():
+            self.theL2HLTChains.append(chain)
+        elif chain.isEF():
+            self.theEFHLTChains.append(chain)
+        else:
+            raise Exception( 'ERROR: Chain: ' + chain.chain_name + 'has incorrectly defined level')
+
+    def registerHLTChain(self, logical_name, chain):
+        """ Adds chain to the set of chains which are registered for further use """
+        if logical_name in self.allChains.keys():
+            self.allChains[logical_name].append( chain )
+        else:
+            self.allChains[logical_name] = [ chain ]
+        
+    def getHLTChain(self, name):
+        """ Gets chain by name. None returned inf nothing found"""
+        for  cl in self.allChains.values():
+            for chain in cl:
+                if chain.chain_name == name:
+                    return chain
+        return None
+
+    def addSequence(self,  inTE, algolist, outTE, topo_starts_from=None):
+        """ Adds HLT sequences to the menu """
+        if outTE in [ s.output for s in self.theSeqLists ]:
+            logger().error("There exists already sequence providing TE: "+outTE)
+            logger().error("Which is: "+str([str(s) for s in self.theSeqLists if s.output == outTE]))
+            logger().error('Tried to produce it from '+inTE+' ('+str([a.name() for a in algolist]))
+        if outTE in self.theLVL1Thresholds.thresholdNames():
+            logger().error("LVL1 theshold of name identical to output TE: "+outTE +"exists")
+
+        seq = HLTSequence(inTE, algolist, outTE, topo_starts_from)
+        self.theSeqLists.append(seq)
+        return outTE
+#
+# HLT
+####################################################################################################
+
+
+
+    def checkMenuConsistency(self):
+        """ Checks menu consistency
+
+
+        Basic checks are done like chain continuity etc.
+        Some of the checks are considered as a serious and therefore Exception is thrown.
+        Other are just messaged as a warnings.
+        """
+        return self.checkChains() and self.checkSequences() and self.checkL1()
+
+    def checkChains(self):
+        correct=True
+        # repeating definitions
+        ids = map(lambda x: x.chain_name, self.theL2HLTChains + self.theEFHLTChains)
+        repid = filter(lambda x: ids.count(x) > 1, ids)
+        for id in repid:
+            logger().error(" IN CHAIN: Chain of chain_name "+ str(id) +" used " + str(ids.count(id))+ " times, while can only once")
+            correct=False
+
+
+        counters = map(lambda x: x.chain_counter, self.theL2HLTChains)
+        repcounters = filter(lambda x: counters.count(x) > 1, counters)
+        for counter in repcounters:
+            logger().error("IN CHAIN: L2 Chain counter "+ str(counter) + " used " + str(counters.count(counter)) + " times while can only once, will print them all")
+            logger().debug( str(map( lambda x: x.chain_name,  filter(lambda x: x.chain_counter == counter, self.theL2HLTChains))) )
+            correct=False
+
+        counters = map(lambda x: x.chain_counter, self.theEFHLTChains)
+        repcounters = filter(lambda x: counters.count(x) > 1, counters)
+        for counter in repcounters:
+            logger().error("IN CHAIN: EF Chain counter "+ str(counter) + " used " + str(counters.count(counter)) + " times while can only once, will print them all")
+            logger().debug( str(map( lambda x: x.chain_name, filter(lambda x: x.chain_counter == counter, self.theEFHLTChains))) )
+            correct=False
+
+        # sufficiently defined ?
+        for chain in self.theL2HLTChains + self.theEFHLTChains:
+            if len(chain.trigger_type_bits) == 0:
+                logger().debug( "IN CHAIN: TRIGGERTYPE bit undefined for chain: " + str(chain.chain_name)+" will use chain_counter for it: "+str(chain.chain_counter) )
+                from string import atoi
+                chain.trigger_type_bits = [atoi(chain.chain_counter)]
+
+            if len(chain.stream_tag) == 0:
+                logger().error( "IN CHAIN: STREAMTAG undefined for chain: " + str(chain.chain_name) )
+                correct=False
+
+        #         # is L2 matching L1
+        #         if self.__L1File is not None:
+        #             for chain in self.theL2HLTChains:
+        #                 if chain.lower_chain_name != "":
+        #                     if chain.lower_chain_name not in self.theLVL1MenuItems.itemNames():
+        #                         logger().error( 'IN CHAIN: L2 chain '+chain.chain_name+' with has no matching LVL1 item between:'+\
+        #                                         str(self.theLVL1MenuItems.itemNames())+\
+        #                                         'while looking for ' +  str(chain.lower_chain_name) )
+        #                         correct=False
+        # are chain continuous
+        # is L2 matching L1
+        if self.__L1File is not None:
+            for chain in self.theL2HLTChains:
+                if chain.lower_chain_name != "":
+                    lower_chains = [ x.strip(" ") for x in  chain.lower_chain_name.split(",") ]
+                    #                   if chain.lower_chain_name not in self.theLVL1MenuItems.itemNames():
+                    for lc in lower_chains:
+                        if lc not in self.theLVL1MenuItems.itemNames():
+                            logger().error( 'IN CHAIN: L2 chain '+chain.chain_name+' with has no matching LVL1 item '+ lc +   chain.lower_chain_name + '   between:'+\
+                                            str(self.theLVL1MenuItems.itemNames()))
+                            correct=False
+
+        # is EF matching L2
+        l2ChainNames = map ( lambda x: x.chain_name, self.theL2HLTChains )
+        for chain in self.theEFHLTChains:
+            if chain.lower_chain_name != "":
+                if chain.lower_chain_name not in l2ChainNames:
+                    logger().error( 'ERROR IN CHAIN: EF chain: '+str(chain.chain_name)+' has no matching L2 chain between:'+\
+                                    str(l2ChainNames) )
+                    correct=False
+        # are TEs mentioned in sequences
+        tesInSeq = []
+        for seq in self.theSeqLists:
+            tesInSeq.append(seq.output)
+            #print tesInSeq
+        for chain in self.theL2HLTChains + self.theEFHLTChains:
+            for te in chain.getOutputTEs():
+                if te not in tesInSeq:
+                    logger().error( 'IN CHAIN: TE: ' + te + ' used in the chain: ' + chain.chain_name + ' not found in the sequences definitions' )
+                    logger().info('Available are: '+ str(tesInSeq))
+                    correct=False
+
+        # check if all TEs needed for EF chains are produced by corresponding L2 chain
+        # this cehck is ported to C++ version of the checker 
+
+        return correct
+
+    def checkSequences(self):
+        """ Check sequences consistency """
+        correct=True
+        return correct
+
+
+
+    def checkL1(self):
+        """ Checks is Lvl1Menu is consistent """
+        status = True
+        for thr in self.theLVL1Thresholds.thresholds:
+            if thr.active and len(thr.thresholdValues)==0:
+                s = "LVL1 threshold %s is active," % thr.name
+                s += " but doesn't have any ThresholdValues"
+                logger().error( s )
+                status = False
+        return status
+
+
+    def alignChains(self, chainsList):
+        work = True
+        # operations must repeat until all chains are OK
+        while work:
+            logger().debug(" Chains alignment round starting")
+            work = False
+            for chain in chainsList:
+                for binding in chain.chainBindings:
+                    # find chain of name
+                    peerChain = filter(lambda x: x.chain_name == binding[1],  chainsList)
+                    if len(peerChain) == 1:
+                        work = work or chain.alignChain(binding[0], peerChain[0], binding[2])
+                    else:
+                        logger().debug( "binding ineffective peer chain: " + str(binding[1]) \
+                                        + " does not exist in between: "+str(map(lambda x: x.chain_name,  chainsList))\
+                                        + " or there is more than 1" )
+                        
+        # support composition of chain out of other chains
+        for chain in chainsList:
+            if len(chain.chains_to_merge) != 0:
+                chain.doChainsMerging()
+
+    def findSequencesRecursively(self, seqDict, te):
+        """ finds recursively sequences
+        
+        seqDict is dictionary {sequence outout te: sequence obj}
+        """
+        seq = []
+        if not seqDict.has_key(te):
+            return seq
+        this = seqDict[te]
+        seq += [this]
+        for i in this.input:
+            if i != '':
+                seq += self.findSequencesRecursively(seqDict, i)		
+        return seq	
+
+    def getChainTEs(self, seqDict, chain, alsorecursive=False):
+        """ gets TEs used by chain (also recursively searching sequences)
+
+        seqDict is dictionary {sequence outout te: sequence obj}
+        """
+        neededtes = reduce(lambda x,y: x+y, [s.tes for s in chain.siglist], [])
+        if alsorecursive == True:
+            seqs = []
+            for te in neededtes:
+                seqs += self.findSequencesRecursively(seqDict, te)
+                for s in seqs:
+                    # if s.used is set then it needs 
+                    if (s.used() and s.used() == chain.level) or not s.used():
+                        if s.output not in neededtes:
+                            neededtes.append(s.output)    
+        return neededtes
+
+
+    def markUsedSequences(self):
+        seqDict = {}
+        seqDict.update([ (s.output, s) for s in self.theSeqLists])
+
+        # mark sequences as the one which will be run at L2
+        for c in self.theL2HLTChains:
+            tes = reduce(lambda x,y: x+y, [s.tes for s in c.siglist], [])
+            for te in tes:
+                seqs = self.findSequencesRecursively(seqDict, te)
+                for seq in seqs:
+                    if seq.used() == 'L2':
+                        continue
+                    else:
+                        seq.use('L2')
+                        
+        # mark sequences as the one which will be run at EF
+        for c in self.theEFHLTChains:
+            tes = reduce(lambda x,y: x+y, [s.tes for s in c.siglist], [])
+            for te in tes:
+                seqs = self.findSequencesRecursively(seqDict, te)
+                for seq in seqs:
+                    if seq.used() == 'L2':
+                        continue
+                    else:
+                        seq.use('EF')
+
+                                        
+        
+#         def activateSequencesRecursively(output):
+#             if not seqDict.has_key(output):
+#                 return
+#             s = seqDict[output]
+#             if s.used():
+#                 return
+#             s.use()
+#             for i in s.input:
+#                 activateSequencesRecursively(i)
+#             return
+
+#         for c in self.theL2HLTChains:
+#             tes = []
+#             for sig in c.siglist[0:]:
+#                 tes.extend(sig.tes)
+#             for te in tes:
+#                 activateSequencesRecursively(te)
+
+#         for c in self.theEFHLTChains:
+#             tes = []
+#             for sig in c.siglist[0:]:
+#                 tes.extend(sig.tes)
+#             for te in tes:
+#                 activateSequencesRecursively(te)                
+                    
+    def writeConfigFiles(self):
+        """ Writes all config files, but first checking consistency"""
+
+
+        self.alignChains(self.theL2HLTChains)
+        self.alignChains(self.theEFHLTChains)
+
+
+
+        # disable python tracing
+        from AthenaCommon.Include import excludeTracePattern
+        excludeTracePattern.append("*/dom/*")
+        
+        # HLT XML
+        xHLTdoc = xml.dom.minidom.Document()
+        #        xtype = xml.dom.minidom.DocumentType("HLT_MENU")
+        #        xtype.systemId = "hlt_menu.dtd"
+        #        xHLTdoc.appendChild(xtype)
+
+        # comments
+
+        xc = xHLTdoc.createComment('File is auto-generated by python config class, may be overwritten')
+        xHLTdoc.appendChild(xc)
+
+        xc = xHLTdoc.createComment('No. of L2 HLT chains:' + str(len(self.theL2HLTChains)) )
+        xHLTdoc.appendChild(xc)
+
+        xc = xHLTdoc.createComment('No. of EF HLT chains:' + str(len(self.theEFHLTChains)))
+        xHLTdoc.appendChild(xc)
+
+        xHLTMenu = xHLTdoc.createElement('HLT_MENU')
+        xHLTdoc.appendChild(xHLTMenu)
+
+        self.markUsedSequences()
+        
+        # make xml sequences
+        xSequenceList = xHLTdoc.createElement('SEQUENCE_LIST')
+        for s in self.theSeqLists:
+            s.xml( xSequenceList )
+
+        xHLTMenu.appendChild(xSequenceList)
+
+
+        # make xml chains
+        xChainList = xHLTdoc.createElement('CHAIN_LIST')
+
+        for c in self.theL2HLTChains:
+            c.xml( xChainList )
+
+        for c in self.theEFHLTChains:
+            c.xml( xChainList )
+        xHLTMenu.appendChild(xChainList)
+
+        # write out the xml as a file
+        file = open( self.__HLTFile, mode="wt" )
+        logger().debug("Writing XML file for HLT")
+
+        file.write( xHLTdoc.toprettyxml() )
+        file.flush()
+        file.close()
+        xHLTdoc.unlink()
+
+        if self.__L1File is not None:
+
+            # LVL1 XML
+            xlvl1doc = xml.dom.minidom.Document()
+            xlvl1config = xHLTdoc.createElement('LVL1Config')
+            xlvl1config.setAttribute('name', self.menuName)
+            xlvl1config.setAttribute('id',idgen.get('LVL1Config'))
+            xlvl1doc.appendChild(xlvl1config)
+
+            
+            # comments
+            xc = xlvl1doc.createComment('File is auto-generated by python config class, may be overwritten')
+            xlvl1config.appendChild(xc)
+            xc = xlvl1doc.createComment('No. L1 thresholds defined: ' + str(len(self.theLVL1Thresholds.thresholds)) )
+            xlvl1config.appendChild(xc)
+            xc = xlvl1doc.createComment('No. L1 items defined: ' + str(len(self.theLVL1MenuItems.items)) )
+            xlvl1config.appendChild(xc)
+
+            
+            self.theLVL1MenuItems.xml(xlvl1config)
+            self.theLVL1Thresholds.xml(xlvl1config)
+            self.theCTPInfo.xml(xlvl1config)
+            self.theMuctpiInfo.xml(xlvl1config)
+            self.theLvl1CaloInfo.xml(xlvl1config)
+
+            
+            file = open( self.__L1File, mode="wt" )
+            
+            logger().debug("Writing XML file for LVL1")
+            file.write( xlvl1doc.toprettyxml('  ') )
+            file.close()
+            xlvl1doc.unlink()
+
+
+        if self.checkMenuConsistency() is False:
+            raise Exception( "Trigger menu inconsistent, aborting...." )
+
+
+    def dot(self, algs=True):
+        file = open( self.__HLTFile[0:-4]+'_sequenceses.dot', mode="wt" )
+        file.write( 'digraph Menu  {\n'\
+                    +'\n'\
+                    +'node [ shape=polygon, fontname=Helvetica ]\n'\
+                    +'edge [ fontname=Helvetica ]\n' )
+        for s in self.theSeqLists:
+            file.write( s.dot(algs) )
+        file.write( '}')
+        file.close()
+
+        
+#
+# EOF user interface
+#########################################################################################
+
+
+#########################################################################################
+# internals
+#
+
+# little utility for xml printing attribute
+def attr(name, value):
+    return ' '+name+'="'+str(value)+'" '
+
+# unique id generator
+class idgen:
+    a =  {}
+    def get(self, kind):
+        if kind not in self.a:
+            self.a[kind] = 0
+        self.a[kind] += 1
+        return str(self.a[kind])
+
+idgen = idgen()
+
+
+def issubset(a, b):
+    """ True check if all element in a also are in b """
+    return len(filter( lambda x: x not in b, a)) == 0
+
+def logger():
+    return logging.getLogger( "TriggerPythonConfig" )
+
+
+#########################################################################################
+# LVL1
+
+class Logic:
+    NONE = ''
+    AND = '&'
+    OR = '|'
+    NOT = '!'
+
+    def symbolToString(x):
+        if x==Logic.AND:
+            return 'AND'
+        elif x==Logic.OR:
+            return 'OR'
+        elif x==Logic.NOT:
+            return 'NOT'
+        else:
+            return ''
+    symbolToString = staticmethod(symbolToString)
+
+    def __init__(self, condition=None):
+        self.subLogic = Logic.NONE
+        self.condition = '' # hold a Lvl1Condition instance
+        self.subConditions = [] # holds Logic instances
+        if condition!=None and condition!='':
+            self.condition = condition
+
+    def __or__(self, x):
+        a = Logic()
+        if self.subLogic == Logic.OR:
+            a = self
+        else:
+            a = Logic()
+            a.subLogic = Logic.OR
+            a.subConditions.append(self)
+        a.subConditions.append(x)
+        return a
+    def __and__(self, x):
+        a = Logic()
+        if self.subLogic == Logic.AND:
+            a = self
+        else:
+            a = Logic()
+            a.subLogic = Logic.AND
+            a.subConditions.append(self)
+        a.subConditions.append(x)
+        return a
+    def __not__(self, x):
+        logger().debug('checking NOT')
+        a = self
+        if a.subLogic==Logic.NONE:
+            a.subLogic = Logic.NOT
+        if a.subLogic==Logic.NOT:
+            if len(a.subConditions) == 1:
+                logger().debug('not is a unary operator, ignore it')
+            else:
+                a.subConditions.append(x)
+        return a
+
+    def __str__(self):
+        s = ''
+        if self.subLogic == Logic.NONE:
+            if len(self.subConditions)==1:
+                s += str(self.subConditions[0])
+            elif len(self.subConditions)>=1:
+                logger().error('Logic NONE has more than one element')
+                s += ''
+            elif len(self.subConditions)==0 and self.condition!='':
+                s += str(self.condition)
+        elif self.subLogic == Logic.NOT:
+            if len(self.subConditions)==1:
+                s += '!'+str(self.subConditions[0])
+            elif len(self.subConditions)>=1:
+                logger().error('Logic NOT has more than one element')
+                s += ''
+        elif self.subLogic == Logic.AND or self.subLogic == Logic.OR:
+            if len(self.subConditions)==1:
+                s += str(self.subConditions[0])
+            else:
+                s += '('
+                for (i, a) in enumerate(self.subConditions):
+                    if i > 0: s += self.subLogic
+                    s += str(a)
+                s +=')'
+        return s
+    def thresholdNames(self):
+        names = []
+        if self.subLogic == Logic.NONE or \
+               (self.condition!=None and self.condition!=''):
+            if self.condition!=None and \
+                   not isinstance(self.condition,LVL1MenuItem.Lvl1InternalTrigger):
+                    
+                if self.condition.threshold!=None and \
+                       self.condition.threshold.name not in names:
+                    names.append(self.condition.threshold.name)
+        else:
+            for a in self.subConditions:
+                for b in a.thresholdNames():
+                    if b not in names: names.append(b)
+        return names
+    def normalize(self):
+        if self.subLogic in (Logic.AND, Logic.OR):
+            mylogic = self.subLogic
+            newconditions = []
+            for c in self.subConditions:
+                if c.subLogic == mylogic: # X&(A&B) or X|(A|B) 
+                    # expand it to X&A&B or X|A|B
+                    c.normalize()
+                    newconditions.extend(c.subConditions)
+                else:
+                    newconditions.append(c)
+            self.subConditions = newconditions
+        else:
+            pass
+        pass
+    def xml(self, node):
+        if self.subLogic==Logic.NONE and \
+               isinstance(self.condition, LVL1MenuItem.Lvl1InternalTrigger):
+            e = xml.dom.minidom.Document().createElement('InternalTrigger')
+            e.setAttribute('name', self.condition.name)
+            node.appendChild(e)
+        elif self.subLogic==Logic.NONE and \
+             isinstance(self.condition, LVL1MenuItem.Lvl1Condition):
+            e = xml.dom.minidom.Document().createElement('TriggerCondition')
+            e.setAttribute('name', self.condition.threshold.name+'_x'+\
+                           str(self.condition.multiplicity))
+            e.setAttribute('triggerthreshold', self.condition.threshold.name)
+            e.setAttribute('multi', str(self.condition.multiplicity))
+            node.appendChild(e)
+        elif self.subLogic==Logic.AND:
+            e = xml.dom.minidom.Document().createElement('AND')
+            node.appendChild(e)
+            for s in self.subConditions:
+                s.xml(e)
+        elif self.subLogic==Logic.OR:
+            e = xml.dom.minidom.Document().createElement('OR')
+            node.appendChild(e)
+            for s in self.subConditions:
+                s.xml(e)
+        elif self.subLogic==Logic.NOT:
+            e = xml.dom.minidom.Document().createElement('NOT')
+            node.appendChild(e)
+            for s in self.subConditions:
+                s.xml(e)
+        else:
+            logger().error('Unknown node in LVL1 item logic')
+            logger().error('  ==> sublogic = ', self.subLogic)
+            logger().error('  ==> # subConditions = ', len(self.subConditions))
+
+    def printIt(self):
+        for a in self.subConditions:
+            if a.subLogic==a.NONE and a.condition!='':
+                logger().info('subCondition :', str(a.condition))
+            else:
+                logger().info('subCondition :', a.printIt())
+        return ''
+
+    def dumpXML(self, indent=''):
+        if self.subLogic==Logic.NONE:
+            if len(self.subConditions)==0:
+                logger().info(indent + '<TriggerCondition ' + str(self.condition) + '>')
+        else:
+            logger().info(indent + '<' + Logic.symbolToString(self.subLogic) + '>')
+            for a in self.subConditions:
+                a.dumpXML(indent+'  ')
+            logger().info(indent + '</' + Logic.symbolToString(self.subLogic) + '>')
+        return ''
+
+    def Not(x):
+        a = Logic()
+        a.subLogic = Logic.NOT
+        a.subConditions.append(x)
+        return a
+    Not = staticmethod(Not)
+def Not(x):
+    return Logic.Not(x)
+
+class LVL1MenuItem:
+    class Lvl1Condition:
+        def __init__(self, threshold, multi):
+            self.threshold = threshold
+            self.multiplicity = multi
+        def __str__(self):
+            return str(self.threshold) + '[x' + str(self.multiplicity)+']'
+
+    class Lvl1InternalTrigger(Lvl1Condition):
+        def __init__(self, name):
+            self.name = name
+        def xml(self, x):
+            internaltrig = xml.dom.minidom.Element('InternalTrigger')
+            internaltrig.setAttribute('name', self.name)
+            x.appendChild(internaltrig)
+        def __str__(self):
+            return str(self.name)
+
+    def __init__(self, name, ctpid, group='1', prescale='1', priority='HIGH'):
+        self.name      = name
+        self.group     = group
+        self.ctpid     = str(ctpid)
+        self.prescale  = str(prescale)
+        self.priority  = str(priority)
+        self.logic = None
+        self.trigger_type = 0
+        
+    def setLogic(self, x):
+        self.logic = x
+        return self
+
+    def setCtpid(self, x):
+        self.ctpid = str(x)
+        return self
+
+    def thresholdNames(self):
+        if self.logic!=None:
+            return self.logic.thresholdNames()
+        else:
+            return []
+
+    def setTriggerType(self, n):
+        ttype = int(n)
+        ttype = ttype & 0xff
+        self.trigger_type = ttype
+        return self
+    
+    def addCondition(self, name, multi, threshold=None):
+        """Obsolete method, use setLogic"""
+        return self.addAndedCondition(name, multi, threshold)
+
+    def addOredCondition(self, name, multi, threshold=None):
+        """Obsolete method, use setLogic"""
+        tm = TriggerPythonConfig.currentTriggerConfig()
+        ok = False
+        if tm != None:
+            thr = tm.theLVL1Thresholds.thresholdOfName(name)
+            if thr != None:
+                if self.logic != None:
+                    if self.logic.subLogic == Logic.OR or \
+                           self.logic.subLogic == Logic.NONE:
+                        self.logic = self.logic|Logic(thr.lvl1Condition(multi))
+                        ok = True
+                else:
+                    self.setLogic(Logic(thr.lvl1Condition(multi)))
+                    ok = True
+        if not ok:
+            logger().error('Error while trying to add ORed Condition')
+            if self.logic==None:
+                logger().error('Logic is not defined for this item')
+            else:
+                logger().error('Already setup logic: ')
+                self.logic.printIt()
+            logger().error('Tried to add ORed condition of ' + threshold + \
+                  " multi=" + str(multi))
+        return self
+
+    def addAndedCondition(self, name, multi, threshold=None):
+        """Obsolete method, use setLogic"""
+        tm = TriggerPythonConfig.currentTriggerConfig()
+        ok = False
+        if tm != None:
+            thr = tm.theLVL1Thresholds.thresholdOfName(name)
+            if thr != None:
+                if self.logic != None:
+                    if self.logic.subLogic == Logic.AND or \
+                           self.logic.subLogic == Logic.NONE:
+                        self.logic = self.logic|Logic(thr.lvl1Condition(multi))
+                        ok = True
+                else:
+                    self.setLogic(Logic(thr.lvl1Condition(multi)))
+                    ok = True
+        if not ok:
+            logger().error('Error while trying to add ANDed Condition')
+            if self.logic==None:
+                logger().error('Logic is not defined for this item')
+            else:
+                logger().error('Already setup logic: ')
+                self.logic.printIt()
+            logger().error('Tried to add ANDed condition of %s multi=%s' % (threshold, multi))
+        return self
+
+    def binary_trigger_type(self, x):
+        TT=''
+        for i in range(0,8):
+            if(x%2==1):
+                TT='1'+TT
+            else:
+                TT='0'+TT
+            x=x/2
+        return TT
+
+    def xml(self, xmenu):
+        xtriggeritem = xml.dom.minidom.Document().createElement('TriggerItem')
+        xtriggeritem.setAttribute('name', self.name)
+        xtriggeritem.setAttribute('ctpid', self.ctpid)
+        xtriggeritem.setAttribute('version', '1')
+        xtriggeritem.setAttribute('definition', '(1)')
+        xtriggeritem.setAttribute('trigger_type', self.binary_trigger_type(self.trigger_type))
+        xtriggeritem.setAttribute('comment','test comment')
+        xtriggeritem.setAttribute('group','0')
+        xmenu.appendChild(xtriggeritem);
+        if self.logic!=None:
+            self.logic.normalize()
+            self.logic.xml(xtriggeritem)
+
+class LVL1MenuItems:
+    def __init__(self):
+        self.items = []
+
+    def itemNames(self):
+        return map( lambda x: x.name, self.items )
+
+    def findItemByName(self, name):
+        items = filter(lambda x: x.name==name, self.items)
+        if len(items)==0: return None
+        else: return items[0]
+
+    def findItemByCtpid(self, ctpid):
+        items = filter(lambda x: x.ctpid==ctpid, self.items)
+        if len(items)==0: return None
+        else: return items[0]
+
+    def addItem(self, itemname, mult='1', prescale='1', mask='on', \
+                threshold=None):
+        self.items.append( LVL1MenuItem(itemname, mult, prescale, mask, threshold) )
+
+    def getNMDPS(self, PS):
+        # floatPS is the raw float as entered into the python. This returns n | m | d where
+        # n is a 24bit positive number INTEGER PRESCALE
+        # m,d are 4bit positive integer used for fractional prescale.
+        # The fractional prescale is calculated as: f = n * (m+d+1)/(m+1)
+        # List with all possible prescaleValues between 1 and 2. Used to calculate the
+        # N,M,D combination out of a float prescale.
+        L1PSNumberAuxValues = [[15,1],[14,1],[13,1],[12,1],[11,1],[10,1],[9,1],[8,1],[15,2],
+                               [14,2],[13,2],[12,2],[11,2],[10,2],[15,3],[14,3],[13,3],[8,2],
+                               [12, 3],[15, 4],[14, 4],[10, 3],[13, 4],[9, 3],[12, 4],[15, 5],
+                               [14, 5],[13, 5],[10, 4],[15, 6],[12, 5],[14, 6],[11, 5],[13, 6],
+                               [15, 7],[8, 4],[10, 5],[12, 6],[14, 7],[15, 8],[14, 8],[12, 7],
+                               [10, 6],[8, 5],[15, 9],[13, 8],[11, 7],[14, 9],[12, 8],[15, 10],
+                               [10, 7],[13, 9],[14, 10],[15, 11],[12, 9],[9, 7],[13, 10],[10, 8],
+                               [14, 11],[15, 12],[12, 10],[8, 7],[13, 11],[14, 12],[15, 13],[10, 9],
+                               [11, 10],[12, 11],[13, 12],[14, 13],[15, 14],[8, 8],[9, 9],[10, 10],
+                               [11, 11],[12, 12],[13, 13],[14, 14],[15, 15],
+                              ]
+
+        floatPS = float(PS)
+        # Only negative prescale allowed is -1 from Python
+        if (floatPS < 0.0):
+            n = -1
+            m = 0
+            d = 0
+            f = -1
+            return n,m,d,f
+
+        # Now find n, m, d and allowed float ps for any float provided
+        floatPScorr = 1.0
+        tmpN = int(floatPS)
+        tmpM = 0
+        tmpD = 0
+        diff = floatPS - tmpN
+        psIdx = -1
+        i=-1
+        if (floatPS - tmpN != 0):
+            if (floatPS <= 1):
+                tmpN = 1
+            else:
+                for entry in L1PSNumberAuxValues: #pair is mm, dd
+                    i += 1
+                    floatPScorr = ( float(entry[0] + entry[1] + 1.0)) / (float(entry[0] + 1))
+                    tmpF = tmpN * floatPScorr
+                    if (tmpF - tmpN < 1.0):
+                        tmpDiff = abs(floatPS - tmpF)
+                        if (tmpDiff < diff):
+                            diff = tmpDiff
+                            psIdx = i
+                        else:
+                            break
+                if psIdx >= 0:
+                    tmpM = (L1PSNumberAuxValues[psIdx])[0]
+                    tmpD = (L1PSNumberAuxValues[psIdx])[1]
+                    #floatPScorr = tmpN * (float(tmpM + tmpD + 1.0)) / (float(tmpM + 1))
+                    floatPScorr = float(tmpM + tmpD + 1.0) / (float(tmpM + 1.0))
+                else:
+                    floatPScorr = 1
+
+        return tmpN, tmpM, tmpD, tmpN*float(tmpM+tmpD+1.0)/(float(tmpM+1.0))
+
+    def xml(self, xconfig):
+        xtriggermenu = xml.dom.minidom.Document().createElement('TriggerMenu')
+        xtriggermenu.setAttribute('id', idgen.get('TriggerMenu'))
+        xtriggermenu.setAttribute('name','lumi01')
+        xtriggermenu.setAttribute('version','1')
+        xtriggermenu.setAttribute('phase','lumi')
+        xconfig.appendChild(xtriggermenu)
+
+        for i in self.items:
+            i.xml(xtriggermenu)
+        # write prescale array
+        prescaleSet = map(lambda x: '1', range(256)) #1, 256))
+        for i in map( lambda x: (x.ctpid, x.prescale), self.items ):
+            prescaleSet[int(i[0])] = i[1]
+        xprescaleset = xml.dom.minidom.Element('PrescaleSet')
+        xprescaleset.setAttribute('name','standard')
+        xprescaleset.setAttribute('version','1')
+        for i in range(256):
+            prescale = xml.dom.minidom.Element('Prescale')
+            # get float ps and convert to n,m,d and corrected float
+            floatPS = prescaleSet[i]
+            n,m,d,floatPScorr = self.getNMDPS(floatPS)
+            prescale.setAttribute('ctpid', str(i))
+            prescale.setAttribute('n', str(n))
+            prescale.setAttribute('m', str(m))
+            prescale.setAttribute('d', str(d))
+            #
+            xtext = xml.dom.minidom.Text()
+            xtext.replaceWholeText(str(floatPScorr))
+            prescale.appendChild(xtext)
+            xprescaleset.appendChild(prescale)
+        xconfig.appendChild(xprescaleset)
+
+        # write priority array
+        prioritySet = map(lambda x: 'LOW', range(256)) # 1, 256))
+        for i in map( lambda x: (x.ctpid, x.priority), self.items ):
+            prioritySet[int(i[0])] = i[1]
+        xpriorityset = xml.dom.minidom.Element('PrioritySet')
+        xpriorityset.setAttribute('name', 'standard')
+        xpriorityset.setAttribute('version', '1')
+        for i in range(256):
+            priority = xml.dom.minidom.Element('Priority')
+            priority.setAttribute('ctpid', str(i))
+            xtext = xml.dom.minidom.Text()
+            xtext.replaceWholeText(str(prioritySet[i]))
+            priority.appendChild(xtext)
+            xpriorityset.appendChild(priority)
+        xconfig.appendChild(xpriorityset)
+
+##############################################################################
+# LVL1 Threshold classes
+# Maximum values for calo thresholds to disable that threshold
+#
+ClusterOff   = 255
+IsolationOff = 63
+JetOff       = 1023
+EtSumOff     = 2047
+EtMissOff    = 2895
+JetEtOff     = 13286
+# InternalTriggers
+bgrp0 = LVL1MenuItem.Lvl1InternalTrigger('BGRP0')
+bgrp1 = LVL1MenuItem.Lvl1InternalTrigger('BGRP1')
+bgrp2 = LVL1MenuItem.Lvl1InternalTrigger('BGRP2')
+bgrp3 = LVL1MenuItem.Lvl1InternalTrigger('BGRP3')
+bgrp4 = LVL1MenuItem.Lvl1InternalTrigger('BGRP4')
+bgrp5 = LVL1MenuItem.Lvl1InternalTrigger('BGRP5')
+bgrp6 = LVL1MenuItem.Lvl1InternalTrigger('BGRP6')
+bgrp7 = LVL1MenuItem.Lvl1InternalTrigger('BGRP7')
+rndm0 = LVL1MenuItem.Lvl1InternalTrigger('RNDM0')
+rndm1 = LVL1MenuItem.Lvl1InternalTrigger('RNDM1')
+pclk0 = LVL1MenuItem.Lvl1InternalTrigger('PCLK0')
+pclk1 = LVL1MenuItem.Lvl1InternalTrigger('PCLK1')
+
+class LVL1Thresholds:
+    def cableMapping(type, range_begin):
+        """Calculate the mapping of the input cable of the threshold to the
+        CTP from its (type, range_begin)"""
+        mapping = -1
+        if type == 'MUON':
+            mapping = range_begin/3
+        elif type=='EM':
+            mapping = range_begin/3
+        elif type=='TAU':
+            mapping = range_begin/3
+        elif type=='JET':
+            mapping = range_begin/3
+        elif type=='JE':
+            mapping = range_begin-24
+        elif type=='JB' or type=='FJL':
+            mapping = range_begin/2
+        elif type=='JF' or type=='FJR':
+            mapping = (range_begin-8)/2
+        elif type=='TE':
+            mapping = range_begin
+        elif type=='XE':
+            mapping = range_begin-4
+        return mapping
+    cableMapping = staticmethod(cableMapping)
+    
+    class ThresholdScale:
+        def __init__(self, value=None):
+            self.value = '1.0'
+            if value is not None: self.value = value
+
+        def xml(self):
+            line='<ThresholdScale caloscale="'
+            line+=self.value
+            line+='"/>'
+            return line
+
+
+    class ThresholdValue:
+        #
+        def __init__(self, type, value, etamin, etamax, phimin, phimax, \
+                     em_isolation, had_isolation, had_veto, \
+                     window, priority, name=''):
+            self.name = name
+            self.type = type
+            self.value = value
+            self.etamin = etamin
+            self.etamax = etamax
+            self.phimin = phimin
+            self.phimax = phimax
+            self.em_isolation = em_isolation
+            self.had_isolation = had_isolation
+            self.had_veto = had_veto
+            self.window = window
+            self.priority = priority
+
+        def xml(self, xlist):
+            e = xml.dom.minidom.Element('TriggerThresholdValue')
+            e.setAttribute('name', self.name)
+            e.setAttribute('type', self.type)
+            e.setAttribute('thresholdval', str(self.value))
+            e.setAttribute('etamin', str(self.etamin))
+            e.setAttribute('etamax', str(self.etamax))
+            e.setAttribute('phimin', str(self.phimin))
+            e.setAttribute('phimax', str(self.phimax))
+            e.setAttribute('em_isolation', str(self.em_isolation))
+            e.setAttribute('had_isolation', str(self.had_isolation))
+            e.setAttribute('had_veto', str(self.had_veto))
+            e.setAttribute('window', str(self.window))
+            e.setAttribute('priority', str(self.priority))
+            xlist.appendChild(e)
+
+    class LVL1Threshold:
+        #
+        def __init__(self, name, ttype):
+            self.name   = name
+            self.ttype  = ttype
+            self.thresholdValues = []
+            self.bitnum = 0
+            self.active = 1
+            self.mapping = -1
+            self.cable = ''
+            self.range_begin = -1
+            self.range_end = -1
+            self.slot = ''
+            self.connector = ''
+            self.type2cable    = {'MUON': 'MU',
+                                  'EM': 'CP1',
+                                  'TAU': 'CP2',
+                                  'JET':'JEP1',
+                                  'JE':'JEP1',
+                                  'FJET':'JEP2',
+                                  'JB':'JEP2',
+                                  'JF':'JEP2',
+                                  'XE':'JEP3',
+                                  'TE':'JEP3',
+                                  'LUCID': 'NIM',
+                                  'TRT': 'NIM',
+                                  'ZDC': 'NIM',
+                                  'BCM': 'NIM',
+                                  'BCMCMB': 'NIM',
+                                  'MBTSSI': 'NIM',
+                                  'MBTS': 'NIM',
+                                  'CALREQ': 'NIM',
+                                  'NIM': 'NIM'}
+
+            if self.cable is None or self.cable=='':
+                if ttype in self.type2cable.keys():
+                    cable = self.type2cable[ttype]
+                    self.cable = cable
+
+        def __str__(self):
+            return self.name
+
+        def lvl1Condition(self, multi):
+            return LVL1MenuItem.Lvl1Condition(self, multi)
+
+        def condition(self, multi=1):
+            return Logic(self.lvl1Condition(multi))
+
+        def setCableInput(self, bitnum, range_begin, range_end, \
+                          slot, connector):
+            self.bitnum = int(bitnum)
+            self.range_begin = int(range_begin)
+            self.range_end = int(range_end)
+            self.slot = slot
+            self.connector = connector
+            return self
+
+        def addMuonThresholdValue(self, value, \
+                                  etamin, etamax, phimin, phimax, \
+                                  priority=0):
+            thrv = LVL1Thresholds.ThresholdValue(self.ttype, value, \
+                                                 etamin, etamax, phimin, phimax, \
+                                                 IsolationOff, \
+                                                 IsolationOff, \
+                                                 IsolationOff, \
+                                                 0, priority, self.name+'full')
+            self.thresholdValues.append(thrv)
+            return self
+
+        def addCPThresholdValue(self, value, etamin, etamax, phimin, phimax, \
+                                em_isolation, had_isolation, had_veto,
+                                priority=1):
+            thrv = LVL1Thresholds.ThresholdValue(self.ttype, value, \
+                                                 etamin, etamax, phimin, phimax, \
+                                                 em_isolation, had_isolation, had_veto, \
+                                                 0, priority, self.name+'full')
+            self.thresholdValues.append(thrv)
+            return self
+
+        def addEMThresholdValue(self, value, etamin, etamax, phimin, phimax, \
+                                em_isolation, had_isolation, had_veto,
+                                priority=1):
+            return self.addCPThresholdValue(value, etamin, etamax, \
+                                            phimin, phimax,
+                                            em_isolation, had_isolation,
+                                            had_veto, priority)
+
+        def addTauThresholdValue(self, value, etamin, etamax, phimin, phimax, \
+                                 em_isolation, had_isolation, had_veto,
+                                 priority=1):
+            return self.addCPThresholdValue(value, etamin, etamax, \
+                                            phimin, phimax,
+                                            em_isolation, had_isolation,
+                                            had_veto, priority)
+
+        def addJetThresholdValue(self, value, etamin, etamax, phimin, phimax, \
+                                 window=8, priority=0):
+            thrv = LVL1Thresholds.ThresholdValue(self.ttype, value, \
+                                                 etamin, etamax, phimin, phimax, \
+                                                 IsolationOff, \
+                                                 IsolationOff, \
+                                                 IsolationOff, \
+                                                 window, priority, self.name+'full')
+            self.thresholdValues.append(thrv)
+            return self
+
+        def addEnergyThresholdValue(self, value, \
+                                etamin, etamax, phimin, phimax, \
+                                priority=0):
+            thrv = LVL1Thresholds.ThresholdValue(self.ttype, value, \
+                                                 etamin, etamax, phimin, phimax, \
+                                                 IsolationOff, \
+                                                 IsolationOff, \
+                                                 IsolationOff, \
+                                                 0, priority, self.name+'full')
+            self.thresholdValues.append(thrv)
+            return self
+
+        def thresholdInGeV(self):
+            if len(self.thresholdValues)==0:
+                return 0
+            else:
+                return float(self.thresholdValues[0].value)
+
+        def xml(self, xlist):
+            """ Returns XML representation of the LVL1 Threshold """
+            sThresholdTypes = ('MUON',
+                               'EM', 'TAU',
+                               'JET', 'JE',
+                               'JB', 'JF', 
+                               'TE', 'XE',
+                               'LUCID', 'TRT', 'ZDC', 'BCM', 'BCMCMB', 'MBTS', 'MBTSSI', 'CALREQ','NIM',
+                               )
+            sInternalThresholdTypes = ('RNDM', 'BGRP', 'PCLK')
+            if self.ttype in sThresholdTypes or \
+                   self.ttype in sInternalThresholdTypes:
+                xtth = xml.dom.minidom.Element('TriggerThreshold')
+                xtth.setAttribute('id', idgen.get('TriggerThreshold'))
+                xtth.setAttribute('version', '1')
+                xtth.setAttribute('name', self.name)
+                xtth.setAttribute('type', self.ttype)
+                xtth.setAttribute('active', str(self.active))
+                xtth.setAttribute('mapping', str(self.mapping))
+                xtth.setAttribute('bitnum', str(self.bitnum))
+                for thrv in self.thresholdValues:
+                    thrv.xml(xtth)
+                xcable = xml.dom.minidom.Element('Cable')
+                xcable.setAttribute('name', self.cable)
+                xcable.setAttribute('ctpin', self.slot)
+                xcable.setAttribute('connector', self.connector)
+                xtth.appendChild(xcable)
+
+                xsignal = xml.dom.minidom.Element('Signal')
+                xsignal.setAttribute('range_begin', str(self.range_begin))
+                xsignal.setAttribute('range_end',  str(self.range_end))
+                xcable.appendChild(xsignal)
+                xlist.appendChild(xtth)
+            else:
+                logger().error('Trigger type not defined: ', self.ttype)
+
+    def compThreshold(thr1, thr2):
+        mapping1, mapping2 = thr1.mapping, thr2.mapping
+        # First sort by mapping if it's not -1
+        if mapping1>=0 and mapping2>0:
+            if mapping1 < mapping2: return -1
+            if mapping1 > mapping2: return 1
+            else: return 0
+        elif mapping1>=0: return -1
+        elif mapping2>=0: return 1
+        else:
+            # Second sort by (threshold value and then threshold name)
+            import re
+            thrv1, thrv2 = 0, 0
+            re_thrv = re.compile('(\d+)')
+            mg = re_thrv.search(thr1.name)
+            if mg: thrv1 = int(mg.group(1))
+            mg = re_thrv.search(thr2.name)
+            if mg: thrv2 = int(mg.group(1))
+            #
+            if thrv1 < thrv2: return -1
+            elif thrv1 > thrv2: return 1
+            else:
+                if thr1.name < thr2.name: return -1
+                elif thr1.name > thr2.name: return 1
+                else: return 0
+    compThreshold = staticmethod(compThreshold)
+    
+    def __init__(self):
+        self.thresholds = []
+        self.thresholdScale = LVL1Thresholds.ThresholdScale()
+    def thresholdNames(self):
+        return map(lambda x: x.name, self.thresholds)
+
+    def allThresholdsOf(self, type):
+        # thr_types = ('MUON', 'EM', 'TAU', 'JET', 'FJET', 'JE', 'TE', 'XE')
+        thr_types = ('MUON', 'EM', 'TAU', 'JET', 'JB','JF', 'JE', 'TE', 'XE',
+                     'FJL','FJR')
+        thrs = []
+        if type in thr_types:
+            for thr in self.thresholds:
+                if thr.ttype == type: thrs.append(thr)
+        return thrs
+
+    def thresholdOfName(self, name):
+        thr = filter(lambda x: x.name==name, self.thresholds)
+        if len(thr)==1:
+            return thr[0]
+        else:
+            return None
+    def thresholdOfTypeMapping(self, type, mapping):
+        thrs = filter(lambda x: (x.ttype==type and x.mapping==mapping), \
+                      self.thresholds)
+        if len(thrs)==1:
+            return thrs[0]
+        elif len(thrs)>1:
+            s = 'More than one (%d) LVL1 thresholds of type %s with' % \
+                (len(thrs), type)
+            s = '%s mapping %d found' % (s, mapping)
+            logger().warning(s)
+            return thrs[0]
+        else:
+            return None
+            
+
+    def xml(self, xconfig):
+        xttlist = xml.dom.minidom.Element('TriggerThresholdList')
+        self.thresholds.sort(LVL1Thresholds.compThreshold)
+        type_map = []
+        for th in self.thresholds:
+            mapping = th.mapping
+            if mapping==-1:
+                mapping = LVL1Thresholds.cableMapping(th.ttype, th.range_begin)
+            tm = (th.ttype, mapping)
+            if tm not in type_map:
+                type_map.append(tm)
+                th.xml(xttlist)
+            else:
+                s = 'Ignoring LVL1 threshold %s of type=%s, mapping=%d' % \
+                    (th.name, th.ttype, mapping)
+                s = '%s since this position was already occupied' % s
+                logger().warning(s)
+                print tm 
+        xconfig.appendChild(xttlist)
+
+class CTPInfo:
+    class Random:
+        def __init__(self):
+            self.name = ''
+            self.rate1 = 0
+            self.rate2 = 0
+        def set(self, name, rate1, rate2, seed1, seed2):
+            self.name = name
+            self.rate1 = rate1
+            self.rate2 = rate2
+            self.seed1 = seed1
+            self.seed2 = seed2
+        def xml(self, x):
+            xrandom = xml.dom.minidom.Element('Random')
+            xrandom.setAttribute('name', self.name)
+            xrandom.setAttribute('rate1', str(self.rate1))
+            xrandom.setAttribute('rate2', str(self.rate2))
+            xrandom.setAttribute('seed1', str(self.seed1))
+            xrandom.setAttribute('seed2', str(self.seed2))
+            x.appendChild(xrandom)
+    class PrescaledClock:
+        def __init__(self):
+            self.name = ''
+            self.clock1 = 0
+            self.clock2 = 0
+        def set(self, name, clock1, clock2):
+            self.name = name
+            self.clock1 = clock1
+            self.clock2 = clock2
+        def xml(self, x):
+            xpc = xml.dom.minidom.Element('PrescaledClock')
+            xpc.setAttribute('name',   self.name)
+            xpc.setAttribute('version', '1')
+            xpc.setAttribute('clock1', str(self.clock1))
+            xpc.setAttribute('clock2', str(self.clock2))
+            x.appendChild(xpc)
+    class Deadtime:
+        def __init__(self):
+            self.name = ''
+            self.simple = 0
+            self.complex1_rate = 0
+            self.complex1_level = 0
+            self.complex2_rate = 0
+            self.complex2_level = 0
+        def set(self, name, simple, complex1_rate, complex1_level, \
+                complex2_rate, complex2_level):
+            self.name = name
+            self.simple = simple
+            self.complex1_rate = complex1_rate
+            self.complex1_level = complex1_level
+            self.complex2_rate = complex2_rate
+            self.complex2_level = complex2_level
+        def xml(self, x):
+            xdt = xml.dom.minidom.Element('Deadtime')
+            xdt.setAttribute('name', self.name)
+            xdt.setAttribute('simple', str(self.simple))
+            xdt.setAttribute('complex1_rate', str(self.complex1_rate))
+            xdt.setAttribute('complex1_level', str(self.complex1_level))
+            xdt.setAttribute('complex2_rate', str(self.complex2_rate))
+            xdt.setAttribute('complex2_level', str(self.complex2_level))
+            xdt.setAttribute('version','1')
+            x.appendChild(xdt)
+    class BunchGroupSet:
+        class BunchGroup:
+            def __init__(self):
+                self.name = ''
+                self.internalNumber = 0
+                self.bunches = []
+            def set(self, name, internalNumber, bunches):
+                self.name = name
+                self.internalNumber = internalNumber
+                self.bunches = bunches
+            def xml(self, x):
+                xbg = xml.dom.minidom.Element('BunchGroup')
+                xbg.setAttribute('name', self.name)
+                xbg.setAttribute('version', '1')
+                xbg.setAttribute('internalNumber', str(self.internalNumber))
+                for b in self.bunches:
+                    xb = xml.dom.minidom.Element('Bunch')
+                    xb.setAttribute('bunchNumber', str(b))
+                    xbg.appendChild(xb)
+                x.appendChild(xbg)
+        def __init__(self):
+            self.name= ''
+            self.bunchGroups = []
+        def set(self, name):
+            self.name = name
+        def addBunchGroup(self, name, internalNumber, bunches):
+            bg = CTPInfo.BunchGroupSet.BunchGroup()
+            bg.set(name, internalNumber, bunches)
+            self.bunchGroups.append(bg)
+            return self
+        def xml(self, x):
+            xbgs = xml.dom.minidom.Element('BunchGroupSet')
+            xbgs.setAttribute('name', self.name)
+            xbgs.setAttribute('version','1')
+            for bg in self.bunchGroups:
+                bg.xml(xbgs)
+            x.appendChild(xbgs)
+    class TriggerType:
+        def __init__(self):
+            self.bits = [ 0, 0, 0, 0, 0, 0, 0, 0]
+        def setBit(self, bit, x):
+            if bit in range(0, 8):
+                self.bits[bit] = x
+            else:
+                logger().error('Warning: tried to access bit '+str(bit)+\
+                               " in LVL1 trigger type")
+        def xml(self, x):
+            xtt = xml.dom.minidom.Element('TriggerType')
+            text = 'TriggerType bits: each bit mapped to TriggerItem bit[255 <-> 0]'
+            c = xml.dom.minidom.Comment(text)
+            xtt.appendChild(c)
+            for bit in range(0, 8):
+                text = 'bit'+str(bit)
+                xbit = xml.dom.minidom.Element(text)
+                text = xml.dom.minidom.Text()
+                s0 = hex(self.bits[bit])
+                if s0.startswith('0x'): s0 = s0[2:]
+                if s0.endswith('L'): s0 = s0[:-1]
+                n = len(s0)
+                if n > 64:
+                    logger().error('TriggerType bit has more than 256 bits, '+len(s0))
+                    logger().error('Stripping off higher bits and save only least 256 bits')
+                    s0 = s0[n-64:]
+                elif n < 64:
+                    s1 = '0000000000000000000000000000000000000000000000000000000000000000'
+                    s1 = s1[n:]
+                    s0 = s1 + s0
+                s = ''
+                for i in range(0, 8):
+                    s += s0[i*8:(i+1)*8]
+                    if i != 7: s += ' '
+                text.replaceWholeText(s)
+                xbit.appendChild(text)
+                xtt.appendChild(xbit)
+            x.appendChild(xtt)
+    # Members of CTPInfo
+    def __init__(self):
+        self.random = CTPInfo.Random()
+        self.prescaledClock = CTPInfo.PrescaledClock()
+        self.deadtime = CTPInfo.Deadtime()
+        self.bunchGroupSet = CTPInfo.BunchGroupSet()
+        self.triggerType = CTPInfo.TriggerType()
+    def setRandom(self, name, rate1, rate2, seed1, seed2):
+        self.random.set(name, rate1, rate2, seed1, seed2)
+    def setPrescaledClock(self, name, clock1, clock2):
+        self.prescaledClock.set(name, clock1, clock2)
+    def setDeadtime(self, name, simple, complex1_rate, \
+                    complex1_level, complex2_rate, complex2_level):
+        self.deadtime.set(name, simple, complex1_rate, complex1_level, \
+                          complex2_rate, complex2_level)
+    def setBunchGroupSet(self, name):
+        self.bunchGroupSet.set(name)
+        return self.bunchGroupSet
+    def addBunchGroup(self, name, internalNumber, bunches):
+        self.bunchGroupSet.addBunchGroup(name, internalNumber, bunches)
+    def setTriggerType(self, bit, value):
+        self.triggerType.setBit(bit, value)
+    def xml(self, x):
+        self.random.xml(x)
+        self.deadtime.xml(x)
+        self.bunchGroupSet.xml(x)
+        self.prescaledClock.xml(x)
+        # self.triggerType.xml(x)
+
+class MuctpiInfo:
+    def __init__(self):
+        self.low_pt = 0
+        self.high_pt = 0
+        self.max_cand = 0
+    def set(self, low_pt, high_pt, max_cand):
+        self.low_pt = low_pt
+        self.high_pt = high_pt
+        self.max_cand = max_cand
+    def xml(self, xconfig):
+        xmuctpi = xml.dom.minidom.Element('MuctpiInfo')
+        low_pt = xml.dom.minidom.Element('low_pt')
+        text = xml.dom.minidom.Text()
+        text.replaceWholeText(str(self.low_pt))
+        low_pt.appendChild(text)
+        high_pt = xml.dom.minidom.Element('high_pt')
+        text = xml.dom.minidom.Text()
+        text.replaceWholeText(str(self.high_pt))
+        high_pt.appendChild(text)
+        max_cand = xml.dom.minidom.Element('max_cand')
+        text = xml.dom.minidom.Text()
+        text.replaceWholeText(str(self.max_cand))
+        max_cand.appendChild(text)
+        xmuctpi.setAttribute('name', 'muctpi')
+        xmuctpi.setAttribute('version', '1')
+        xmuctpi.appendChild(low_pt)
+        xmuctpi.appendChild(high_pt)
+        xmuctpi.appendChild(max_cand)
+        xconfig.appendChild(xmuctpi)
+
+class Lvl1CaloInfo:
+    AverageOfThr = 1
+    LowerThr = 2
+    HigherThr = 3
+    def __init__(self):
+        self.name = ''
+        self.globalScale = 1
+        self.jetWeights = [0]*12
+    def setName(self, name):
+        self.name = name
+    def setGlobalScale(self, x):
+        self.globalScale = x
+    def setJetWeights(self, weights):
+        self.jetWeights = weights
+    def calcJetWeights(lvl1_thresholds, option=AverageOfThr):
+        ws = []
+        thrvs = []
+        thrs = lvl1_thresholds.allThresholdsOf('JET')
+        for t in thrs:
+            thrvs.append(t.thresholdInGeV())
+        if option==Lvl1CaloInfo.AverageOfThr:
+            ws = thrvs
+        elif option==Lvl1CaloInfo.LowerThr:
+            ws = thrvs
+        elif option==Lvl1CaloInfo.HigherThr:
+            ws = thrvs
+        return ws
+    calcJetWeights = staticmethod(calcJetWeights)
+    def xml(self, x):
+        xcal = xml.dom.minidom.Element('CaloInfo')
+        xcal.setAttribute('global_scale', str(self.globalScale))
+        xcal.setAttribute('name', 'CaloInfo')
+        xcal.setAttribute('version', '1')
+        for (i, w) in enumerate(self.jetWeights):
+            jw = xml.dom.minidom.Element('JetWeight')
+            jw.setAttribute('num', str(i+1))
+            text = xml.dom.minidom.Text()
+            text.replaceWholeText(str(w))
+            jw.appendChild(text)
+            xcal.appendChild(jw)
+        x.appendChild(xcal)
+#
+# EOF LVL1 classes
+#########################################################################################
+
+
+
+#########################################################################################
+# HLT Chain classes
+#
+class HLTChain:
+    """ the HLT Chain definition class """
+    class HLTSignature:
+        """ HLT Signature, internal class of HLT Chain """
+        def __init__(self, telist, sigcounter, logic='1'):
+            self.sigcounter = sigcounter
+            if type(telist) != type([]):
+                self.tes    = [ telist ]
+            else:
+                self.tes    = telist
+            self.logic      = logic
+
+
+        def __eq__(self, other):
+            if self.tes == other.tes:
+                return True
+            return False
+
+        def multiplicity(self):
+            return len(self.tes)
+
+        def uniqueTEs(self):
+            return len(self.tes)
+
+        def xml(self, xlist):
+            if len(self.tes) != 0:
+                xSignature = xml.dom.minidom.Document().createElement('SIGNATURE')
+                xlist.appendChild(xSignature)
+                xSignature.setAttribute('logic','1')
+                xSignature.setAttribute('signature_counter', str(self.sigcounter))
+
+                for te in self.tes:
+                    if type(te) != type(''): # check if this is a string
+                        raise Exception("The trigger element: " + str(te) + " in the signature: " + self.sigcaounter + "is not a plain string" )
+                    xTriggerElement = xml.dom.minidom.Document().createElement('TRIGGERELEMENT')
+                    xTriggerElement.setAttribute('te_name', te)
+                    xSignature.appendChild(xTriggerElement)
+    # construction
+    def __init__(self, chain_name, chain_counter,
+                 lower_chain_name, level, prescale='1', pass_through='0', rerun_prescale='-1'):
+        self.chain_name       = chain_name
+        self.chain_counter  = chain_counter
+        self.level          = level
+        self.siglist        = []
+        self.prescale       = prescale
+        self.rerun_prescale = rerun_prescale
+        self.pass_through   = pass_through
+        self.lower_chain_name = lower_chain_name
+        self.stream_tag     = []
+        self.trigger_type_bits = []
+        self.groups           = []
+        self.chainBindings = []
+        self.chains_to_merge   = []
+        self.sigs_n_before_merge   = 0
+        
+    def addHLTSignature(self, telist, sigcounter=None, logic='1'):
+        if sigcounter is None:       # figure out sigcounter if not specified
+            if len(self.siglist) == 0:
+                sigcounter = 1
+            else:
+                sigcounter =  self.siglist[-1].sigcounter+1
+        else:
+            if  len(self.siglist) != 0:
+                if sigcounter >= self.siglist[-1].sigcounter:
+                    sigcounter =  self.siglist[-1].sigcounter+1
+                    
+        self.siglist.append( HLTChain.HLTSignature(telist, sigcounter, logic) )
+        return self
+
+    def getHLTSignatureOfStep(self, step):
+        """ Returns signature at given step
+
+        If no signature at given step is present then method recursively searches back.
+        If step 0 is reached and no signature is found then empty one is returned.
+        """
+        for sig in self.siglist:
+            if sig.sigcounter == step:
+                return sig
+        if step == 0:
+            return HLTChain.HLTSignature([], step)
+        else:
+            return self.getHLTSignatureOfStep(step -1)
+
+    def mergeAndAppendChains(self, chains_list):
+        """ Helps definig complex chains made out of other chains.
+
+        All chains from the chains_list are scanned and thier signatures are merged and appended to the list of existing signatures.
+        """
+        self.chains_to_merge = chains_list
+        self.sigs_n_before_merge = len(self.siglist)
+
+    def doChainsMerging(self):
+        if type(self.chains_to_merge) != type([]):
+            logger().error( "Not a chains list given to mergeAndAppendChains for chain: "+ self.chain_name+ " it is: "+ str(type(self.chains_to_merge)) )
+            raise Exception("Incorrect usage of: mergeAndAppendChains")
+
+        logger().debug("merging chains:"+str([ c.chain_name for c in self.chains_to_merge]))
+
+        copysigs = self.siglist
+        self.siglist = copysigs[0:self.sigs_n_before_merge]
+
+        # find out counter of last signature
+        last_counter = 1
+        if len(self.siglist) != 0:
+            last_counter = self.siglist[-1].sigcounter
+            logger().debug( "The chain: " + self.chain_name + " contains already signatures. Will align sinatures to it." )
+
+
+        max_counter = 0;
+        for chain in self.chains_to_merge:
+            if len(chain.siglist) != 0:
+                max_counter = max(chain.siglist[-1].sigcounter, max_counter)
+                logger().debug("Max counter in merged chains "+str(max_counter))
+            else:
+                logger().debug("Chain: "+ chain.chain_name + " is having empty signature list wil lbe ignored in merging")
+                del self.chains_to_merge[self.chains_to_merge.index(chain)]
+
+
+        # make dictionary with TE sigantures
+        for i in range(1, max_counter+1):
+            telist = []
+            [ telist.extend(x) for x in [chain.getHLTSignatureOfStep(i).tes for chain in self.chains_to_merge]] # repack TEs from other chain signatures
+            self.addHLTSignature(telist, sigcounter=i)
+
+        # now append all signatures which were added after merging
+        for sig in copysigs[self.sigs_n_before_merge:]:
+            max_counter = max_counter+1
+            self.addHLTSignature(sig.tes, sigcounter=max_counter)
+
+    def continueOn(self, chain):
+        self.siglist = chain.siglist
+        return self
+
+    def evaluateSignatureAfter(self, mySig, otherChain, otherChainSig):
+        """ Adds chain binding. Note that at this point action is only scheduled. Real work is done be alignChain method """
+        if type(otherChain) == type(''):
+            self.chainBindings.append( (mySig, otherChain, otherChainSig) )
+        else:
+            self.chainBindings.append( (mySig, otherChain.chain_name, otherChainSig) )
+#        self.alignChain(mySig, otherChain, otherChainSig)
+
+    def alignChain(self, mySig, otherChain, otherChainSigName ):
+        """ Changes internals of this chains and makes sure that selected signatures of other chain are evaluated first """
+        # check if any binding is required
+        if len(self.chainBindings) == 0:
+            return False
+
+        # find this chain signature
+        thisChainSig = filter(lambda x: x.tes == HLTChain.HLTSignature(mySig, 0).tes, self.siglist)
+        if len(thisChainSig) == 0:
+            logger().debug( "Chains binding ineffective (1), can't find signature: " + mySig + " in chain " + self.chain_name )
+            return False
+        thisChainSig = thisChainSig[0] # unpack it from list
+
+        # find sigcounter of the otherChainSig
+        otherChainSig = filter(lambda x: x.tes == HLTChain.HLTSignature(otherChainSigName, 0).tes, otherChain.siglist)
+        if len(otherChainSig) == 0:
+            logger().debug( "Chains binding ineffective (2), can't find signature: " + str(otherChainSigName) + " in chain " + otherChain.chain_name )
+            return False
+
+        otherChainSig = otherChainSig[0]
+
+        # fianlly we have both, check if we need to do anything
+        if thisChainSig.sigcounter > otherChainSig.sigcounter:
+            logger().debug( "Chains binding ineffective (3), signatures steps already ordered" )
+            return False
+
+        # and real work to be done here
+        counterShift = otherChainSig.sigcounter - thisChainSig.sigcounter + 1
+        for i in range (self.siglist.index(thisChainSig), len(self.siglist)):
+            self.siglist[i].sigcounter = self.siglist[i].sigcounter + counterShift
+            logger().debug( "Chains binding effective: signature: " + str(self.siglist[i].tes) + " will be shifted to step: "+ str(self.siglist[i].sigcounter) )
+        # true means that there was something to do
+        return True
+
+    def getOutputTEs(self):
+        tes = []
+        for sig in self.siglist[1:]:
+            tes.extend(sig.tes)
+        return tes
+
+    def isL2(self):
+        if self.level == "L2":
+            return True
+        else:
+            return False
+
+    def isEF(self):
+        if self.level == "EF":
+            return True
+        else:
+            return False
+
+    def addTriggerTypeBit(self, bit):
+        self.trigger_type_bits.append(bit)
+
+    def addStreamTag(self, stream, type="physics", obeyLB="yes", prescale='1'):
+        self.stream_tag.append( (stream, type, obeyLB, prescale) )
+
+    def addGroup(self, name ):
+        if type(name) == type(''):
+            self.groups += [name]
+        if type(name) == type([]):
+            self.groups += name
+
+    def xml(self, xChainList):
+        """ Returns XML representation of this chain """
+        xChain = xml.dom.minidom.Document().createElement('CHAIN')
+        xChainList.appendChild(xChain)
+
+        xChain.setAttribute('chain_name', self.chain_name)
+        xChain.setAttribute('chain_counter', self.chain_counter)
+        xChain.setAttribute('lower_chain_name', self.lower_chain_name)
+        xChain.setAttribute('level', self.level)
+        xChain.setAttribute('prescale', self.prescale)
+        xChain.setAttribute('pass_through', self.pass_through)
+        xChain.setAttribute('rerun_prescale', self.rerun_prescale)
+
+
+        xTriggerTypeList = xml.dom.minidom.Document().createElement('TRIGGERTYPE_LIST')
+        xChain.appendChild(xTriggerTypeList)
+
+
+        for bit in self.trigger_type_bits:
+            xTriggerType = xml.dom.minidom.Document().createElement('TRIGGERTYPE')
+            xTriggerType.setAttribute('bit', str(bit))
+            xTriggerTypeList.appendChild(xTriggerType)
+
+        xStreamTagList =  xml.dom.minidom.Document().createElement('STREAMTAG_LIST')
+        xChain.appendChild(xStreamTagList)
+
+        for stream in self.stream_tag:
+            xStreamTag = xml.dom.minidom.Document().createElement('STREAMTAG')
+            xStreamTag.setAttribute('stream', stream[0])
+            xStreamTag.setAttribute('type', stream[1])
+            xStreamTag.setAttribute('obeyLB', stream[2])
+            xStreamTag.setAttribute('prescale', str(stream[3]))
+            xStreamTagList.appendChild(xStreamTag)
+
+
+        xGroupList = xml.dom.minidom.Document().createElement('GROUP_LIST')
+        xChain.appendChild(xGroupList)                                             
+        for g in self.groups:
+            xGroup = xml.dom.minidom.Document().createElement('GROUP')
+            xGroup.setAttribute('name', g)
+            xGroupList.appendChild(xGroup)
+            
+        xSignatureList = xml.dom.minidom.Document().createElement('SIGNATURE_LIST')
+        xChain.appendChild(xSignatureList)
+        for sig in self.siglist:
+            sig.xml(xSignatureList)
+
+
+
+#
+# EOF Chain classes
+#########################################################################################
+
+
+#########################################################################################
+# HLT Sequence
+#
+class HLTSequence:
+    def __init__(self, inputTEs, algos, outputTE, topo_starts_from):
+        """HLT Steering Sequence class constructor
+
+
+        inputTEs argument is a one or list of names TEs for the sequence,
+        if empty string is passed then sequence is considered as UNSEEDED
+        algos is one or list of algo instances
+
+        """
+        if type(inputTEs) == type(""):
+            self.input  = [ inputTEs ]
+        else:
+            self.input  = inputTEs
+
+        # make algos always to be alist of ... something ...
+        if type(algos) != type([]):
+            algos = [ algos ]
+        from AthenaCommon.Configurable import ConfigurableAlgorithm
+        self.algs = []
+        for alg in algos:
+            if type(alg) == type(""): # plain string
+                self.algs.append( alg );
+            elif issubclass(type(alg), ConfigurableAlgorithm): # configurable given to us
+                self.algs.append(alg.getFullName())
+        self.output = outputTE
+        self.topo_starts_from = topo_starts_from
+
+        self.__used = None
+
+    def used(self):
+        return self.__used
+
+    def use(self, level):
+        if level == 'L2' or level == 'EF':
+            self.__used = level
+        else:
+            raise Exception('setting for the sequence level to incorrect value: '+str(level))
+
+    def __str__(self):
+        return str(self.input)+" -> "+ str(self.algs)+" -> "+self.output
+
+    def xml(self, xlist):
+        """Generates piece of XML used to configure HLT Steering"""
+        if not self.used():
+            return
+        
+        #logger().info('doing seq: ' + self.output)
+        #print 'doing seq: ' + self.output + str(self.input)
+        xSequence = xml.dom.minidom.Document().createElement('SEQUENCE')
+        xSequence.setAttribute('input', reduce(lambda x,y: x+' '+y, self.input))
+        xSequence.setAttribute('output', self.output)
+        xSequence.setAttribute('algorithm', reduce(lambda x,y: x+' '+y, self.algs))
+        if self.topo_starts_from!= None:
+            xSequence.setAttribute('topo_start_from', self.topo_starts_from)  
+        xlist.appendChild(xSequence)
+
+    def dot(self, algs=True):
+        if not self.used():
+            return ''
+        #example EM10_1 -> em10t2calo_1  [label="T2Calo,\n T2Hypo10"]        
+        line = ''
+        for i in self.input:
+            if i == '':
+                line += '"UNSEEDED"  [style=filled, fillcolor=blue]\n'
+                line += 'UNSEEDED'
+            else:
+                line += '"'+i+'"'
+            line += ' -> ' + '"' + self.output + '"'
+            if algs:
+                line += ' [label="' + reduce(lambda x,y: x+'\\n '+y, self.algs) + '"]'
+            line += '\n'
+        return line
+    
+#
+# EOF Sequences
+#########################################################################################
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerSummary.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerSummary.py
new file mode 100644
index 0000000000000000000000000000000000000000..0b95ab1f81327b070e1e6766ef0c8d629a04f05f
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/TriggerSummary.py
@@ -0,0 +1,482 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+# @author: Till Eifert <Till.Eifert@cern.ch>
+# @date:   October 2008
+#
+# Note, parts of this file are copied from S. Binet's PoolFile.py
+
+__version__ = "$Revision: 1.2 $"
+__author__  = "Till Eifert <Till.Eifert@cern.ch>"
+
+import sys, os
+import shelve, whichdb
+#from Helpers import ShutUp
+#from Decorators import forking
+
+
+
+class PoolOpts(object):
+    FAST_MODE   = False
+    READ_MODE   = "READ"
+    POOL_HEADER = "POOLContainer_"
+    EVENT_DATA  = "CollectionTree"
+    META_DATA   = "MetaData"
+    HDR_FORMAT  = "%5s %5s     %-15s %s"
+    ROW_FORMAT  = "%5i  %4s   %-30s   %5i     %5i          %5i"
+    ROW_FORMAT_GLOBAL = "       %4s   %-30s   %5i"
+
+    L1_GLOBAL   = "Global LVL1"
+    L2_GLOBAL   = "Global LVL2"
+    EF_GLOBAL   = "Global EF (LVL3)"
+
+    level = ['None', 'LVL1', 'LVL2', 'EF']
+
+    @classmethod
+    def isData(cls, name):
+        return ( len(name) >= len("##") and name[:2] != "##" ) and \
+               ( name != PoolOpts.POOL_HEADER )
+
+    @classmethod
+    def isDataHeader(cls, name):
+        return name == PoolOpts.POOL_HEADER+"DataHeader"
+
+    @classmethod
+    def isEventData(cls, name):
+        return len(name) >= len(PoolOpts.EVENT_DATA) and \
+               name[:len(PoolOpts.EVENT_DATA)] == PoolOpts.EVENT_DATA
+
+    pass # class PoolOpts
+
+
+
+class PoolRecord(object):
+    """
+    """
+    class Sorter:
+        name    = "name"
+        counter = "counter"
+        evtsBeforePS = "evtsBeforePS"
+        evtsAfterPS = "evtsAfterPS"
+        evtsAfterPT = "evtsAfterPT"
+
+        @staticmethod
+        def allowedValues():
+            return [ PoolRecord.Sorter.name,
+                     PoolRecord.Sorter.counter,
+                     PoolRecord.Sorter.evtsBeforePS,
+                     PoolRecord.Sorter.evtsAfterPS,
+                     PoolRecord.Sorter.evtsAfterPT,]
+        pass
+    def __init__(self, name, counter, evtsBeforePS, evtsAfterPS, evtsAfterPT, level):
+        object.__init__(self)
+        self.name          = name
+        self.counter       = counter
+        self.evtsBeforePS  = evtsBeforePS
+        self.evtsAfterPS   = evtsAfterPS
+        self.evtsAfterPT   = evtsAfterPT
+        self.level         = level
+        return
+
+
+class PoolFile(object):
+    """
+    A simple class to retrieve informations about the content of a POOL file.
+    It should be abstracted from the underlying technology used to create this
+    POOL file (Db, ROOT,...).
+    Right now, we are using the easy and loosy solution: going straight to the
+    ROOT 'API'.
+    """
+
+    def __init__(self, fileName):
+        object.__init__(self)
+
+        self._fileInfos = None
+        self.keys       = None
+        self.dataHeader = None
+        # trigger stuff
+        self.trigConf   = None
+        self.l1_global  = None
+        self.l1_items   = []
+        self.l2_global  = None
+        self.l2_chains  = []
+        self.ef_global  = None
+        self.ef_chains  = []
+
+        self.poolFile = None
+        dbFileName = whichdb.whichdb( fileName )
+        if not dbFileName in ( None, '' ):
+            print "## opening file [%s]..." % str(fileName)
+            db = shelve.open( fileName, 'r' )
+            print "## opening file [OK]"
+            report = db['report']
+            self._fileInfos = report['fileInfos']
+
+            self.l1_items   = report['l1_data']
+            self.l2_chains  = report['l2_data']
+            self.ef_chains  = report['ef_data']
+            self.l1_global   = report['l1_global']
+            self.l2_global   = report['l2_global']
+            self.ef_global   = report['ef_global']
+        else:
+            print "## opening file [%s]..." % str(fileName)
+            self.__openPoolFile( fileName )
+            print "## opening file [OK]"
+            self.__processFile()
+
+        return
+
+    def __openPoolFile(self, fileName):
+        # hack to prevent ROOT from loading graphic libraries and hence bother
+        # our fellow Mac users
+        oldArgs = sys.argv
+        sys.argv = sys.argv[:1] + ['-b'] + sys.argv[1:]
+        print "## importing ROOT..."
+        import ROOT
+        print "## importing ROOT... [DONE]"
+        # prevent ROOT from being too verbose
+        #rootMsg = ShutUp()
+        #rootMsg.mute()
+        ROOT.gErrorIgnoreLevel = ROOT.kFatal
+        #rootMsg.unMute()
+        sys.argv = oldArgs
+
+        #import PyCintex
+        #PyCintex.Cintex.Enable()
+
+        #rootMsg.mute()
+        poolFile = None
+        try:
+            #ROOT.TFile.SetReadStreamerInfo(False)
+            poolFile = ROOT.TFile.Open( fileName, PoolOpts.READ_MODE )
+        except Exception, e:
+            rootMsg.unMute()
+            print "## Failed to open file [%s] !!" % fileName
+            print "## Reason:"
+            print e
+            print "## Bailing out..."
+            raise IOError, "Could not open file [%s]" % fileName
+
+        #rootMsg.unMute()
+
+        if poolFile == None:
+            print "## Failed to open file [%s] !!" % fileName
+            msg = "Could not open file [%s]" % fileName
+            raise IOError, msg
+
+        self.poolFile = poolFile
+        assert self.poolFile.IsOpen() and not self.poolFile.IsZombie(), "Invalid POOL file or a Zombie one" 
+        self._fileInfos = {
+            'name' : self.poolFile.GetName(),
+            'size' : self.poolFile.GetSize()
+            }
+        return
+
+    def __setupDataStructure(self):
+        self.l1_global = PoolRecord( name=PoolOpts.L1_GLOBAL, counter=-1, evtsBeforePS=0, evtsAfterPS=0,
+                                     evtsAfterPT=0, level=PoolOpts.level[1] )
+
+        self.l2_global = PoolRecord( name=PoolOpts.L2_GLOBAL, counter=-1, evtsBeforePS=0, evtsAfterPS=0,
+                                     evtsAfterPT=0, level=PoolOpts.level[2] )
+
+        self.ef_global = PoolRecord( name=PoolOpts.EF_GLOBAL, counter=-1, evtsBeforePS=0, evtsAfterPS=0,
+                                     evtsAfterPT=0, level=PoolOpts.level[3] )
+
+        # access to L1 TriggerItems through trigConf.L1Items
+        for (name,item) in self.trigConf.L1Items.items():
+            self.l1_items += [PoolRecord(name=name, counter=item.ctpId(), evtsBeforePS=0, evtsAfterPS=0,
+                                         evtsAfterPT=0, level=PoolOpts.level[1]) ]
+
+        # access to HLT chains through trigConf.L1Items
+        for (name,chain) in self.trigConf.HLTChains.items():
+            if chain.level() == 'L2':
+                self.l2_chains += [PoolRecord(name=name, counter=chain.chain_counter(), evtsBeforePS=0, evtsAfterPS=0, \
+                                              evtsAfterPT=0, level=PoolOpts.level[2]) ]
+            elif chain.level() == 'EF':
+                self.ef_chains += [PoolRecord(name=name, counter=chain.chain_counter(), evtsBeforePS=0, evtsAfterPS=0, \
+                                              evtsAfterPT=0, level=PoolOpts.level[3]) ]
+            else:
+                print "will ignore chain (%s, %i) because the trigger level (=%s) is not set to either 'L2' or 'EF'" \
+                      % ( name, chain.chain_counter(), chain.level())
+
+
+        return
+
+    def __processFile(self):
+
+        ## first we try to fetch the DataHeader
+        treeNames = [k.GetName() for k in self.poolFile.GetListOfKeys()]
+        if "POOLContainer" in treeNames:
+            name  = "POOLContainer" # new format
+        else:
+            name  = "POOLContainer_DataHeader" # old format
+        dhKey = self.poolFile.FindKey( name )
+        nEntries = dhKey.ReadObj().GetEntries()
+        self._fileInfos['entries'] = nEntries
+
+        ## next, try to get the trigger configuration from the MetaData TTree
+        print "## Reading trigger configuration from MetaData ..."
+        from TrigConfigSvc.TriggerConfigARA import TriggerConfigARA
+        try:
+            self.trigConf = TriggerConfigARA(self.poolFile)
+        except Exception, e:
+            print "## Caught exception [%s] !!" % str(e.__class__)
+            print "## What:",e
+            print sys.exc_info()[0]
+            print sys.exc_info()[1]
+            pass
+        print "## Reading trigger configuration from MetaData ... [DONE]"
+
+        ## get the transient tree
+        print "## Creating transient collection tree  ..."
+        import PyCintex
+        import AthenaROOTAccess.transientTree
+        def filter(dhe):
+            if 'HLTResult' in dhe.token() or 'TrigDecision' in dhe.token() or 'EventInfo' in dhe.token():
+                print '+', dhe.token()
+                return dhe
+            return False
+
+
+
+
+        branchNames = {}
+        transientTree = AthenaROOTAccess.transientTree.makeTree(self.poolFile, branchNames = branchNames, dhfilt=filter)
+        print "## Creating transient collection tree  ... [DONE]"
+
+        # figure out the name of the EventInfo branch (this may change from MC to MC and DATA)
+        eventInfoBranchName = 'McEventInfo'
+        possible = [ (b.GetClassName(), b.GetName()) for b in transientTree.GetListOfBranches() if b.GetClassName() == 'EventInfo']
+        if len(possible) == 1:
+            eventInfoBranchName = possible[0][1]
+        del possible
+
+        from TrigSteering.Chain import Chain
+
+
+        ## Branches that we're interested in: 
+        EventInfo_br    = transientTree.GetBranch(eventInfoBranchName)        
+        TrigDecision_br = transientTree.GetBranch("TrigDecision")
+
+        print "## Looping over all events now ..."
+        isFirstEvent = True
+        for i in xrange(transientTree.GetEntries()):
+            if EventInfo_br.GetEntry(i) <= 0 or TrigDecision_br.GetEntry(i) <= 0 :
+                print ":: could not get entry #%i" % i
+                break
+            # update the trig conf. with these numbers:
+            
+            #eventID = eval('transientTree.'+eventInfoBranchName+'.event_ID()')
+            ei = getattr(transientTree, eventInfoBranchName)
+            eventID  = ei.event_ID()
+            self.trigConf.update(eventID.run_number(), eventID.lumi_block())
+
+            ## FIRST EVENT -> setup data structure
+            if isFirstEvent:
+                isFirstEvent = False
+                self.__setupDataStructure()
+
+            ## global trigger status
+            l1 = transientTree.TrigDecision.getL1Result()
+            l2 = transientTree.TrigDecision.getL2Result()
+            ef = transientTree.TrigDecision.getEFResult()
+
+            self.l1_global.evtsAfterPT += l1.isAccepted()
+            self.l2_global.evtsAfterPT += l2.isAccepted()
+            self.ef_global.evtsAfterPT += ef.isAccepted()
+
+            ## LVL1 items
+            for l1_item in self.l1_items:
+                l1_item.evtsBeforePS += l1.isPassedBeforePrescale( l1_item.counter )
+                l1_item.evtsAfterPS  += l1.isPassedAfterPrescale ( l1_item.counter )
+                l1_item.evtsAfterPT  += l1.isPassedAfterVeto     ( l1_item.counter )
+
+            ## LVL2 chains
+            l2_chains = l2.getChainResult()
+            l2Chains = {}
+            for i in range(l2_chains.size()):
+                aChain = Chain( l2_chains[i] )
+                l2Chains[aChain.getChainCounter()] =  aChain
+
+            for chain in self.l2_chains:
+                if not l2Chains.has_key(chain.counter):
+                    continue
+                if l2Chains[ chain.counter ].chainPassedRaw():
+                    chain.evtsBeforePS += 1
+                    if not l2Chains[ chain.counter ].isPrescaled():
+                        chain.evtsAfterPS  += 1
+                if l2Chains[ chain.counter ].chainPassed():
+                    chain.evtsAfterPT  += 1
+
+            ## EF chains
+            ef_chains = ef.getChainResult()
+            efChains = {}
+            for i in range(ef_chains.size()):
+                aChain = Chain( ef_chains[i] )
+                efChains[aChain.getChainCounter()] =  aChain
+
+            for chain in self.ef_chains:
+                if not efChains.has_key(chain.counter):
+                    continue
+                if efChains[ chain.counter ].chainPassedRaw():
+                    chain.evtsBeforePS += 1
+                    if not efChains[ chain.counter ].isPrescaled():
+                        chain.evtsAfterPS  += 1
+                if efChains[ chain.counter ].chainPassed():
+                    chain.evtsAfterPT  += 1
+
+
+
+
+        print "## Looping over all events ... [DONE]"
+
+        return
+
+
+    def fileInfos(self):
+        return os.linesep.join( [
+            "File:" + self._fileInfos['name'],
+            "Size: %12.3f kb" % (self._fileInfos['size'] / 1e3),
+            "Nbr Events: %i" % self._fileInfos['entries']
+            ] )
+
+    def checkFile(self, sorting = PoolRecord.Sorter.name):
+        print self.fileInfos()
+        print ""
+        print "Trigger configuration summary:"
+        print self.trigConf
+
+        ## sorting data
+        if sorting in PoolRecord.Sorter.allowedValues():
+            import operator
+            data1 = self.l1_items
+            data1.sort(key = operator.attrgetter(sorting) )
+            data2 = self.l2_chains
+            data2.sort(key = operator.attrgetter(sorting) )
+            data3 = self.ef_chains
+            data3.sort(key = operator.attrgetter(sorting) )
+
+        print ""
+        print "="*80
+        print PoolOpts.HDR_FORMAT % ( "ID",
+                                      "level",
+                                      "Trigger name",
+                                      "Passed events:   raw, after PS, after PT/Veto")
+        print "="*80
+        for item in [self.l1_global, self.l2_global, self.ef_global]:
+            print PoolOpts.ROW_FORMAT_GLOBAL % (
+                item.level,
+                item.name,
+                item.evtsAfterPT
+                )
+
+        print "-"*80
+        for item in self.l1_items:
+            print PoolOpts.ROW_FORMAT % (
+                item.counter,
+                item.level,
+                item.name,
+                item.evtsBeforePS, item.evtsAfterPS,
+                item.evtsAfterPT
+                )
+        print "-"*80
+        for chain in self.l2_chains:
+            print PoolOpts.ROW_FORMAT % (
+                chain.counter,
+                chain.level,
+                chain.name,
+                chain.evtsBeforePS, chain.evtsAfterPS,
+                chain.evtsAfterPT
+                )
+        print "-"*80
+        for chain in self.ef_chains:
+            print PoolOpts.ROW_FORMAT % (
+                chain.counter,
+                chain.level,
+                chain.name,
+                chain.evtsBeforePS, chain.evtsAfterPS,
+                chain.evtsAfterPT
+                )
+        print "="*80
+
+        return
+
+    def saveReport (self, fileName):
+        """
+        Save all the gathered informations into a python shelve or a CSV file
+        (depending on the @param `fileName` extension)
+        """
+        import os
+        if os.path.splitext(fileName)[-1] == '.csv':
+            return self._save_csv_report (fileName)
+        return self._save_shelve_report (fileName)
+
+    def _save_shelve_report(self, fileName):
+        """
+        Save all the gathered informations into a python shelve
+        Data can then be read like so:
+         >>> import shelve
+         >>> db = shelve.open( 'myfile.dat', 'r' )
+         >>> report = db['report']
+         >>> print 'fileSize:',report['fileSize']
+         >>> print 'dataHeader/memSize:',report['dataHeader'].memSize
+         >>> for d in report['data']:
+         ...   print 'data:',d.name,d.nEntries,d.memSize
+        """
+        import shelve, os
+        if os.path.exists (fileName):
+            os.unlink (fileName)
+        db = shelve.open (fileName)
+        db['report'] = {
+            'fileInfos'  : self._fileInfos,
+            'l1_global'       : self.l1_global,
+            'l2_global'       : self.l2_global,
+            'ef_global'       : self.ef_global,
+            'l1_data'       : self.l1_items,
+            'l2_data'       : self.l2_chains,
+            'ef_data'       : self.ef_chains
+            }
+        db.close()
+        return
+
+    def _save_csv_report(self, fileName):
+        """
+        Save all the gathered informations into a CSV file
+        """
+        import csv, os
+        if os.path.exists (fileName):
+            os.unlink (fileName)
+        o = csv.writer (open (fileName, 'w'))
+        nentries = self._fileInfos['entries']
+        map (o.writerow,
+             [ ['file name', self._fileInfos['name']],
+               ['file size', self._fileInfos['size']],
+               ['nbr evts',  self._fileInfos['entries']],
+               ['counter', 'level', 'name', 'evtsBeforePS',
+                'evtsAfterPS', 'evtsAfterPT'],
+               ])
+        map (o.writerow,
+             [ [d.counter, d.level, d.name,
+                d.evtsBeforePS, d.evtsAfterPS, d.evtsAfterPT]
+               for d in self.l1_items ])
+        map (o.writerow,
+             [ [d.counter, d.level, d.name,
+                d.evtsBeforePS, d.evtsAfterPS, d.evtsAfterPT]
+               for d in self.l2_chains ])
+        map (o.writerow,
+             [ [d.counter, d.level, d.name,
+                d.evtsBeforePS, d.evtsAfterPS, d.evtsAfterPT]
+               for d in self.ef_chains ])
+        return
+
+
+
+    def __del__(self):
+        if self.poolFile and hasattr(self.poolFile, 'Close'):
+            try:
+                self.poolFile.Close()
+                self.poolFile = None
+            except Exception,err:
+                print "WARNING:",err
+                pass
+
+    pass # class PoolFile
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/python/__init__.py b/Trigger/TrigConfiguration/TrigConfigSvc/python/__init__.py
new file mode 100755
index 0000000000000000000000000000000000000000..7c2ce6d15052d441ff82c306f2f72e9f6c76b5ec
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/python/__init__.py
@@ -0,0 +1,7 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+# File: TrigConfigSvc/__init__.py
+# Author: Tomasz.Bold@cern.ch
+  
+__author__  = 'Paul Bell, Tomasz Bold, Joerg Stelzer'
+__all__ = [ 'TrigConfigSvcConfig', 'TriggerConfigARA', 'TrigConfigSvcUtils.py', 'DoDBConfig.py' ]
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/L1config-example.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/L1config-example.py
new file mode 100755
index 0000000000000000000000000000000000000000..071add86a0c79abe12294a08e5fe77e3dc855375
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/L1config-example.py
@@ -0,0 +1,368 @@
+#!/usr/bin/env python
+
+import os
+import sys
+from TriggerMenuConfig.TriggerPythonConfig import *
+
+tm = TriggerPythonConfig('hlt.xml', 'LVL1Config-CSC05.xml')
+
+#===========================================================================
+# TriggerThresholds
+#------------------
+# arguments to addLvl1Threshold()
+# addLvl1Threshold(name, type, bitnum, range_begin, range_end,
+#                  slot, connector)
+#
+# To Switch off the threshold set following constants for each type of
+# threshold
+# ClusterOff   (= 255)
+# IsolationOff (= 63)
+# JetOff       (= 1023)
+# EtSumOff     (= 2047)
+# EtMissOff    (= 2895)
+# JetEtOff     (= 13286)
+#
+#----- MUON thresholds -----
+mu6 = tm.addLvl1Threshold('MU6', 'MUON', 0,'SLOT9','CON0')\
+      .addMuonThresholdValue(6, -49, 49, 0, 64)
+mu8 = tm.addLvl1Threshold('MU8', 'MUON', 1,'SLOT9','CON0')\
+      .addMuonThresholdValue(8, -49, 49, 0, 64)
+mu10 = tm.addLvl1Threshold('MU10', 'MUON', 2,'SLOT9','CON0')\
+       .addMuonThresholdValue(10, -49, 49, 0, 64)
+mu11 = tm.addLvl1Threshold('MU11', 'MUON', 3,'SLOT9','CON0')\
+       .addMuonThresholdValue(12, -49, 49, 0, 64)
+mu20 = tm.addLvl1Threshold('MU20','MUON', 4,'SLOT9','CON0')\
+       .addMuonThresholdValue(20, -49, 49, 0, 64)
+mu40 = tm.addLvl1Threshold('MU40','MUON', 5,'SLOT9','CON0')\
+       .addMuonThresholdValue(40, -49, 49, 0, 64)
+#----- EM thresholds -----
+em1 = tm.addLvl1Threshold('EM1', 'EM', 0, 'SLOT7', 'CON1')\
+      .addEMThresholdValue(7, -49, 49, 0, 64,\
+                           IsolationOff,IsolationOff,IsolationOff)
+em11 = tm.addLvl1Threshold('EM11', 'EM', 1, 'SLOT7', 'CON1')\
+       .addEMThresholdValue(11, -49, 49, 0, 64, \
+                            IsolationOff,IsolationOff,IsolationOff)
+em11i = tm.addLvl1Threshold('EM11I', 'EM', 2, 'SLOT7', 'CON1')\
+        .addEMThresholdValue(11, -49, 49, 0, 64, 3, 2, 2)
+em18 = tm.addLvl1Threshold('EM18', 'EM', 3, 'SLOT7', 'CON1')\
+       .addEMThresholdValue(18, -49, 49, 0, 64, \
+                            IsolationOff,IsolationOff,IsolationOff)
+em18i = tm.addLvl1Threshold('EM18I', 'EM', 4, 'SLOT7', 'CON1')\
+        .addEMThresholdValue(18, -49, 49, 0, 64, 3, 2, 2)
+em50 = tm.addLvl1Threshold('EM50', 'EM', 5, 'SLOT7', 'CON1')\
+       .addEMThresholdValue(50, -49, 49, 0, 64, \
+                            IsolationOff,IsolationOff,IsolationOff, 1)
+#----- TAU thresholds -----
+tau5 = tm.addLvl1Threshold('TAU5', 'TAU', 0, 'SLOT7', 'CON2')\
+       .addTauThresholdValue(5, -49, 49, 0, 64, \
+                             IsolationOff, IsolationOff, IsolationOff)
+tau8 = tm.addLvl1Threshold('TAU8', 'TAU', 1, 'SLOT7', 'CON2')\
+       .addTauThresholdValue(8, -49, 49, 0, 64, \
+                             IsolationOff, IsolationOff, IsolationOff)
+tau8i = tm.addLvl1Threshold('TAU8I', 'TAU', 2, 'SLOT7', 'CON2')\
+        .addTauThresholdValue(8, -49, 49, 0, 64, \
+                              5, IsolationOff, IsolationOff)
+tau13 = tm.addLvl1Threshold('TAU13', 'TAU', 3, 'SLOT7', 'CON2')\
+        .addTauThresholdValue(13, -49, 49, 0, 64, \
+                              IsolationOff, IsolationOff, IsolationOff)
+tau13i = tm.addLvl1Threshold('TAU13I', 'TAU', 4, 'SLOT7', 'CON2')\
+         .addTauThresholdValue(13, -49, 49, 0, 64, \
+                               5, IsolationOff, IsolationOff)
+tau17i = tm.addLvl1Threshold('TAU17I', 'TAU', 5, 'SLOT7', 'CON2')\
+         .addTauThresholdValue(17, -49, 49, 0, 64, \
+                               6, IsolationOff, IsolationOff)
+tau22i = tm.addLvl1Threshold('TAU22I', 'TAU', 6, 'SLOT7', 'CON2')\
+         .addTauThresholdValue(17, -49, 49, 0, 64,
+                               6, IsolationOff, IsolationOff)
+tau30i = tm.addLvl1Threshold('TAU30I', 'TAU', 7, 'SLOT7', 'CON2')\
+         .addTauThresholdValue(30, -49, 49, 0, 64, \
+                               6, IsolationOff, IsolationOff)
+
+#----- JET thresholds -----
+jet15 = tm.addLvl1Threshold('JET15', 'JET', 0, 'SLOT8', 'CON0')\
+        .addJetThresholdValue(15, -49, 49, 0, 64, 8)
+jet20 = tm.addLvl1Threshold('JET20', 'JET', 1, 'SLOT8', 'CON0')\
+        .addJetThresholdValue(20, -49, 49, 0, 64, 8)
+jet25 = tm.addLvl1Threshold('JET25', 'JET', 2, 'SLOT8', 'CON0')\
+        .addJetThresholdValue(25, -49, 49, 0, 64, 8)
+jet35 = tm.addLvl1Threshold('JET35', 'JET', 3, 'SLOT8', 'CON0')\
+        .addJetThresholdValue(35, -49, 49, 0, 64, 8)
+jet55 = tm.addLvl1Threshold('JET55', 'JET', 4, 'SLOT8', 'CON0')\
+        .addJetThresholdValue(55, -49, 49, 0, 64, 8)
+jet4 = tm.addLvl1Threshold('JET4', 'JET', 5, 'SLOT8', 'CON0')\
+       .addJetThresholdValue(4, -49, 49, 0, 64, 4)
+#----- FJET thresholds -----
+jb10 = tm.addLvl1Threshold('JB10', 'JB', 0,'SLOT8','CON1')\
+        .addJetThresholdValue(JetOff, -49, 49, 0, 64, 8, 1)\
+        .addJetThresholdValue(10, -49, 0, 0, 64, 8, 2)
+jf10 = tm.addLvl1Threshold('JF10','JF',0,'SLOT8','CON1')\
+        .addJetThresholdValue(JetOff, -49, 49, 0, 64, 8, 1)\
+        .addJetThresholdValue(10, 0, 49, 0, 64, 8, 2)
+jb20 = tm.addLvl1Threshold('JB20', 'JB',1,'SLOT8','CON1')\
+        .addJetThresholdValue(JetOff, -49, 49, 0, 64, 8, 1)\
+        .addJetThresholdValue(20, -49, 0, 0, 64, 8, 2)
+jf20 = tm.addLvl1Threshold('JF20','JF',1,'SLOT8','CON1')\
+        .addJetThresholdValue(JetOff, -49, 49, 0, 64, 8, 1)\
+        .addJetThresholdValue(20, 0, 49, 0, 64, 8, 2)
+#----- TE thresholds -----
+xe20 = tm.addLvl1Threshold('XE20', 'XE', 0, 'SLOT8', 'CON2')\
+       .addEnergyThresholdValue(20, -49, 49, 0, 64)
+xe30 = tm.addLvl1Threshold('XE30', 'XE', 1, 'SLOT8', 'CON2')\
+       .addEnergyThresholdValue(30, -49, 49, 0, 64)
+xe40 = tm.addLvl1Threshold('XE40', 'XE', 2, 'SLOT8', 'CON2')\
+       .addEnergyThresholdValue(40, -49, 49, 0, 64)
+xe50 = tm.addLvl1Threshold('XE50', 'XE', 3, 'SLOT8', 'CON2')\
+       .addEnergyThresholdValue(50, -49, 49, 0, 64)
+xe100 = tm.addLvl1Threshold('XE100', 'XE', 4, 'SLOT8', 'CON2')\
+        .addEnergyThresholdValue(100, -49, 49, 0, 64)
+xe200 = tm.addLvl1Threshold('XE200', 'XE', 5, 'SLOT8', 'CON2')\
+        .addEnergyThresholdValue(200, -49, 49, 0, 64)
+#----- XE thresholds -----
+xe30 = tm.addLvl1Threshold('XE30', 'XE', 6, 'SLOT8', 'CON2')\
+       .addEnergyThresholdValue(30, -49, 49, 0, 64)
+
+#===========================================================================
+# TriggerConditions
+#------------------
+cond_1mu6 = mu6.condition(1)
+cond_1mu8 = mu8.condition(1)
+cond_1mu10 = mu10.condition(1)
+cond_1mu11 = mu11.condition(1)
+cond_1mu20 = mu20.condition(1)
+cond_1mu40 = mu40.condition(1)
+cond_2mu6 = mu6.condition(2)
+cond_2mu8 = mu8.condition(2)
+cond_2mu10 = mu10.condition(2)
+cond_2mu11 = mu11.condition(2)
+cond_2mu20 = mu20.condition(2)
+cond_2mu40 = mu40.condition(2)
+
+cond_1j15 = jet15.condition(1)
+cond_1j20 = jet20.condition(1)
+cond_2j20 = jet20.condition(2)
+cond_3j20 = jet20.condition(3)
+cond_4j20 = jet20.condition(4)
+cond_1fj10_left = jb10.condition(1)
+cond_1fj10_right = jf10.condition(1)
+cond_1bj15 = jet4.condition(1)
+
+cond_1em1 = em1.condition(1)
+cond_2em11 = em11.condition(2)
+cond_2em11i = em11i.condition(2)
+cond_1em18 = em18.condition(1)
+cond_1em18i = em18i.condition(1)
+cond_1em50 = em50.condition(1)
+
+cond_1tau17i = tau17i.condition(1)
+cond_xe30 = xe30.condition()
+cond_1jet55 = jet55.condition(5)
+
+cond_xe30 = xe30.condition(1)
+cond_xe40 = xe40.condition(1)
+cond_xe50 = xe50.condition(1)
+cond_xe100 = xe100.condition(1)
+cond_xe200 = xe200.condition(1)
+
+#===========================================================================
+# TriggerItems
+#-------------
+# EM Items (bits [0:31])
+item_1em1 = LVL1MenuItem('L1_1EM1', 0x0, '1', 100, 'LOW')\
+            .setLogic(cond_1em1).setTriggerType(1)
+item_2em15 = LVL1MenuItem('L1_2EM15', 0x1, '1', 1, 'HIGH')\
+             .setLogic(cond_2em11).setTriggerType(1)
+item_2em15i = LVL1MenuItem('L1_2EM15i', 0x2, '1', 1, 'LOW')\
+              .setLogic(cond_2em11i).setTriggerType(1)
+item_1em25 = LVL1MenuItem('L1_2EM25', 0x3, '1', 1, 'LOW')\
+             .setLogic(cond_1em18).setTriggerType(1)
+item_1em25i = LVL1MenuItem('L1_2EM25i', 0x4, '1', 1, 'LOW')\
+              .setLogic(cond_1em18i).setTriggerType(1)
+item_1em60 = LVL1MenuItem('L1_1EM60', 0x5, '1', 1, 'LOW')\
+             .setLogic(cond_1em50).setTriggerType(1)
+
+item_xe20 = LVL1MenuItem('L1_XE20', 0x6, '1', 1, 'LOW')\
+            .setLogic(xe20.condition(1)).setTriggerType(8)
+
+# Muon Items (bits [32:63])
+item_1mu6 = LVL1MenuItem('L1_1MU6', 0x20, '1', 1, 'LOW')\
+            .setLogic(cond_1mu6).setTriggerType(2)
+item_2mu6 = LVL1MenuItem('L1_2MU6', 0x21, '1', 1, 'LOW')\
+            .setLogic(cond_2mu6).setTriggerType(2)
+item_1mu8 = LVL1MenuItem('L1_1MU8', 0x22, '1', 1, 'LOW')\
+            .setLogic(cond_1mu8).setTriggerType(2)
+item_1mu10 = LVL1MenuItem('L1_1MU10', 0x23, '1', 1, 'LOW')\
+             .setLogic(cond_1mu10).setTriggerType(2)
+item_1mu11 = LVL1MenuItem('L1_1MU11', 0x24, '1', 1, 'LOW')\
+             .setLogic(cond_1mu11).setTriggerType(2)
+item_1mu20 = LVL1MenuItem('L1_1MU20', 0x25, '1', 1, 'LOW')\
+             .setLogic(cond_1mu20).setTriggerType(2)
+item_1mu40 = LVL1MenuItem('L1_1MU40', 0x26, '1', 1, 'LOW')\
+             .setLogic(cond_1mu40).setTriggerType(2)
+#item_1mu6 = LVL1MenuItem('L1_1MU6', 0x20, '1', 1, 'LOW')\
+#            .setLogic(cond_1mu6|cond_1mu8|cond_1mu10|cond_1mu11|cond_1mu20|
+#                      cond_1mu40)
+
+## item_1mu6 = LVL1MenuItem('L1_1MU6', 0x20, '1', 1, 'LOW')\
+##             .addOredCondition('L1_1MU6', 1, 'MU6')
+
+## item_2mu6 = LVL1MenuItem('L1_2MU6', 0x21, '1', 1, 'LOW')\
+##             .setLogic( (cond_2mu6|cond_2mu8|cond_2mu10|cond_2mu11|
+##                         cond_2mu20|cond_2mu40) |
+##                        (cond_1mu6 & (cond_1mu8|cond_1mu10|cond_1mu11|
+##                                      cond_1mu20|cond_1mu40)) |
+##                        (cond_1mu8 & (cond_1mu10|cond_1mu11|cond_1mu20|
+##                                      cond_1mu40)) |
+##                        (cond_1mu10 & (cond_1mu11|cond_1mu20|cond_1mu40)) |
+##                        (cond_1mu11 & (cond_1mu20|cond_1mu40)) |
+##                        (cond_1mu20 & cond_1mu40))
+## item_1mu8 = LVL1MenuItem('L1_1MU8', 0x22, '1', 1, 'LOW')\
+##             .setLogic(cond_1mu8|cond_1mu10|cond_1mu11|cond_1mu20|cond_1mu40)
+## item_1mu10 = LVL1MenuItem('L1_1MU10', 0x23, '1', 1, 'LOW')\
+##              .setLogic(cond_1mu10|cond_1mu11|cond_1mu20|cond_1mu40)
+## item_1mu11 = LVL1MenuItem('L1_1MU11', 0x24, '1', 1, 'LOW')\
+##              .setLogic(cond_1mu11|cond_1mu20|cond_1mu40)
+## item_1mu20 = LVL1MenuItem('L1_1MU20', 0x25, '1', 1, 'LOW')\
+##              .setLogic(cond_1mu20|cond_1mu40)
+## item_1mu40 = LVL1MenuItem('L1_1MU40', 0x26, '1', 1, 'LOW').setLogic(cond_1mu40)
+
+# Tau Items (bits [64:95])
+item_1tau5 = LVL1MenuItem('L1_1TAU5', 0x40, '1', 1, 'LOW')\
+             .setLogic(tau5.condition(1)).setTriggerType(4)
+item_1tau10 = LVL1MenuItem('L1_1TAU10', 0x41, '1', 1, 'LOW')\
+              .setLogic(tau8.condition(1)).setTriggerType(4)
+item_1tau10i = LVL1MenuItem('L1_1TAU10i', 0x42, '1', 1, 'LOW')\
+               .setLogic(tau8i.condition(1)).setTriggerType(4)
+item_1tau15 = LVL1MenuItem('L1_1TAU15', 0x43, '1', 1, 'LOW')\
+              .setLogic(tau13.condition(1)).setTriggerType(4)
+item_1tau15i = LVL1MenuItem('L1_1TAU15i', 0x44, '1', 1, 'LOW')\
+               .setLogic(tau13i.condition(1)).setTriggerType(4)
+item_1tau20i = LVL1MenuItem('L1_1TAU20i', 0x45, '1', 1, 'LOW')\
+               .setLogic(tau17i.condition(1)).setTriggerType(4)
+item_1tau25i = LVL1MenuItem('L1_1TAU25i', 0x46, '1', 1, 'LOW')\
+               .setLogic(tau22i.condition(1)).setTriggerType(4)
+item_1tau35i = LVL1MenuItem('L1_1TAU35i', 0x47, '1', 1, 'LOW')\
+               .setLogic(tau30i.condition(1)).setTriggerType(4)
+
+
+# Jet items (bits [96:127])
+item_1j35 = LVL1MenuItem('L1_1J35', 0x60, '1', 1, 'LOW')\
+            .setLogic(cond_1j15).setTriggerType(0x10)
+item_1j45 = LVL1MenuItem('L1_1J45', 0x61, '1', 1, 'LOW')\
+            .setLogic(cond_1j20).setTriggerType(0x10)
+item_2j45 = LVL1MenuItem('L1_2J45', 0x62, '1', 1, 'LOW')\
+            .setLogic(cond_2j20).setTriggerType(0x10)
+item_3j45 = LVL1MenuItem('L1_3J45', 0x63, '1', 1, 'LOW')\
+            .setLogic(cond_3j20).setTriggerType(0x10)
+item_4j45 = LVL1MenuItem('L1_4J45', 0x64, '1', 1, 'LOW')\
+            .setLogic(cond_4j20).setTriggerType(0x10)
+item_1fj30 = LVL1MenuItem('L1_1fj30', 0x65, '1', 1, 'LOW')\
+             .setLogic(cond_1fj10_right & cond_1fj10_left).setTriggerType(0x10)
+item_1bj15 = LVL1MenuItem('L1_1bj15', 0x66, '1', 1, 'LOW')\
+             .setLogic(cond_1bj15).setTriggerType(0x10)
+
+
+
+# Etmiss items (bits [128:159])
+item_xe30 = LVL1MenuItem('L1_XE30', 0x80, '1', 1, 'LOW')\
+            .setLogic(cond_xe30).setTriggerType(0x20)
+item_xe40 = LVL1MenuItem('L1_XE40', 0x81, '1', 1, 'LOW')\
+            .setLogic(cond_xe40).setTriggerType(0x20)
+item_xe50 = LVL1MenuItem('L1_XE50', 0x82, '1', 1, 'LOW')\
+            .setLogic(cond_xe50).setTriggerType(0x20)
+item_xe100 = LVL1MenuItem('L1_XE100', 0x83, '1', 1, 'LOW')\
+             .setLogic(cond_xe100).setTriggerType(0x20)
+item_xe200 = LVL1MenuItem('L1_XE200', 0x84, '1', 1, 'LOW')\
+             .setLogic(cond_xe200).setTriggerType(0x20)
+
+item_1tau17i_xe30 = LVL1MenuItem('L1_1TAU17I_XE30', 0x8f, '1', 1, 'LOW')\
+                    .setLogic(cond_1tau17i&cond_xe30&Not(cond_1jet55))\
+                    .setTriggerType(0x24)
+
+
+item_bgrp0 = LVL1MenuItem('L1_BGRP0', 0xa0, '1', 1, 'LOW').setLogic(bgrp0)
+item_bgrp1 = LVL1MenuItem('L1_BGRP1', 0xa1, '1', 1, 'LOW').setLogic(bgrp1)
+item_bgrp2 = LVL1MenuItem('L1_BGRP2', 0xa2, '1', 1, 'LOW').setLogic(bgrp2)
+item_bgrp3 = LVL1MenuItem('L1_BGRP3', 0xa3, '1', 1, 'LOW').setLogic(bgrp3)
+item_bgrp4 = LVL1MenuItem('L1_BGRP4', 0xa4, '1', 1, 'LOW').setLogic(bgrp4)
+item_bgrp5 = LVL1MenuItem('L1_BGRP5', 0xa5, '1', 1, 'LOW').setLogic(bgrp5)
+item_bgrp6 = LVL1MenuItem('L1_BGRP6', 0xa6, '1', 1, 'LOW').setLogic(bgrp6)
+item_bgrp7 = LVL1MenuItem('L1_BGRP7', 0xa7, '1', 1, 'LOW').setLogic(bgrp7)
+item_mu10rndm0 = LVL1MenuItem('L1_MU6RNDM0', 0xb0, '1', 1, 'LOW')\
+                 .setLogic(cond_1mu6&rndm0)
+
+tm.addLVL1Item(item_bgrp0)
+tm.addLVL1Item(item_bgrp1)
+tm.addLVL1Item(item_bgrp2)
+tm.addLVL1Item(item_bgrp3)
+tm.addLVL1Item(item_bgrp4)
+tm.addLVL1Item(item_bgrp5)
+tm.addLVL1Item(item_bgrp6)
+tm.addLVL1Item(item_bgrp7)
+tm.addLVL1Item(item_mu10rndm0)
+
+#---------------------------------------------------------------------------
+# Setting items to the menu
+tm.addLVL1Item(item_1em1)
+tm.addLVL1Item(item_2em15)
+tm.addLVL1Item(item_2em15i)
+tm.addLVL1Item(item_1em25)
+tm.addLVL1Item(item_1em25i)
+tm.addLVL1Item(item_1em60)
+tm.addLVL1Item(item_xe20)
+#
+tm.addLVL1Item(item_1mu6)
+tm.addLVL1Item(item_2mu6)
+tm.addLVL1Item(item_1mu8)
+tm.addLVL1Item(item_1mu10)
+tm.addLVL1Item(item_1mu11)
+tm.addLVL1Item(item_1mu20)
+tm.addLVL1Item(item_1mu40)
+#
+tm.addLVL1Item(item_1tau5)
+tm.addLVL1Item(item_1tau10)
+tm.addLVL1Item(item_1tau10i)
+tm.addLVL1Item(item_1tau15)
+tm.addLVL1Item(item_1tau15i)
+tm.addLVL1Item(item_1tau20i)
+tm.addLVL1Item(item_1tau25i)
+tm.addLVL1Item(item_1tau35i)
+#
+tm.addLVL1Item(item_1tau17i_xe30)
+
+#===========================================================================
+# Other CTP configuration
+#------------------------
+tm.CTPInfo().setRandom('rand1', rate1=1000, rate2=100000, seed1=1, seed2=1)
+tm.CTPInfo().setPrescaledClock('psc1', clock1=10, clock2=100)
+tm.CTPInfo().setDeadtime(name='dt1', simple=0,
+                          complex1_rate=10, complex1_level=0,
+                          complex2_rate=20, complex2_level=1)
+bgs = tm.CTPInfo().setBunchGroupSet('bg_set1')\
+      .addBunchGroup('bg_p1', 1, [1, 2])\
+      .addBunchGroup('bg_p2', 2, [1001, 2002, 3003])\
+      .addBunchGroup('bg_empty', 2, [101, 202, 302])
+#tm.CTPInfo().setTriggerType(0, 0x1234)
+#tm.CTPInfo().setTriggerType(1, 0x0)
+#tm.CTPInfo().setTriggerType(2, 0x0)
+#tm.CTPInfo().setTriggerType(3, 0x0)
+#tm.CTPInfo().setTriggerType(4, 0x0)
+#tm.CTPInfo().setTriggerType(5, 0x0)
+#tm.CTPInfo().setTriggerType(6, 0x124<<128)
+#tm.CTPInfo().setTriggerType(7, 0x0)
+#===========================================================================
+# Muctpi
+#-------
+# tm.setMuctpiInfo(low_pt=2, high_pt=6, max_cand=13)
+
+#===========================================================================
+# CaloInfo
+#---------
+tm.Lvl1CaloInfo().setName('standard')
+tm.Lvl1CaloInfo().setGlobalScale(1)
+#--- ALGORITHM FOR CALCULATING JET WEIGHTS IS NOT WORKING YET!!!!!
+#jet_weights = tm.Lvl1CaloInfo().calcJetWeights(tm.Lvl1Thresholds(), \
+#                                               Lvl1CaloInfo.AverageOfThr)
+#tm.Lvl1CaloInfo().setJetWeights(jet_weights)
+tm.Lvl1CaloInfo().setJetWeights([4, 15, 20, 25, 35, 55, 0, 0, 10, 20, 30, 40])
+
+tm.writeConfigFiles()
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/checkTrigger.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/checkTrigger.py
new file mode 100755
index 0000000000000000000000000000000000000000..8e2aaebe3142f40b9a4cb9ea46e2364b550de863
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/checkTrigger.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+
+# @file:    checkTrigger.py
+# @purpose: read a POOL file and dump a trigger summary.
+#           Copied (& modified) from CheckFile.py from Sebastien Binet
+# @author:  Till Eifert <Till.Eifert@cern.ch>
+# @date:    October 2008
+#
+# @example:
+# @code
+# checkTrigger aod.pool.root
+# checkTrigger /castor/cern.ch/user/j/johndoe/aod.pool.root
+# checkTrigger somedir/*/*.pool
+# @endcode
+#
+
+__version__ = "$Revision: 1.1 $"
+__author__  = "Till Eifert <Till.Eifert@cern.ch>"
+
+
+import sys
+import os
+
+from optparse import OptionParser
+
+
+if __name__ == "__main__":
+    
+    parser = OptionParser(usage="usage: %prog [options] [-f] my.file.pool")
+
+    p = parser.add_option
+    p( "-f",
+       "--file",
+       dest = "fileName",
+       help = "The path to the POOL file to analyze" )
+##    p( "-d",
+##       "--detailed-dump",
+##       action  = "store_true",
+##       dest    = "doDetailedDump",
+##       default = False,
+##       help = "Switch to activate or not a detailed dump of each ... " )
+    p( "--sort-fct",
+       dest    = "sortFctName",
+       default = "name",
+       help = "Sorting function used to list triggers (allowed are: name, counter, evtsBeforePS, evtsAfterPS, evtsAfterPT)" )
+    p( "-o",
+       "--output",
+       dest = "outFileName",
+       default = None,
+       help = "Name of the output file which will contain the informations gathered during checkTrigger processing. These informations will be stored into a python-shelve file. If the given file name extension is '.csv' a comma separated file is written instead. Note that the python-shelve files can be read-in again by this script." )
+    
+    (options, args) = parser.parse_args()
+
+    fileNames = []
+   
+    if len(args) > 0:
+        fileNames = [ arg for arg in args if arg[0] != "-" ]
+        pass
+
+    if options.fileName == None and len(fileNames) == 0:
+        str(parser.print_help() or "")
+        sys.exit(1)
+
+    if options.fileName != None:
+        fileName = os.path.expandvars(os.path.expanduser(options.fileName))
+        fileNames.append(fileName)
+
+    fileNames = set( fileNames )
+    sc = 0
+
+    for fileName in fileNames:
+        try:
+            import TrigConfigSvc.TriggerSummary as TS
+            #TS.PoolOpts.FAST_MODE = options.fastMode
+            poolFile = TS.PoolFile( fileName )
+            poolFile.checkFile( sorting = options.sortFctName )
+##            if options.doDetailedDump:
+##                dumpFile = os.path.basename(fileName)+ ".txt"
+##                print "## dumping details into [%s]" % dumpFile
+##                poolFile.detailedDump( dumpFile )
+            if options.outFileName:
+                outFileName = options.outFileName
+                print "## saving checkFile report into [%s]..." % outFileName
+                poolFile.saveReport( outFileName )
+        except Exception, e:
+            print "## Caught exception [%s] !!" % str(e.__class__)
+            print "## What:",e
+            print sys.exc_info()[0]
+            print sys.exc_info()[1]
+            sc = 1
+            pass
+
+        except :
+            print "## Caught something !! (don't know what)"
+            print sys.exc_info()[0]
+            print sys.exc_info()[1]
+            sc = 10
+            pass
+        if len(fileNames) > 1:
+            print ""
+        pass # loop over fileNames
+    
+    print "## Bye."
+    sys.exit(sc)
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/checkTriggerConfig.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/checkTriggerConfig.py
new file mode 100755
index 0000000000000000000000000000000000000000..21008fdea005b8ff7b755fa656075a9ef7166768
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/checkTriggerConfig.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+# @file:    checkTriggerConfig.py
+# @purpose: print all trigger configuration summary info of a pool file
+# @author:  Joerg Stelzer 
+# @date:    January 2009
+#
+# @example:
+# @code
+# checkTriggerConfig.py aod.pool.root
+# checkTrigger /castor/cern.ch/user/j/johndoe/aod.pool.root
+# checkTrigger somedir/*/*.pool
+# @endcode
+#
+
+from optparse import OptionParser
+
+if __name__ == '__main__':
+
+    parser = OptionParser(usage="usage: %prog options file [file2 [...]]")
+
+    parser.add_option( "-d",
+                       "--chainsdetail",
+                       action = "store_true",
+                       default = False,
+                       dest = "chainsdetail",
+                       help = "prints detailed chain definition" )
+    
+    (options, args) = parser.parse_args()
+
+    fileNames = [arg for arg in args if arg[0] != "-" ]
+
+    if len(fileNames)==0:
+        print "No file specified"
+        parser.print_help()
+        from sys import exit
+        exit(1)
+
+    from TrigConfigSvc.TriggerConfigARA import TriggerConfigARA
+    trigconf = TriggerConfigARA(fileNames)
+    trigconf.printFileSummary(options.chainsdetail)
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/hltConfigSvc_standalone_test.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/hltConfigSvc_standalone_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..a4fd03b0cf4cbaa08adc5bab077723035d9e872a
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/hltConfigSvc_standalone_test.py
@@ -0,0 +1,27 @@
+#########################################################################
+#                                                                       #
+#        Standalone jobO for testing the HLT Config service             #
+#                                                                       #
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = INFO
+MessageSvc.defaultLimit = 10000000
+
+theApp.Dlls += [ "TrigConfigSvc" ]
+
+theApp.CreateSvc += [ "TrigConf::HLTConfigSvc/HLTConfigSvc" ]
+
+HLTConfigSvc = Service( "HLTConfigSvc" )
+HLTConfigSvc.ConfigSource        = "XML"
+# HLTConfigSvc.DBServer = "devdb"
+#HLTConfigSvc.XMLSignatureFile    = "siglistnew_newconfig.xml"
+#HLTConfigSvc.XMLSequenceFile     = "seqlistnew_newconfig.xml"
+HLTConfigSvc.XMLMenuFile     = "hlt_menu.xml"
+HLTConfigSvc.OutputLevel         = VERBOSE
+
+theApp.EvtMax = 0
+
+#                                                                       #
+#      End of standalone jobO for testing the HLTConfig service        #
+#                                                                       #
+#########################################################################
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/hltConfigSvc_standalone_test_configurables.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/hltConfigSvc_standalone_test_configurables.py
new file mode 100755
index 0000000000000000000000000000000000000000..33ad2f827359ddf2ff8750687e302c89dc7279af
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/hltConfigSvc_standalone_test_configurables.py
@@ -0,0 +1,39 @@
+#########################################################################
+#                                                                       #
+#        Standalone jobO for testing the HLT Config service             #
+#                                                                       #
+
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = INFO
+MessageSvc.defaultLimit = 10000000
+
+#from TrigConfigSvc.TrigConfigSvcConfig import HLTConfigSvc
+from TrigConfigSvc.TrigConfigSvcConf import TrigConf__HLTConfigSvc
+from AthenaCommon.AlgSequence import AlgSequence
+
+job = AlgSequence()
+
+#job += HLTConfigSvc( "HLTConfigSvc-Test" )
+ServiceMgr += TrigConf__HLTConfigSvc( "HLTConfigSvc" )
+
+
+#theApp.Dlls += [ "TrigConfigSvc" ]
+
+#theApp.CreateSvc += [ "TrigConf::HLTConfigSvc/HLTConfigSvc" ]
+
+#HLTConfigSvc = Service( "HLTConfigSvc" )
+#HLTConfigSvc.ConfigSource        = "XML"
+# HLTConfigSvc.DBServer = "devdb"
+#HLTConfigSvc.XMLSignatureFile    = "siglistnew_newconfig.xml"
+#HLTConfigSvc.XMLSequenceFile     = "seqlistnew_newconfig.xml"
+
+#job.HLTConfigSvc.XMLMenuFile     = "hlt_menu.xml"
+#HLTConfigSvc.OutputLevel         = VERBOSE
+
+theApp.EvtMax = 1
+
+#                                                                       #
+#      End of standalone jobO for testing the HLTConfig service        #
+#                                                                       #
+#########################################################################
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/hltConfigSvc_standalone_test_generated_menu.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/hltConfigSvc_standalone_test_generated_menu.py
new file mode 100755
index 0000000000000000000000000000000000000000..48324dc94a69707ac2a39dedbba635777ad4b70a
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/hltConfigSvc_standalone_test_generated_menu.py
@@ -0,0 +1,158 @@
+#########################################################################
+#                                                                       #
+#        Standalone jobO for testing the HLT Config service             #
+#        and the TriggerPythonConfig  menu generator                    #
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = VERBOSE
+MessageSvc.defaultLimit = 10000000
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.inputHLTconfigFile = 'generated_hlt_menu.xml' # here we use it
+
+from AthenaCommon.Logging import logging
+logging.getLogger( 'Unit test: ' )
+from TrigConfigSvc.TrigConfigSvcConfig import SetupTrigConfigSvc
+
+log.info('Creating the trigger configuration service wrapper')
+svc = SetupTrigConfigSvc()
+svc.SetStates(["xml"]);
+svc.hltXmlFile = TriggerFlags.inputHLTconfigFile()
+svc.InitialiseSvc();
+
+theApp.Dlls += [ "TrigConfigSvc" ]
+
+
+#######################################################
+##### Generate menu similar to the hlt_menu
+from TriggerMenuPython.TriggerPythonConfig import *
+menu = TriggerPythonConfig('generated_hlt_menu.xml', 'generated_lvl1_menu.xml')
+#menu = TriggerPythonConfig('generated_hlt_menu.xml')
+
+# fake L1
+mu6 = menu.addLvl1Threshold('MU6', 'MUON', 0,'SLOT9','CON0')\
+      .addMuonThresholdValue(6, -49, 49, 0, 64)
+
+em1 = menu.addLvl1Threshold('EM1', 'EM', 0, 'SLOT7', 'CON1')\
+      .addEMThresholdValue(7, -49, 49, 0, 64,\
+                           IsolationOff,IsolationOff,IsolationOff)
+em18 = menu.addLvl1Threshold('EM18', 'EM', 3, 'SLOT7', 'CON1')\
+       .addEMThresholdValue(18, -49, 49, 0, 64, \
+                            IsolationOff,IsolationOff,IsolationOff)
+
+cond_1mu6 = mu6.condition(1)
+cond_1em1 = em1.condition(1)
+cond_1em18 = em18.condition(1)
+
+
+item_1em1 = LVL1MenuItem('L1_1EM1', 0x0, '1', 100, 'LOW').setLogic(cond_1em1)
+item_1em20 = LVL1MenuItem('L1_EM20', 0x3, '1', 1, 'LOW').setLogic(cond_1em18)
+item_2em20 = LVL1MenuItem('L1_2EM20', 0x3, '1', 1, 'LOW').setLogic(cond_1em18&cond_1em18)
+
+menu.addLVL1Item(item_1em1)
+menu.addLVL1Item(item_1em20)
+menu.addLVL1Item(item_2em20)
+
+# sequence
+menu.addSequence('EM1',  ['T2CaloRec', 'T2CaloHypo'], 'em10t2calo')
+menu.addSequence('em10t2calo',['T2CaloIsol', 'T2CaloIsolHypo'],  'em10t2caloi')
+menu.addSequence('em10t2caloi', ['IDScan', 'IDHypo'], 'em10t2track')
+menu.addSequence('em10t2track', ['IDScan', 'IDHypo'], 'em10match')
+
+menu.addSequence('EM18',  ['T2CaloRec', 'T2CaloHypo'], 'em20t2calo')
+menu.addSequence('em20t2calo',['T2CaloIsol', 'T2CaloIsolHypo'],  'em20t2caloi')
+menu.addSequence('em20t2caloi', ['IDScan', 'IDHypo'], 'em20t2track')
+menu.addSequence('em20t2track', ['IDScan', 'IDHypo'], 'em20match')
+
+
+#chains
+chain = HLTChain('em10L2', '67', 'L1_1EM1', 'L2')
+chain.addTriggerTypeBit(4)
+chain.addStreamTag('electrons')
+chain.addGroup('EM')
+chain.addHLTSignature( 'em10t2calo', sigcounter=2 ).addHLTSignature( 'em10t2caloi' ).addHLTSignature( 'em10t2track' )
+menu.addHLTChain(chain)
+menu.registerHLTChain('em10', chain)
+
+
+
+chain = HLTChain('myChain', '68', 'L1_2EM20', 'L2')
+chain.addTriggerTypeBit(4)
+chain.addTriggerTypeBit(8)
+chain.addStreamTag('electrons')
+chain.addGroup(['EM', 'calib'])
+chain.addStreamTag('lar', type='calibration', obeyLB='no')
+chain.addHLTSignature( ['em10t2calo', 'em20t2calo'] ).addHLTSignature( ['em10t2caloi', 'em20t2caloi'] )#.addHLTSignature( ['em10t2track', 'em20t2track' ] )
+chain.evaluateSignatureAfter(['em10t2calo', 'em20t2calo'], 'em10L2', 'em10t2track')
+chain.evaluateSignatureAfter(['em10t2calo', 'em20t2calo'], 'em10L2_All_OK_I_want_to_see_this_warning', 'em10t2track')
+chain.evaluateSignatureAfter(['em10t2calo', 'em20t2calo'], 'em10L2', 'em10t2track_All_OK_I_want_to_see_warning')
+
+
+menu.addSequence(['em20t2calo']*2, ['L2ZeeFex', 'L2ZeeHypo'], 'L2Zee')
+menu.addSequence(['em20track']*2, ['L2ZeeFex', 'L2ZeeHypo'], 'NextL2Zee', 'L2Zee')
+
+
+menu.addHLTChain(chain)
+menu.registerHLTChain('my', chain)
+
+
+
+chain = HLTChain('em10EF', '3', 'em10L2', 'EF')
+chain.addTriggerTypeBit(4)
+chain.addStreamTag('electrons')
+chain.addGroup(['EM', 'fresh'])
+chain.addHLTSignature( 'em10track' ).addHLTSignature( 'em10match' )
+chain1 = chain # remember it for binding purpose
+menu.addHLTChain(chain)
+menu.registerHLTChain('em10', chain)
+
+chain = HLTChain('g10EF', '4', 'em10L2', 'EF')
+chain.addTriggerTypeBit(4)
+chain.addStreamTag('photons')
+chain.addHLTSignature( 'g10match' )
+chain.evaluateSignatureAfter( 'g10match', 'em10EF', 'em10match')
+menu.addHLTChain(chain)
+menu.registerHLTChain('g10', chain)
+
+# 2 chains starting from nowhere
+chain = HLTChain('g10EFunseeded', chain_counter='5', lower_chain_name='', level='L2')
+chain.addTriggerTypeBit(14)
+chain.addStreamTag('photonsFreeHunter')
+menu.addHLTChain(chain)
+menu.registerHLTChain('g10', chain)
+
+
+chain = HLTChain('gL2unseeded', chain_counter='5', lower_chain_name='', level='EF')
+chain.addTriggerTypeBit(156)
+chain.addStreamTag('photonsFreeHunter')
+menu.addHLTChain(chain)
+menu.registerHLTChain('unused',chain)
+
+chain = HLTChain('eANDgL2', chain_counter='52', lower_chain_name='', level='L2')
+chain.addTriggerTypeBit(1587)
+chain.addHLTSignature('em10track')
+chain.addStreamTag('exotics')
+chain.mergeAndAppendChains([menu.getHLTChain('myChain'), menu.getHLTChain('em10L2')])
+menu.addHLTChain(chain)
+menu.registerHLTChain('eAND', chain)
+
+menu.writeConfigFiles()
+#######################################################
+
+
+#HLTConfigSvc.XMLMenuFile     = 'generated_hlt_menu.xml' # here we use it
+#HLTConfigSvc.OutputLevel         = VERBOSE
+from AthenaCommon.AppMgr import ServiceMgr
+
+theApp.EvtMax = 0
+ServiceMgr.HLTConfigSvc.OutputLevel = VERBOSE
+ServiceMgr.TrigConfigSvc.OutputLevel = VERBOSE
+
+print ServiceMgr
+
+
+
+#                                                                       #
+#      End of standalone jobO for testing the HLTConfig service         #
+#                                                                       #
+#########################################################################
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/jobOptions_commonSetup.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/jobOptions_commonSetup.py
new file mode 100755
index 0000000000000000000000000000000000000000..6597b2de292f4e2a57a57f2dc7eae89a41c597ec
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/jobOptions_commonSetup.py
@@ -0,0 +1,2 @@
+
+theApp.Dlls += [ "TrigConfigSvc" ]
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/jobOptions_setupHLTSvc.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/jobOptions_setupHLTSvc.py
new file mode 100755
index 0000000000000000000000000000000000000000..9c39b35899b27c237af267b42eab4a10f28a7b08
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/jobOptions_setupHLTSvc.py
@@ -0,0 +1,4 @@
+theApp.CreateSvc += [ "TrigConf::HLTConfigSvc/HLTConfigSvc" ]
+
+HLTConfigSvc = Service( "HLTConfigSvc" )
+# HLTConfigSvc.DBServer = "devdb"
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/jobOptions_setupLVL1Svc.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/jobOptions_setupLVL1Svc.py
new file mode 100755
index 0000000000000000000000000000000000000000..551a613101168d8638e02691406285f4ced35f20
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/jobOptions_setupLVL1Svc.py
@@ -0,0 +1,6 @@
+theApp.CreateSvc += [ "TrigConf::LVL1ConfigSvc/LVL1ConfigSvc" ]
+
+LVL1ConfigSvc = Service( "LVL1ConfigSvc" )
+#LVL1ConfigSvc.DBServer = "devdb"
+LVL1ConfigSvc.CreateLegacyObjects = False
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/lvl1ConfigSvc_standalone_test.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/lvl1ConfigSvc_standalone_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..d048e9e6bd58bc61a874d1b7354dde3f144bdf7e
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/lvl1ConfigSvc_standalone_test.py
@@ -0,0 +1,36 @@
+#########################################################################
+#                                                                       #
+#        Standalone jobO for testing the LVL1Config service             #
+#                                                                       #
+
+MessageSvc = Service( "MessageSvc" )
+MessageSvc.OutputLevel  = INFO
+MessageSvc.defaultLimit = 10000000
+
+theApp.Dlls += [ "TrigConfigSvc" ]
+
+theApp.CreateSvc += [ "TrigConf::LVL1ConfigSvc/LVL1ConfigSvc" ]
+from TrigConfigSvc.TrigConfigSvcConfig import LVL1ConfigSvc
+from AthenaCommon.AppMgr import ServiceMgr
+
+theLVL1ConfigSvc = LVL1ConfigSvc('LVL1ConfigSvc')
+ServiceMgr += theLVL1ConfigSvc
+
+theLVL1ConfigSvc.ConfigSource = "XML"
+#theLVL1ConfigSvc.DBServer = "devdb"
+theLVL1ConfigSvc.XMLFile = "LVL1Config.xml"
+theLVL1ConfigSvc.CreateLegacyObjects = TRUE
+theLVL1ConfigSvc.DumpTTVmap = False
+theLVL1ConfigSvc.OutputLevel = VERBOSE
+
+#include( "TrigT1Muctpi/TrigT1Muctpi_jobOptions.py" )
+#include( "TrigT1Calo/TrigT1CaloJobOptions.py" )
+#include( "TrigT1TGC/TrigT1TGCJobOptions.py" )
+#include( "TrigT1CTP/TrigT1CTP_jobOptions.py" )
+
+theApp.EvtMax = 0
+
+#                                                                       #
+#      End of standalone jobO for testing the LVL1Config service        #
+#                                                                       #
+#########################################################################
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/testKeyByNameLoader.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/testKeyByNameLoader.py
new file mode 100755
index 0000000000000000000000000000000000000000..ba8a77cb4a4904471288715658d11803f93cf4a0
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/testKeyByNameLoader.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python2.5
+
+__author__ = "Joerg Stelzer stelzer@cern.ch"
+
+if __name__ == '__main__':
+
+    from TrigConfigSvc.TrigConfigSvcUtils import getKeysFromName
+
+    #configkeys = getKeysFromName('sqlite_file:TriggerMenuSQLiteFile_rel_2.sqlite','%')
+    configkeys = getKeysFromName('TRIGGERDB','Cosmic%', MCOnly=True)
+    print configkeys
+
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/testMD.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/testMD.py
new file mode 100644
index 0000000000000000000000000000000000000000..a98cfcf140d9ded84bdfa22a0a122a8ebe94245d
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/testMD.py
@@ -0,0 +1,57 @@
+import user
+import sys
+import ROOT
+import PyCintex
+#import AthenaROOTAccess.transientTree
+
+# for a single file give a file handle
+#f = ROOT.TFile.Open ('AOD.pool.root')
+
+# for a set of files give a list of names
+f = ['AOD.pool.root']
+
+
+from TrigConfigSvc.TriggerConfigARA import TriggerConfigARA
+trigconf = TriggerConfigARA(f)
+
+#print "Making transient collection ..."
+#tt = AthenaROOTAccess.transientTree.makeTree(f)
+
+# normally you would get the run and lb number from the collection tree (from each event)
+# you can call update on every new lb (or even event), information is only read when IOV becomes invalid
+trigconf.update(5200,0)
+
+# NOTE: if you are using prescales you should call trigconf.update() whenever the lumiblock changes, since the l1 prescales can change at the lb boundary
+
+# print summary
+print trigconf
+
+# access to L1 TriggerItems through trigconf.L1Items
+for (name,item) in trigconf.L1Items.items():
+    print item.ctpId(), item
+
+# access to HLT Chains through trigconf.HLTChains
+for (name,ch) in trigconf.HLTChains.items():
+    print ch.chain_counter(), ch
+
+# the list of all items and chain names
+trigconf.getConfiguredChainNames()
+
+# to check if a item or chain is in a menu use trigconf.isConfigured(name)
+testnames = ["L1_TAU9I_XE30", "17AND4", "EF_e10_mu6"]
+for name in testnames:
+    if trigconf.isConfigured(name):
+        print name,"is configured"
+    else:
+        print name,"is not configured"
+
+# the full prescale of a chain can be gotten using
+print "Full prescale factor of chain 'EF_e10_mu6':",trigconf.getFullChainPrescaleFactor("EF_e10_mu6")
+
+
+# this would do nothing, since the IOV is still valid
+trigconf.update(5200,17)
+
+# this triggers reading of the new menu (that of run 5300)
+trigconf.update(5400,39)
+print trigconf
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/share/testTriggerFrontierQuery.py b/Trigger/TrigConfiguration/TrigConfigSvc/share/testTriggerFrontierQuery.py
new file mode 100755
index 0000000000000000000000000000000000000000..9e318cab3a19f5e4e8353860bafee1dc60e0061a
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/share/testTriggerFrontierQuery.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+import sys,os
+from re import match
+from PyCool import cool
+import CoolConvUtilities.AtlCoolLib as AtlCoolLib
+
+
+def main():
+    connectString = "TRIGGERDBREPR"
+    if len(sys.argv)>1:
+        connectString = sys.argv[1]
+    if connectString == None: return 0
+
+    (ALL, VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL) = range(7)
+
+    from AthenaCommon.Logging import logging
+    log = logging.getLogger( "TrigConfigSvcUtils.py" )
+    log.setLevel(VERBOSE)
+    log = logging.getLogger( "TrigConfFrontier.py" )
+    log.setLevel(VERBOSE)
+    
+
+    from TrigConfigSvc.TrigConfigSvcUtils import getTriggerDBCursor, executeQuery
+
+    cursor,schemaname = getTriggerDBCursor(connectString)
+
+    output = ["SM.SMT_ID", "SM.SMT_NAME", "SM.SMT_VERSION", "SM.SMT_COMMENT", "SM.SMT_ORIGIN", "SM.SMT_USERNAME", "SM.SMT_STATUS"]
+    condition = []
+    tables = { 'SM' : 'SUPER_MASTER_TABLE' }
+
+    result = executeQuery(cursor, output, condition, schemaname, tables)
+
+    print "TEST result:\n============"
+    for r in sorted(result):
+        print r
+
+    return 0
+
+if __name__ == '__main__':
+    """This test does a simple query using different technologies
+
+    if environment TRIGGER_USE_FRONTIER is set then local frontier is used, otherwise oracle
+    """
+
+    sys.exit(main())
+    
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..b07fa5708dd267f2210253e58a80708f9c22f0a6
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/ConfigSvcBase.cxx
@@ -0,0 +1,126 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "TrigConfigSvc/ConfigSvcBase.h"
+#include "TrigConfBase/TrigDBConnectionConfig.h"
+#include "TrigConfStorage/IStorageMgr.h"
+#include "TrigConfStorage/StorageMgr.h"
+#include "TrigConfStorage/XMLStorageMgr.h"
+
+#include "boost/algorithm/string/case_conv.hpp"
+#include "boost/lexical_cast.hpp"
+
+using namespace std;
+using namespace TrigConf;
+
+ConfigSvcBase::ConfigSvcBase(const std::string& name, ISvcLocator* pSvcLocator) :
+   AthService(name, pSvcLocator),
+   m_dbconfig { nullptr }
+{}
+
+ConfigSvcBase::~ConfigSvcBase()
+{}
+
+void
+ConfigSvcBase::declareCommonProperties() {
+   declareProperty( "ConfigSource",     m_configSourceString,
+                    "Source of trigger configuration; can be \"XML\", \"MySQL\", \"Oracle\", or \"DBLookup\" ");
+   declareProperty( "XMLMenuFile",      m_xmlFile,
+                    "XML file containing the trigger configuration.");
+   declareProperty( "DBServer",         m_dbServer,
+                    "Database server to use.");
+   declareProperty( "DBUser",           m_dbUser,
+                    "User name for database connection. If empty, use XMLAuthenticationService.");
+   declareProperty( "DBPassword",       m_dbPassword,
+                    "Password for database connection. Only used if \"DBUser\" is specified and not empty.");
+   declareProperty( "DBTable",          m_dbTable );
+
+   declareProperty( "DBSMKey",          m_dbSMKey,
+                    "The SuperMaster key");
+   declareProperty( "UseFrontier",      m_useFrontier,
+                    "Tries to use Frontier for accessing the TriggerDB");
+   declareProperty( "PrintMenu",        m_printMenuLevel,
+                    "Prints menu with detail level x=0..5 [default = " + boost::lexical_cast<string,int>(m_printMenuLevel) + "]");
+}
+
+
+
+StatusCode
+ConfigSvcBase::initialize() {
+
+   CHECK(AthService::initialize());
+
+   ATH_MSG_INFO("=================================");
+   ATH_MSG_INFO("Initializing " << name() << " service");
+   ATH_MSG_INFO("Version: " << PACKAGE_VERSION);
+   ATH_MSG_INFO("=================================");
+
+   string s(boost::to_lower_copy(m_configSourceString)); // lower case
+   if(s != "xml") {
+      TrigDBConnectionConfig::DBType dbtype(TrigDBConnectionConfig::DBLookup);
+      if (s == "oracle") { dbtype = TrigDBConnectionConfig::Oracle; }
+      else if (s == "mysql")  { dbtype = TrigDBConnectionConfig::MySQL; }
+      else if (s == "sqlite") { dbtype = TrigDBConnectionConfig::SQLite; }
+      m_dbconfig = std::unique_ptr<TrigDBConnectionConfig>{
+         new TrigDBConnectionConfig( dbtype,
+                                     m_dbServer,
+                                     m_dbSMKey,
+                                     m_dbHLTPSKey)
+      };
+      m_dbconfig->m_useFrontier = m_useFrontier;
+   }
+
+   ATH_MSG_INFO("    ConfigSource        = " << m_configSourceString);
+   if(m_dbconfig==nullptr) {
+      ATH_MSG_INFO("    XMLMenuFile         = " << m_xmlFile);
+   } else {
+      ATH_MSG_INFO("    DB Server           = " << m_dbServer);
+      ATH_MSG_INFO("    DB User             = " << m_dbUser);
+      ATH_MSG_INFO("    DB Table            = " << m_dbTable);
+      ATH_MSG_INFO("    UseFrontier         = " << m_useFrontier.value());
+      ATH_MSG_INFO("    DB connection       = " << m_dbconfig->toString());
+      ATH_MSG_INFO("    DB SuperMasterKey   = " << m_dbSMKey);
+   }
+   ATH_MSG_INFO("    PrintMenu level     = " << m_printMenuLevel);
+
+   return StatusCode::SUCCESS;
+}
+
+
+
+StatusCode
+ConfigSvcBase::initStorageMgr() {
+   if(fromDB()) {
+      string connectionString;
+      if(m_dbconfig->m_type == TrigDBConnectionConfig::DBLookup)
+         connectionString = m_dbconfig->m_server;
+      else
+         connectionString = m_dbconfig->typeToString() + "://" +
+            m_dbconfig->m_server + "/" + m_dbconfig->m_schema;
+
+      ATH_MSG_INFO("Connection: " << connectionString);
+      StorageMgr * sm = new StorageMgr( connectionString, m_dbconfig->m_user, m_dbconfig->m_password );
+
+      sm->setUseFrontier(m_dbconfig->m_useFrontier);
+
+      m_storageMgr = sm;
+   } else {
+      if (m_xmlFile == "") {
+         ATH_MSG_ERROR("If you need the configuration and ConfigSource is 'XML', you need to specify a menu xml file");
+         return StatusCode::FAILURE;
+      }
+      ATH_MSG_INFO("XML file: " << m_xmlFile);
+      m_storageMgr = new XMLStorageMgr( { m_xmlFile } );
+   }
+   return StatusCode::SUCCESS;
+}
+
+
+// close storage manager
+StatusCode
+ConfigSvcBase::freeStorageMgr() {
+   delete m_storageMgr;
+   m_storageMgr = 0;
+   return StatusCode::SUCCESS;
+}
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/DSConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/DSConfigSvc.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..c221d1e0378ccc83641e2944b06a118469773185
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/DSConfigSvc.cxx
@@ -0,0 +1,783 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: DSConfigSvc.cxx 592654 2014-04-11 18:33:06Z fpastore $
+
+#include "GaudiKernel/IIncidentSvc.h"
+#include "GaudiKernel/Incident.h"
+#include "GaudiKernel/IJobOptionsSvc.h"
+#include "AthenaKernel/errorcheck.h"
+
+#include "CoolKernel/Record.h"
+
+#include "StoreGate/DataHandle.h"
+
+#include "AthenaPoolUtilities/AthenaAttributeList.h"
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+
+// Trigger configuration include(s):
+#include "TrigConfL1Data/HelperFunctions.h"
+#include "TrigConfL1Data/CTPConfig.h"
+#include "TrigConfL1Data/Menu.h"
+#include "TrigConfL1Data/PrescaleSet.h"
+#include "TrigConfL1Data/TriggerItem.h"
+#include "TrigConfL1Data/BunchGroup.h"
+#include "TrigConfL1Data/BunchGroupSet.h"
+
+#include "TrigConfHLTData/HLTFrame.h"
+#include "TrigConfHLTData/HLTChainList.h"
+#include "TrigConfHLTData/HLTSequenceList.h"
+#include "TrigConfHLTData/HLTPrescaleSet.h"
+#include "TrigConfHLTData/HLTStreamTag.h"
+
+#include "TrigConfStorage/TrigConfCoolFolderSpec.h"
+#include "TrigConfStorage/TrigConfCoolL1PayloadConverters.h"
+#include "TrigConfStorage/TrigConfCoolHLTPayloadConverters.h"
+
+// Local include(s):
+#include "TrigConfigSvc/DSConfigSvc.h"
+
+#include "boost/lexical_cast.hpp"
+
+
+using namespace std;
+using namespace TrigConf;
+using namespace TrigConfCoolL1PayloadConverters;
+using namespace TrigConfCoolHLTPayloadConverters;
+
+using boost::lexical_cast;
+
+#define TRIGGER_CONF_HLTMENU  "/TRIGGER/HLT/Menu"
+#define TRIGGER_CONF_HLTKEYS  "/TRIGGER/HLT/HltConfigKeys"
+#define TRIGGER_CONF_HLTPS    "/TRIGGER/HLT/Prescales"
+#define TRIGGER_CONF_HLTPSK   "/TRIGGER/HLT/PrescaleKey"
+
+#define TRIGGER_CONF_LVL1KEY  "/TRIGGER/LVL1/Lvl1ConfigKey"
+#define TRIGGER_CONF_LVL1MENU "/TRIGGER/LVL1/Menu"
+#define TRIGGER_CONF_LVL1PS   "/TRIGGER/LVL1/Prescales"
+#define TRIGGER_CONF_LVL1PIT  "/TRIGGER/LVL1/CTPCoreInputMapping"
+
+// new additions not sure yet if I should make them available in ESD/AOD
+#define TRIGGER_CONF_HLTGRP   "/TRIGGER/HLT/Groups"
+#define TRIGGER_CONF_LVL1ITD  "/TRIGGER/LVL1/ItemDef"
+#define TRIGGER_CONF_LVL1THR  "/TRIGGER/LVL1/Thresholds"
+
+// new additions BG
+// bunchgroup set key
+#define TRIGGER_CONF_LVL1BGKEY   "/TRIGGER/LVL1/BunchGroupKey"
+// description of the BG
+#define TRIGGER_CONF_LVL1BGDESC  "/TRIGGER/LVL1/BunchGroupDescription"
+// definition of the bunchgroup
+#define TRIGGER_CONF_LVL1BGDEF   "/TRIGGER/LVL1/BunchGroupContent"
+
+TrigConf::DSConfigSvc::DSConfigSvc( const std::string& name,
+                                    ISvcLocator* pSvcLocator )
+   : AthService( name, pSvcLocator ),
+     m_thrcfg( 0 ),
+     m_prescaleSet( 0 ),
+     m_masterKey( 0 ),
+     m_lvl1PsKey( 0 ),
+     m_hltPsKey( 0 ),
+     m_lvl1BgKey( 0 ),
+     m_configSrc( "" ),
+     m_detstore( "StoreGateSvc/DetectorStore", name ),
+     m_itembgs( 256, 0 ),
+     m_bunchGroupSet( new TrigConf::BunchGroupSet( std::vector< TrigConf::BunchGroup >( 8 ) ) ),
+     m_readyState( true ), 
+     m_readLvl1Thr( false ),
+     m_readLvl1BG( false ),
+     m_folders( "" )
+{
+   declareProperty( "readLVL1Thr", m_readLvl1Thr, "Only use data we know are in the file" );
+   declareProperty( "readLVL1BG", m_readLvl1BG, "Only use data we know are in the file" );
+}
+
+TrigConf::DSConfigSvc::~DSConfigSvc() {
+
+   if( m_bunchGroupSet )  delete m_bunchGroupSet;
+   if( m_prescaleSet )  delete m_prescaleSet;
+}
+
+StatusCode
+TrigConf::DSConfigSvc::initialize() {
+
+   // Notice that there's no need to call the initialization function
+   // of the base class now that we inherit from AthService...
+
+   // get detector store
+   CHECK( m_detstore.retrieve() );
+
+   ServiceHandle< IJobOptionsSvc > jobOptionsSvc( "JobOptionsSvc", name() );
+   if( jobOptionsSvc.retrieve().isFailure() ) {
+      ATH_MSG_WARNING( "Cannot retrieve JobOptionsSvc" );
+   } else {
+      const Property* p =
+         Gaudi::Utils::getProperty( jobOptionsSvc->getProperties( "IOVDbSvc" ), "Folders" );   
+      if( p ) m_folders = p->toString();
+      ATH_MSG_DEBUG( "The string 'folders' is: " << m_folders );
+   }
+
+   const bool multichannel  = true;
+   const bool singlechannel = false;
+
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_HLTMENU,    multichannel  ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_HLTKEYS,    singlechannel ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_HLTPS,      multichannel  ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_HLTPSK,     singlechannel ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_LVL1KEY,    singlechannel ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_LVL1MENU,   multichannel  ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_LVL1PS,     multichannel  ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_HLTGRP,     multichannel  ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_LVL1ITD,    multichannel  ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_LVL1THR,    multichannel  ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_LVL1BGKEY,  singlechannel ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_LVL1BGDESC, singlechannel ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_LVL1BGDEF,  singlechannel ) );
+   CHECK( registerCallbackForFolder( TRIGGER_CONF_LVL1PIT,    multichannel  ) );
+
+   ATH_MSG_INFO( "Successfully initalized DSConfigSvc" );
+
+   return StatusCode::SUCCESS;
+}
+
+StatusCode
+TrigConf::DSConfigSvc::finalize() {
+   return StatusCode::SUCCESS;
+}
+
+StatusCode
+TrigConf::DSConfigSvc::queryInterface( const InterfaceID& riid,
+                                       void** ppvIF ) {
+
+   if( riid == ITrigConfigSvc::interfaceID() ) {
+      *ppvIF = static_cast< ITrigConfigSvc* >( this );
+   } else if( riid == IProperty::interfaceID() ) {
+      *ppvIF = static_cast< IProperty* >( this );
+   } else if ( riid == IL1TopoConfigSvc::interfaceID() )  {
+      *ppvIF = static_cast< IL1TopoConfigSvc* >(this);
+   } else if( riid == ILVL1ConfigSvc::interfaceID() )  {
+      *ppvIF = static_cast< ILVL1ConfigSvc* >( this );
+   } else if( riid == IHLTConfigSvc::interfaceID() )  {
+      *ppvIF = static_cast< IHLTConfigSvc* >( this );
+   } else {
+      return AthService::queryInterface( riid, ppvIF );
+   }
+
+   addRef();
+   return StatusCode::SUCCESS;
+}
+
+// not yet implemented
+const TXC::L1TopoMenu*
+TrigConf::DSConfigSvc::menu() const { 
+   return 0;
+}
+
+const TrigConf::CTPConfig*
+TrigConf::DSConfigSvc::ctpConfig() const {
+  return & m_ctpConfig;
+}
+
+const TrigConf::Muctpi*
+TrigConf::DSConfigSvc::muctpiConfig() const {
+   REPORT_MESSAGE( MSG::ERROR ) << "The MuCTPi object is not available when running on AOD or from COOL";
+   return 0;
+}
+
+const TrigConf::ThresholdConfig*
+TrigConf::DSConfigSvc::thresholdConfig() const {
+   return & m_ctpConfig.menu().thresholdConfig();
+}
+
+const TrigConf::HLTChainList*
+TrigConf::DSConfigSvc::chainList() const {
+   return & m_hltFrame.getHLTChainList();
+}
+
+const TrigConf::HLTSequenceList*
+TrigConf::DSConfigSvc::sequenceList() const {
+   return & m_hltFrame.getHLTSequenceList();
+}
+
+StatusCode
+TrigConf::DSConfigSvc::registerCallbackForFolder( const std::string& foldername,
+                                                  bool multichannel ) {
+
+   if( ! hasFolder( foldername ) ) return StatusCode::SUCCESS;
+
+   const bool triggerUpdateOnRegistration = true;
+
+   if( multichannel ) {
+      const DataHandle< CondAttrListCollection > aptr;
+      CHECK( m_detstore->regFcn( &DSConfigSvc::update, this, aptr,
+                                 foldername, triggerUpdateOnRegistration ) );
+   } else {
+      const DataHandle< AthenaAttributeList > aptr;
+      CHECK( m_detstore->regFcn( &DSConfigSvc::update, this, aptr,
+                                 foldername, triggerUpdateOnRegistration ) );
+   }
+   ATH_MSG_DEBUG( "Registered callback for folder " << foldername );
+
+   return StatusCode::SUCCESS;
+}
+
+StatusCode
+TrigConf::DSConfigSvc::update( IOVSVC_CALLBACK_ARGS_K( keys ) ) {
+
+   // callback function to update beamspot cache when condDB data changes
+   //I = 0; // not used, suppress compiler warnings
+
+   bool update_HLTMENU  = false;  // /TRIGGER/HLT/Menu
+   bool update_HLTKEYS  = false;  // /TRIGGER/HLT/HltConfigKeys
+   bool update_HLTPS    = false;  // /TRIGGER/HLT/Prescales and /TRIGGER/HLT/PrescaleKey
+   bool update_LVL1KEY  = false;  // /TRIGGER/LVL1/Lvl1ConfigKey
+   bool update_LVL1MENU = false;  // /TRIGGER/LVL1/Menu
+   bool update_LVL1PS   = false;  // /TRIGGER/LVL1/Prescales
+   bool update_LVL1PIT  = false;  // /TRIGGER/LVL1/CTPCoreInputMapping
+   bool update_HLTGRP   = false;  // /TRIGGER/HLT/Groups
+   bool update_LVL1ITD  = false;  // /TRIGGER/LVL1/ItemDef
+   bool update_LVL1THR  = false;  // /TRIGGER/LVL1/Thresholds
+   bool update_LVL1BGK  = false;  // /TRIGGER/LVL1/BunchGroupKey
+   bool update_LVL1BGD  = false;  // /TRIGGER/LVL1/BunchGroupDescription
+   bool update_LVL1BGC  = false;  // /TRIGGER/LVL1/BunchGroupContent
+
+   ATH_MSG_INFO( "update callback invoked for " << keys.size() << " keys: " << keys );
+
+   // Decide which folders were updated:
+   std::list< std::string >::const_iterator key_itr = keys.begin();
+   std::list< std::string >::const_iterator key_end = keys.end();
+   for( ; key_itr != key_end; ++key_itr ) {
+      if     ( *key_itr == TRIGGER_CONF_HLTMENU    ) update_HLTMENU  = true;
+      else if( *key_itr == TRIGGER_CONF_HLTKEYS    ) update_HLTKEYS  = true;
+      else if( *key_itr == TRIGGER_CONF_HLTPS      ) update_HLTPS    = true;
+      else if( *key_itr == TRIGGER_CONF_HLTPSK     ) update_HLTPS    = true;
+      else if( *key_itr == TRIGGER_CONF_LVL1KEY    ) update_LVL1KEY  = true;
+      else if( *key_itr == TRIGGER_CONF_LVL1MENU   ) update_LVL1MENU = true;
+      else if( *key_itr == TRIGGER_CONF_LVL1PS     ) update_LVL1PS   = true;
+      else if( *key_itr == TRIGGER_CONF_LVL1PIT    ) update_LVL1PIT  = true;
+      else if( *key_itr == TRIGGER_CONF_HLTGRP     ) update_HLTGRP   = true;
+      else if( *key_itr == TRIGGER_CONF_LVL1ITD    ) update_LVL1ITD  = true;
+      else if( *key_itr == TRIGGER_CONF_LVL1THR    ) update_LVL1THR  = true;
+      else if( *key_itr == TRIGGER_CONF_LVL1BGKEY  ) update_LVL1BGK  = true;
+      else if( *key_itr == TRIGGER_CONF_LVL1BGDESC ) update_LVL1BGD  = true;
+      else if( *key_itr == TRIGGER_CONF_LVL1BGDEF  ) update_LVL1BGC  = true;
+   }
+
+   bool updated_LVL1Menu = update_LVL1MENU || update_LVL1ITD || update_LVL1THR || update_LVL1PIT;
+   bool updated_LVL1Ps   = update_LVL1KEY || update_LVL1PS;
+   bool updated_HLTMenu  = update_HLTGRP;
+   //bool updated_HLTPs    = false;
+   bool updated_newHLTPs = false;
+   bool updated_LVL1BG   = false;
+
+   // read the runwise configuration keys (master + HLT prescales)
+   if( update_HLTKEYS ) {
+
+      const DataHandle< AthenaAttributeList > keysAtrList;
+      CHECK( m_detstore->retrieve( keysAtrList, TRIGGER_CONF_HLTKEYS ) );
+
+      ATH_MSG_INFO( "Updating trigger configuration: HLT keys" );
+
+      uint32_t old_masterkey = m_masterKey;
+      //uint32_t old_hltPsKey = m_hltPsKey;
+
+      readHltConfigKeys( *keysAtrList,
+                                                           m_masterKey, m_hltPsKey, m_configSrc );
+
+      ATH_MSG_INFO( "  Configuration key : " << m_masterKey );
+      ATH_MSG_INFO( "  Run-bound HLT prescale key (old style): " << m_hltPsKey );
+      ATH_MSG_INFO( "  Original source   : " << m_configSrc );
+
+      updated_HLTMenu |= ( old_masterkey != m_masterKey );
+      //updated_HLTPs = ( old_hltPsKey != m_hltPsKey );
+      if( m_masterKey == 0 ) updated_HLTMenu = true;
+      //if( m_hltPsKey == 0 )  updated_HLTPs   = true;
+   }
+
+   // read the LVL1 Menu object
+   if( update_LVL1MENU ) {
+
+      const DataHandle< CondAttrListCollection > lvl1MenuAtrColl;
+      CHECK( m_detstore->retrieve(lvl1MenuAtrColl, TRIGGER_CONF_LVL1MENU ) );
+
+      ATH_MSG_INFO( "Updating trigger configuration: LVL1 menu" );
+
+      m_ctpConfig.menu().clear();
+
+      CondAttrListCollection::size_type nCh = lvl1MenuAtrColl->size();
+
+      CondAttrListCollection::const_iterator chIt = lvl1MenuAtrColl->begin();
+      for( ; chIt != lvl1MenuAtrColl->end(); ++chIt ) {
+
+         CondAttrListCollection::ChanAttrListPair idListPair = *chIt;
+
+         // the attributeList for this channel (a channel corresponds to a triggerItem)
+         CondAttrListCollection::ChanNum       ctpid   = idListPair.first;
+         CondAttrListCollection::AttributeList atrList = idListPair.second;
+
+         TrigConf::TriggerItem* ti = createLvl1TriggerItem( atrList );
+
+         ti->setCtpId( ( int ) ctpid ); // ChanNum is a typedef of uint32
+         m_ctpConfig.menu().addTriggerItem( ti ); // the menu takes the ownership of the TI
+      }
+
+      ATH_MSG_INFO( "  Number of items: " << nCh );
+      if( msgLvl( MSG::DEBUG ) ) {
+         m_ctpConfig.print();
+      }
+   }
+
+   // read the LVL1 PITs
+   if( update_LVL1PIT ) {
+
+      const DataHandle< CondAttrListCollection > lvl1PitAtrColl;
+      CHECK( m_detstore->retrieve( lvl1PitAtrColl, TRIGGER_CONF_LVL1PIT ) );
+
+      ATH_MSG_INFO( "Updating trigger configuration: LVL1 PITs" );
+
+      CondAttrListCollection::size_type nCh = lvl1PitAtrColl->size();
+
+      CondAttrListCollection::const_iterator chIt = lvl1PitAtrColl->begin();
+      for( ; chIt != lvl1PitAtrColl->end(); ++chIt ) {
+
+         CondAttrListCollection::ChanAttrListPair idListPair = *chIt;
+
+         // the attributeList for this channel (a channel corresponds to a PIT)
+         CondAttrListCollection::ChanNum       pitNumber = idListPair.first;
+         CondAttrListCollection::AttributeList atrList   = idListPair.second;
+
+         TrigConf::PIT* pit = readLvl1InputMap( atrList );
+
+         pit->setPitNumber( ( int ) pitNumber );   // ChanNum is a typedef of uint32
+         m_ctpConfig.menu().addPit( pit );  // the menu takes the ownership of the TI
+      }
+
+      ATH_MSG_INFO( "  Number of PITs: " << nCh );
+      if( msgLvl( MSG::DEBUG ) ) {
+         m_ctpConfig.print();
+      }
+   }
+
+   // read the HLT Menu object
+   if( update_HLTMENU ) {
+
+      const DataHandle< CondAttrListCollection > hltMenuAtrColl;
+      CHECK( m_detstore->retrieve( hltMenuAtrColl, TRIGGER_CONF_HLTMENU ) );
+
+      ATH_MSG_INFO( "Updating trigger configuration: HLT menu" );
+
+      m_hltFrame.theHLTChainList().clear();
+      m_hltFrame.theHLTSequenceList().clear();
+
+      size_t nChains(0);
+      for(CondAttrListCollection::const_iterator attrListIt = hltMenuAtrColl->begin(); attrListIt != hltMenuAtrColl->end(); attrListIt++ ) {
+
+         CondAttrListCollection::AttributeList attrList = attrListIt->second;
+
+         m_hltFrame.theHLTChainList().addHLTChain( createHLTChain( attrList, &m_hltFrame.theHLTSequenceList() ) );
+
+         nChains++;;
+      }
+//       CondAttrListCollection::size_type nCh = hltMenuAtrColl->size();
+//       for( CondAttrListCollection::ChanNum ch = 0; ch != nCh; ++ch ) {
+
+//          // the attributeList for this channel (a channel corresponds to a chain)
+
+//          CondAttrListCollection::const_iterator attrListIt = hltMenuAtrColl->chanAttrListPair( ch );
+
+//          if( attrListIt == hltMenuAtrColl->end() )
+//             continue;
+
+//          CondAttrListCollection::AttributeList atrList =
+//             hltMenuAtrColl->chanAttrListPair( ch )->second;
+//          m_hltFrame.theHLTChainList().addHLTChain( createHLTChain( atrList, &m_hltFrame.theHLTSequenceList() ) );
+         
+//       }
+      ATH_MSG_INFO( "  Number of chains: " << nChains );
+      ATH_MSG_DEBUG( m_hltFrame.chains() );
+
+      updated_HLTMenu = true;
+   }
+
+   if( update_HLTPS ) {
+
+      const DataHandle< CondAttrListCollection > prescaleAL;
+      const DataHandle< AthenaAttributeList > keysAL;
+      const DataHandle< CondAttrListCollection > hltMenuAtrColl;
+
+      CHECK( m_detstore->retrieve( prescaleAL, TRIGGER_CONF_HLTPS ) );
+      CHECK( m_detstore->retrieve( keysAL,     TRIGGER_CONF_HLTPSK ) );
+      CHECK( m_detstore->retrieve( hltMenuAtrColl, TRIGGER_CONF_HLTMENU ) );
+
+      ATH_MSG_INFO( "Updating trigger configuration: HLT prescale key and prescales" );
+
+      if( m_prescaleSet ) {
+         delete m_prescaleSet;
+         m_prescaleSet = 0;
+      }
+      m_prescaleSet = new HLTPrescaleSet();
+
+      // set the key
+      m_hltPsKey = readHltPrescaleKey( *keysAL );
+      m_prescaleSet->setId( m_hltPsKey );
+
+      // set the HLT merged/not merged chains
+      bool mergedHLT = false;
+      CondAttrListCollection::const_iterator attrListIt = hltMenuAtrColl->begin();
+      CondAttrListCollection::AttributeList attrList = attrListIt->second;
+      if (attrList["ChainName"].data<cool::String255>().find("HLT") != std::string::npos) mergedHLT=true;
+
+
+      ATH_MSG_INFO( "  LB-bound HLT prescale key : " << m_hltPsKey );
+
+      // set the prescale, pass-through and rerun-prescale values
+      CondAttrListCollection::size_type nCh = prescaleAL->size();
+      uint npositivepsL2( 0 );
+      uint npositivepsEF( 0 );
+      uint npositivepsHLT( 0 );
+
+      CondAttrListCollection::const_iterator chIt = prescaleAL->begin();
+      for( ; chIt != prescaleAL->end(); ++chIt ) {
+
+         CondAttrListCollection::ChanAttrListPair idListPair = *chIt;
+
+         // the attributeList for this channel (a channel corresponds to a triggerItem)
+         CondAttrListCollection::ChanNum       ch      = idListPair.first;
+         CondAttrListCollection::AttributeList atrList = idListPair.second;
+
+         float ps, pt, rrps;
+         readHltPrescale( atrList, ps, pt, rrps);
+         TrigConf::HLTLevel level = (mergedHLT ? HLT :( ( ch % 2 ==0 ) ? L2 : EF));
+	 unsigned int cc = ch;
+	 if (! mergedHLT ) cc /= 2;
+	 else cc -= 20000;
+
+         if( ( level == L2 ) && ( ps > 0.0 ) ) ++npositivepsL2;
+         if( ( level == EF ) && ( ps > 0.0 ) ) ++npositivepsEF;
+         if( ( level == HLT ) && ( ps > 0.0 ) ) ++npositivepsHLT;
+
+         m_prescaleSet->thePrescale(cc,level).
+            setPrescale(ps).
+            setPassThrough(pt).
+            setRerunPrescale("",rrps);
+      }
+
+      ATH_MSG_INFO( "  Number of L2+EF HLT prescales: " << nCh );
+      ATH_MSG_INFO( "  Number of positive prescales at L2: " << npositivepsL2 );
+      ATH_MSG_INFO( "  Number of positive prescales at EF: " << npositivepsEF );
+      ATH_MSG_INFO( "  Number of positive prescales at HLT: " << npositivepsHLT );
+
+      updated_newHLTPs = true;
+      if( msgLvl( MSG::DEBUG ) ) {
+	  m_prescaleSet->print();
+      }
+   }
+
+   // read the lb-wise configuration keys (LVL1 prescale key)
+   if( update_LVL1KEY ) {
+
+      const DataHandle< AthenaAttributeList > keysAtrList;
+      CHECK( m_detstore->retrieve( keysAtrList, TRIGGER_CONF_LVL1KEY ) );
+
+      ATH_MSG_INFO( "Updating trigger configuration: LVL1 keys" );
+      readLvl1ConfigKey( *keysAtrList, m_lvl1PsKey );
+      ATH_MSG_INFO( "  LVL1 prescale key: " << m_lvl1PsKey );
+   }
+
+   // read the lb-wise prescale set object
+   if( update_LVL1PS ) {
+
+      const DataHandle< CondAttrListCollection > lvl1PsAtrColl;
+      CHECK( m_detstore->retrieve( lvl1PsAtrColl, TRIGGER_CONF_LVL1PS ) );
+
+      ATH_MSG_INFO( "Updating trigger configuration: LVL1 prescales" );
+
+      CondAttrListCollection::size_type nCh = lvl1PsAtrColl->size();
+
+      ATH_MSG_INFO( "  Number of prescales: " << nCh );
+
+      if( nCh != 256 &&  nCh != 512 ) {
+         //REPORT_MESSAGE( MSG::FATAL )
+         ATH_MSG_FATAL( "Number of prescales is not 256 or 512, but " << nCh );
+         return StatusCode::FAILURE;
+      }
+
+      TrigConf::PrescaleSet pss;
+      pss.reset();
+      pss.resize(nCh);
+
+      int ps( 0 ); // the prescale value to be read
+      for( CondAttrListCollection::ChanNum ch = 0; ch != nCh; ++ch ) {
+
+         // the attributeList for this channel (a channel corresponds to a
+         // single prescale, the channel id is the ctpid)
+         CondAttrListCollection::AttributeList atrList =
+            lvl1PsAtrColl->chanAttrListPair( ch )->second;
+
+         readLvl1Prescale( atrList, ps );
+         pss.setPrescale( ch, ps );
+      }
+
+      if( msgLvl( MSG::DEBUG ) ) {
+         pss.print();
+      }
+
+      m_ctpConfig.setPrescaleSet( pss ); // overwrites the old one
+   }
+
+   if( update_HLTGRP ) {
+
+      const DataHandle< CondAttrListCollection > hltgrpAtrColl;
+      CHECK( m_detstore->retrieve( hltgrpAtrColl, TRIGGER_CONF_HLTGRP ) );
+      ATH_MSG_INFO( "Updating trigger configuration: HLT chain groups" );
+
+
+      size_t nGroups(0);
+      for(CondAttrListCollection::const_iterator attrListIt = hltgrpAtrColl->begin(); attrListIt != hltgrpAtrColl->end(); attrListIt++ ) {
+
+         CondAttrListCollection::AttributeList attrList = attrListIt->second;
+
+         addGroupsToHltChain( attrList, m_hltFrame.theHLTChainList() );
+
+         nGroups++;;
+      }
+      ATH_MSG_INFO( "  Number of groups: " << nGroups );
+   }
+
+   if( update_LVL1THR ) {
+
+      const DataHandle< CondAttrListCollection > l1thrAtrColl;
+      CHECK( m_detstore->retrieve( l1thrAtrColl, TRIGGER_CONF_LVL1THR ) );
+      ATH_MSG_INFO( "Updating trigger configuration: LVL1 thresholds" );
+
+      CondAttrListCollection::size_type nCh = l1thrAtrColl->size();
+
+      ATH_MSG_INFO( "  Number of thresholds: " << nCh );
+      
+      for( CondAttrListCollection::ChanNum ch = 0; ch != nCh; ++ch ) {
+         CondAttrListCollection::AttributeList atrList =
+            l1thrAtrColl->chanAttrListPair( ch )->second;
+         TrigConf::TriggerThreshold* thr = createLvl1Threshold( atrList );
+
+         // special cases of JetWeights and METSigParams
+         if( thr->name() == "METSigParams" ) {
+
+            string pars = thr->cableName();
+            std::vector< std::string > parv = TrigConf::split( pars, "," );
+            int xsSigmaScale  = lexical_cast< int, std::string >( parv[ 0 ] );
+            int xsSigmaOffset = lexical_cast< int, std::string >( parv[ 1 ] );
+            int xeMin         = lexical_cast< int, std::string >( parv[ 2 ] );
+            int xeMax         = lexical_cast< int, std::string >( parv[ 3 ] );
+            int teSqrtMin     = lexical_cast< int, std::string >( parv[ 4 ] );
+            int teSqrtMax     = lexical_cast< int, std::string >( parv[ 5 ] );
+            TrigConf::CaloInfo& caloInfo =
+               const_cast< TrigConf::CaloInfo& >( thresholdConfig()->caloInfo() );
+            caloInfo.metSigParam().setValues( xsSigmaScale, xsSigmaOffset,
+                                              xeMin, xeMax, teSqrtMin, teSqrtMax );
+
+         } else if( thr->name() == "JetWeights" ) {
+
+            string jws = thr->cableName();
+            std::vector< std::string > jwv = TrigConf::split( jws, "," );
+            TrigConf::CaloInfo& caloInfo =
+               const_cast< TrigConf::CaloInfo& >( thresholdConfig()->caloInfo() );
+            for(const string& s: jwv)
+               caloInfo.addJetWeight( lexical_cast< int, std::string >( s ) );
+
+         } else {
+            m_ctpConfig.menu().addTriggerThreshold( thr );
+         }
+      }
+
+      m_ctpConfig.menu().thresholdConfig().attributeThresholdNumbers();
+   }
+
+   if( update_LVL1ITD ) {
+
+      const DataHandle< CondAttrListCollection > l1itemdefAtrColl;
+      CHECK( m_detstore->retrieve( l1itemdefAtrColl, TRIGGER_CONF_LVL1ITD ) );
+      ATH_MSG_INFO( "Updating trigger configuration: LVL1 item definition" );
+
+      CondAttrListCollection::const_iterator chIt = l1itemdefAtrColl->begin();
+      for( ; chIt != l1itemdefAtrColl->end(); ++chIt ) {
+
+         CondAttrListCollection::ChanAttrListPair idListPair = *chIt;
+
+         // the attributeList for this channel (a channel corresponds to a triggerItem)
+         CondAttrListCollection::ChanNum       ctpid   = idListPair.first;
+         CondAttrListCollection::AttributeList atrList = idListPair.second;
+
+         TrigConf::TriggerItem* l1item = m_ctpConfig.menu().findTriggerItem( ctpid );
+
+         addThresholdsToTriggerItem( atrList, l1item,
+                                                                      m_ctpConfig.menu().thresholdVector() );
+      }
+      ATH_MSG_INFO( "  Number of items: " << l1itemdefAtrColl->size() );
+   }
+
+   // Bunchgroup keys
+   if( update_LVL1BGK ) {
+
+      const DataHandle< AthenaAttributeList > bgkcoll;
+      CHECK( m_detstore->retrieve( bgkcoll, TRIGGER_CONF_LVL1BGKEY ) );
+      ATH_MSG_INFO( "Updating trigger configuration: LVL1 bunchgroup keys" );
+
+      uint32_t old_lvl1BgKey = m_lvl1BgKey;
+      m_lvl1BgKey = readLvl1BGKey( *bgkcoll );
+      ATH_MSG_INFO( "  LVL1 bunchgroup key : " << m_lvl1BgKey );
+      m_bunchGroupSet->setId( m_lvl1BgKey ); // Update the BunchGroupSet object with the ID
+      updated_LVL1BG |= ( old_lvl1BgKey != m_lvl1BgKey );
+
+      if( ! m_lvl1BgKey ) updated_LVL1BG = true;
+   }
+
+   // Bunchgroup description
+   if( update_LVL1BGD ) {
+
+      const DataHandle< AthenaAttributeList > bgdesclist;
+      CHECK( m_detstore->retrieve( bgdesclist, TRIGGER_CONF_LVL1BGDESC ) );
+      ATH_MSG_INFO( "Updating trigger configuration: LVL1 bunchgroup description "
+                    << "(name + item)" );
+
+      std::pair< std::vector< std::string >, std::map< unsigned int, unsigned char > > bgdesc =
+         readLvl1BGDesc( *bgdesclist );
+
+      // A little sanity check:
+      if( bgdesc.first.size() != 8 ) {
+         REPORT_MESSAGE( MSG::FATAL )
+            << "The bunchgroup descriptions are not in the expected format";
+         return StatusCode::FAILURE;
+      }
+
+      // the 8 BG names
+      std::vector< std::string >& m_bgnames = bgdesc.first;
+
+      for( int i = 0; i < 8; ++i ) {
+         m_bunchGroupSet->setBGName( i, m_bgnames[ i ] );
+      }
+
+      for( unsigned int i = 0; i < 256; ++i ) {
+         m_itembgs[ i ] = bgdesc.second[ i ];
+      }
+   }
+
+   // Bunchgroup content
+   if( update_LVL1BGC ) {
+
+      const DataHandle< AthenaAttributeList > bgcontlist;
+      CHECK( m_detstore->retrieve( bgcontlist, TRIGGER_CONF_LVL1BGDEF ) );
+      ATH_MSG_INFO( "Updating trigger configuration: LVL1 bunchgroup definition (BG names)" );
+
+      std::vector< TrigConf::BunchGroup > bgs = readLvl1BGContent( *bgcontlist );
+
+      // if a previous BGS exists let's copy over the names
+      if( m_bunchGroupSet ) {
+         for( int i = 0; i < 8; ++i ) {
+            bgs[ i ].setName( m_bunchGroupSet->bunchGroups()[ i ].name() );
+         }
+         delete m_bunchGroupSet;
+      }
+
+      m_bunchGroupSet = new TrigConf::BunchGroupSet( bgs );
+      m_bunchGroupSet->setId( m_lvl1BgKey ); // Update the BunchGroupSet object with the ID
+   }
+
+   // update prescales in all places
+   // | updated_Menu | updated_newHLTPs | comment                                       | action
+   // |     yes      |       yes        | new style file, begin of new run              | prescaleset -> chainlist
+   // |     no       |       yes        | new style file, begin of new lb               | prescaleset -> chainlist
+   // |     yes      |       no         | old style file                                | chainlist -> prescaleset
+   // |     no       |       no         | during run when only l1 prescales are updated | none
+
+   if( updated_newHLTPs ) {
+      // new style file: prescaleset -> chainlist
+      set_ChainlistFromHltPrescaleSet();
+   } else if( updated_HLTMenu ) {
+      // old style file: chainlist -> prescaleset
+      set_HltPrescaleSetFromChainlist();
+   }
+
+   ////changed here || for &&, if Lvl1 there but hlt not, it crashes
+   if( updated_HLTMenu && updated_LVL1Menu ) {
+      m_hltFrame.theHLTChainList().setL2LowerChainCounter( &m_ctpConfig );
+   }
+
+   if( updated_HLTMenu ) {
+      setEFLowerChainCounter();
+   }
+
+   // Fire incident (used by TrigDecisionTool to update cached menu)
+   ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
+   if( incSvc.retrieve().isFailure() ) {
+      ATH_MSG_WARNING( "Cannot retrieve IncidentSvc" );
+      return StatusCode::SUCCESS;
+   }
+   
+   // prefered
+   std::string incname = "";
+   if( updated_HLTMenu )  incname += "HLTMenu";
+   if( updated_LVL1Menu ) incname += "L1Menu";
+   if( updated_LVL1Ps )   incname += "L1PS";
+   if( updated_newHLTPs ) incname += "HLTPS";
+   incSvc->fireIncident( Incident( incname, "TrigConf" ) );
+
+   return StatusCode::SUCCESS;
+}
+
+void
+TrigConf::DSConfigSvc::setEFLowerChainCounter() {
+   for(HLTChain* ch: m_hltFrame.theHLTChainList()) {
+      if( ch->level_enum() != EF ) continue;
+      unsigned int lower_chain_counter = -1;
+      if(ch->lower_chain_name() != "") {
+         HLTChain* lowerChain = m_hltFrame.theHLTChainList().chain(ch->lower_chain_name());
+         if(lowerChain) lower_chain_counter = lowerChain->chain_counter();
+      }
+      ch->set_lower_chain_counter( lower_chain_counter );
+   }
+}
+
+
+void
+TrigConf::DSConfigSvc::set_ChainlistFromHltPrescaleSet() {
+ 
+   ATH_MSG_INFO( "Copying entries from the HLT prescale set to the chains" );
+
+   m_hltPsKey = m_prescaleSet->id();
+   m_hltFrame.theHLTChainList().applyPrescaleSet(m_prescaleSet);
+}
+
+void
+TrigConf::DSConfigSvc::set_HltPrescaleSetFromChainlist() {
+
+   ATH_MSG_INFO( "Copying entries from the chains to the HLT prescale set" );
+
+   delete m_prescaleSet;
+
+   m_prescaleSet = m_hltFrame.chains().extractPrescaleSet();
+   m_prescaleSet->setId( m_hltPsKey );
+}
+
+StatusCode
+TrigConf::DSConfigSvc::updatePrescaleSets(uint /*requestcount*/) {
+   return StatusCode::SUCCESS;
+}
+
+// This method is called by TrigSteer on *every* event (keep it fast)
+// This is never used in connection with COOL configuration data
+StatusCode
+TrigConf::DSConfigSvc::assignPrescalesToChains(uint /*lumiblock*/) {
+   return StatusCode::SUCCESS;
+}
+
+bool 
+TrigConf::DSConfigSvc::hasFolder( const std::string& folder_name ){
+
+   if( m_folders.find( folder_name ) != string::npos ) {
+      return true;
+   } else {
+      return false;
+   }
+}
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..f2456d5a1c090052c80216df9b0272d421d97180
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTConfigSvc.cxx
@@ -0,0 +1,479 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// class declaration
+#include "TrigConfigSvc/HLTConfigSvc.h"
+
+#include <exception>
+#include <vector>
+
+// Athena/Gaudi includes:
+#include "PathResolver/PathResolver.h"
+#include "EventInfo/EventInfo.h"
+#include "EventInfo/EventID.h"
+
+#include "GaudiKernel/ServiceHandle.h"
+#include "GaudiKernel/IIncidentSvc.h"
+#include "GaudiKernel/Incident.h"
+#include "GaudiKernel/IJobOptionsSvc.h"
+#include "GaudiKernel/ITHistSvc.h"
+#include "GaudiKernel/Timing.h"
+
+// Root incluces:
+#include "TH1F.h"
+#include "TH2I.h"
+
+// Local includes:
+#include "TrigConfBase/TrigDBConnectionConfig.h"
+#include "TrigConfStorage/StorageMgr.h"
+#include "TrigConfStorage/IStorageMgr.h"
+#include "TrigConfStorage/XMLStorageMgr.h"
+#include "TrigConfStorage/IHLTPrescaleSetLoader.h"
+#include "TrigConfStorage/IHLTPrescaleSetCollectionLoader.h"
+#include "TrigConfL1Data/HelperFunctions.h"
+#include "TrigConfL1Data/CTPConfig.h" 
+#include "TrigConfHLTData/HLTFrame.h"
+#include "TrigConfHLTData/HLTChainList.h"
+#include "TrigConfHLTData/HLTSequenceList.h"
+#include "TrigConfHLTData/HLTPrescaleSet.h"
+#include "TrigConfHLTData/HLTPrescaleSetCollection.h"
+#include "TrigMonitorBase/TrigLockedHist.h"
+
+#include "boost/algorithm/string/case_conv.hpp"
+#include "boost/lexical_cast.hpp"
+
+using namespace std;
+using namespace TrigConf;
+
+bool hasLBPSKList(const string & dbHLTPSKeySet) {
+   return (dbHLTPSKeySet != "" && dbHLTPSKeySet != "[]"); // empty list can be "" or "[]" (change comes with the new DBConnection class)
+}
+
+
+
+HLTConfigSvc::HLTConfigSvc( const string& name, ISvcLocator* pSvcLocator ) :
+   base_class(name, pSvcLocator),
+   m_eventStore(0),
+   m_currentLumiblock(0),
+   m_currentPSS(0),
+   m_partition(""),
+   m_histProp_timePrescaleUpdate(Gaudi::Histo1DDef("Time for prescale update",0,200,100)),
+   m_hist_timePrescaleUpdate(0),
+   m_hist_prescaleLB(0),
+   m_PartitionName("")
+{
+   base_class::declareCommonProperties();
+
+   declareProperty( "DBHLTPSKey",       m_dbHLTPSKey );
+   declareProperty( "DBHLTPSKeySet",    m_dbHLTPSKeySet,
+                    "List of HLT Prescale keys associated with start Lumiblocks LB1uPSK1cLB2uPSK2" );
+   declareProperty( "HistTimePrescaleUpdate", m_histProp_timePrescaleUpdate,
+                    "Histogram of time for prescale update");
+   declareProperty( "PartitionName",    m_PartitionName,
+                    "Name of the partition for the trigger prescale update mechanism");
+   declareProperty( "doMergedHLT",      m_setMergedHLT,
+                    "Set true to run the merged HLT processing");
+}
+
+HLTConfigSvc::~HLTConfigSvc()
+{}
+
+
+const HLTChainList*
+HLTConfigSvc::chainList() const {
+   return &m_HLTFrame.getHLTChainList();
+}
+
+
+const HLTChainList&
+HLTConfigSvc::chains() const {
+   return m_HLTFrame.getHLTChainList();
+}
+
+
+const HLTSequenceList*
+HLTConfigSvc::sequenceList() const {
+   return &m_HLTFrame.getHLTSequenceList();
+}
+
+
+const HLTSequenceList&
+HLTConfigSvc::sequences() const {
+   return m_HLTFrame.getHLTSequenceList();
+}
+
+
+StatusCode
+HLTConfigSvc::initialize() {
+
+   CHECK(ConfigSvcBase::initialize());
+
+   if( !fromDB() and m_xmlFile=="NONE" ) {
+      ATH_MSG_INFO("xml file set to NONE, will not load HLT Menu");
+      return StatusCode::SUCCESS;
+   }
+
+
+   // get the partition name
+   // non-empty job-property overwrite value from DataFlowConfig
+   if(m_PartitionName.value() !="") {
+      m_partition = m_PartitionName;
+   } else {
+      ServiceHandle<IJobOptionsSvc> jobOptionsSvc("JobOptionsSvc", name());
+      if (jobOptionsSvc.retrieve().isFailure()) {
+         ATH_MSG_WARNING("Cannot retrieve JobOptionsSvc");
+      } else {
+         const Property* p=Gaudi::Utils::getProperty( jobOptionsSvc->getProperties("DataFlowConfig"), "DF_PartitionName");   
+         if (p != 0) m_partition = p->toString();
+      }
+   }
+
+
+   if( fromDB() ) {
+      ATH_MSG_INFO("    DB HLT PrescaleKey  = " << m_dbHLTPSKey);
+      ATH_MSG_INFO("    DB HLT PrescaleKeys = " << m_dbHLTPSKeySet);
+   }
+   ATH_MSG_INFO("    Partition           = " << m_partition);
+   ATH_MSG_INFO("    Run merged HLT      = " << m_setMergedHLT);
+
+
+   if( m_dbHLTPSKey!=0 && hasLBPSKList(m_dbHLTPSKeySet)  )
+      ATH_MSG_WARNING("DBHLTPSKey and DBHLTPSKeySet both specified, the DBHLTPSKeySet will be ignored");
+
+   // Read the HLT configuration
+   m_HLTFrame.setMergedHLT( m_setMergedHLT );
+   m_HLTFrame.setSMK( m_dbSMKey );
+   if( m_dbHLTPSKey > 0) {
+      m_HLTFrame.thePrescaleSetCollection().set_prescale_key_to_load( m_dbHLTPSKey );
+   } else if( hasLBPSKList(m_dbHLTPSKeySet) ) {
+      // LB1uPSK1cLB2uPSK2..., meaning from LB1 use PSK1, change at LB2 use PSK2, ...
+      vector<pair<unsigned int, unsigned int> > all_lbnpsk;
+      for( const string& lbupsk: split( m_dbHLTPSKeySet, "c") ) {
+         auto lbpsk = split(lbupsk, "u" );
+         all_lbnpsk.push_back(std::make_pair<unsigned int, unsigned int>(atoi(lbpsk[0].c_str()),atoi(lbpsk[1].c_str())) );
+      }
+      m_HLTFrame.thePrescaleSetCollection().set_prescale_keys_to_load( all_lbnpsk );         
+   }
+
+   CHECK(initStorageMgr());
+
+   try {
+      if( ! m_storageMgr->hltFrameLoader().load( m_HLTFrame ) ){
+         ATH_MSG_ERROR("Selected keys could not be loaded");
+         return StatusCode::FAILURE;
+      }
+      ATH_MSG_VERBOSE("HLTFrame configuration object loaded");
+   }
+   catch (exception & e) {
+      ATH_MSG_ERROR("Standard exception caught: " << e.what());
+      return StatusCode::FAILURE;
+   }
+
+   CHECK(freeStorageMgr());
+
+   // populate the lower_chain_counter of the EF chains. 
+   // to do so, take the EF chain's lower_chain_name and loop through 
+   // all L2 chains to find the matching chain_counter 
+
+   for( HLTChain* ch: m_HLTFrame.chains() ) {
+      if( ch->level_enum() != EF ) continue;
+      unsigned int lower_chain_counter = -1;
+      if(ch->lower_chain_name() != "") {
+         HLTChain* lowerChain = m_HLTFrame.chains().chain(ch->lower_chain_name());
+         if(lowerChain) lower_chain_counter = lowerChain->chain_counter();
+      }
+      ch->set_lower_chain_counter( lower_chain_counter );
+   }
+   
+   // print the menu after loading 
+   if (msgSvc()->outputLevel() <= MSG::VERBOSE) {
+      m_HLTFrame.print("  ", 5);
+   } else if (msgSvc()->outputLevel() <= MSG::DEBUG) {
+      m_HLTFrame.print("  ", 3);
+   } else if (msgSvc()->outputLevel() <= MSG::INFO) {
+      m_HLTFrame.print("  ",m_printMenuLevel);
+   }
+   m_HLTFrame.getPrescaleSetCollection().print();
+
+   ServiceHandle<IIncidentSvc> incSvc("IncidentSvc",name());
+   if (incSvc.retrieve().isFailure()) {
+      ATH_MSG_WARNING("Cannot retrieve IncidentSvc");
+   } else {
+      string incname("HLTMenu HLTPS");
+      incSvc->fireIncident( Incident(incname, "TrigConf") );
+      ATH_MSG_INFO("Fired Incident 'TrigConf' - " << incname);
+   }
+
+   CHECK(service("StoreGateSvc", m_eventStore, /*createIf=*/false));
+   
+   ATH_MSG_INFO("finish initialize");
+
+   return StatusCode::SUCCESS;
+}
+
+
+/***********************************************************
+ * start() is called by Gaudi::ServiceManager::addService()
+ * which adds the  service to the active list
+ *
+ * Online this is called during prepareForRun() going from
+ * from CONNECTED to PREPARED
+ ***********************************************************/
+StatusCode
+TrigConf::HLTConfigSvc::start() {
+
+   ATH_MSG_INFO("HLTConfigSvc::start");
+
+   // Book histograms
+   bookHistograms().ignore();
+   m_currentLumiblock = 0;
+
+   if( ! fromDB() ) // xml config
+      return StatusCode::SUCCESS;
+
+   // if the m_dbHLTPSKeySet is set then we don't need to load any
+   // prescales 
+   if( hasLBPSKList(m_dbHLTPSKeySet) )
+      return StatusCode::SUCCESS;
+
+   // also load the prescale set for the initial HLT PSK into the PrescaleSetCollection
+   if(m_dbHLTPSKey>0) {
+
+      ATH_MSG_INFO("Loading PrescaleSet for initial HLT PSK: " << m_dbHLTPSKey);
+
+      // Make sure we are starting with an empty prescale set collection
+      m_HLTFrame.thePrescaleSetCollection().clear();
+ 
+      HLTPrescaleSet* pss = new HLTPrescaleSet();
+      pss->setId(m_dbHLTPSKey);
+
+      CHECK(initStorageMgr());
+
+      bool loadSuccess = dynamic_cast<TrigConf::StorageMgr*>(m_storageMgr)->hltPrescaleSetLoader().load( *pss );
+
+      CHECK(freeStorageMgr());
+
+      if(!loadSuccess) return StatusCode::FAILURE;
+
+      m_HLTFrame.thePrescaleSetCollection().setPrescaleSet(pss); // assumes LB=0
+
+      applyPrescaleSet(*pss);
+    
+      ATH_MSG_INFO( m_HLTFrame.getPrescaleSetCollection() );
+   }
+  
+   return StatusCode::SUCCESS;
+}
+
+
+void
+TrigConf::HLTConfigSvc::applyPrescaleSet(const TrigConf::HLTPrescaleSet& pss) {
+
+  ATH_MSG_INFO("Applying PSK " << pss.id() << " to menu ");
+  const EventInfo* pEvent(0);
+  if (   m_eventStore && m_eventStore->retrieve(pEvent).isSuccess() ) {
+     ATH_MSG_INFO("on event " << *pEvent->event_ID());
+  }
+
+  m_HLTFrame.theHLTChainList().applyPrescaleSet(&pss);
+
+  m_currentPSS = pss.id();
+
+}
+
+
+StatusCode
+TrigConf::HLTConfigSvc::bookHistograms() {
+
+   ServiceHandle<ITHistSvc> histSvc("THistSvc", name());
+
+   CHECK(histSvc.retrieve());
+
+   const std::string histPath = "/EXPERT/" + name() + "/";
+
+   m_hist_timePrescaleUpdate = new TH1F("TimePrescaleUpdate",
+                                        (m_histProp_timePrescaleUpdate.value().title() + ";time [ms]").c_str(),
+                                        m_histProp_timePrescaleUpdate.value().bins(),
+                                        m_histProp_timePrescaleUpdate.value().lowEdge(),
+                                        m_histProp_timePrescaleUpdate.value().highEdge());
+   const int nLB(1), nKey(1);
+   m_hist_prescaleLB = new TH2I("PrescaleKey_LB","Prescale key used in LB;Lumiblock;Prescale key",
+                                nLB, 0, nLB, nKey, 0, nKey);
+
+   // try to register, delete if failure
+   TH1** hists[] = { (TH1**)&m_hist_timePrescaleUpdate,
+                     (TH1**)&m_hist_prescaleLB };
+   for ( TH1** h: hists ) {
+      if ( *h && histSvc->regHist(histPath + (*h)->GetName(), *h).isFailure() ) {
+         ATH_MSG_WARNING("Cannot register histogram " << (*h)->GetName());
+         delete *h;
+         *h = 0;
+      }
+   }
+
+   return StatusCode::SUCCESS;
+}
+
+
+StatusCode
+TrigConf::HLTConfigSvc::finalize() {
+   ATH_MSG_DEBUG("Finalizing");
+   CHECK(AthService::finalize());
+   return StatusCode::SUCCESS;
+}
+
+
+StatusCode
+TrigConf::HLTConfigSvc::queryInterface( const InterfaceID& riid, void** ppvIF ) {
+   StatusCode sc = StatusCode::FAILURE;
+
+   if (ppvIF) {
+      *ppvIF = 0;
+
+      if (riid == IHLTConfigSvc::interfaceID()) {
+         try {
+            *ppvIF = dynamic_cast<IHLTConfigSvc*>( this );
+         }
+         catch( std::bad_cast ) {
+            return StatusCode::FAILURE;
+         }
+         sc = StatusCode::SUCCESS;
+      }
+      else {
+         sc = Service::queryInterface( riid, ppvIF );
+      }
+
+   }
+
+   if ( sc.isSuccess() ) addRef();
+   return sc;
+
+}
+
+uint32_t
+TrigConf::HLTConfigSvc::masterKey() const {
+   return m_HLTFrame.smk();
+}
+
+uint32_t
+TrigConf::HLTConfigSvc::hltPrescaleKey() const {
+   uint32_t key = m_HLTFrame.getPrescaleSet() ? m_HLTFrame.getPrescaleSet()->id() : 0;
+   return key;
+}
+
+void
+TrigConf::HLTConfigSvc::setL2LowerChainCounter(const CTPConfig* ctpcfg) {
+   m_HLTFrame.theHLTChainList().setL2LowerChainCounter(ctpcfg);
+}
+
+
+
+// query the TriggerDB for the list of lumiblocks and corresponding prescalekeys
+// will then load the and prescaleSets that have not yet been loaded
+StatusCode
+TrigConf::HLTConfigSvc::updatePrescaleSets(uint requestcount) {
+
+   if( ! fromDB() ) { // xml 
+      ATH_MSG_WARNING("Configured to not run from the database!");
+      return StatusCode::SUCCESS;
+   }
+   
+   if( hasLBPSKList(m_dbHLTPSKeySet) ) {
+      ATH_MSG_WARNING("Has list of [(lb1,psk1), (lb2,psk2),...] defined!");
+      return StatusCode::SUCCESS;
+   }
+
+   // Start timer
+   longlong t1_ms = System::currentTime(System::milliSec);
+
+   // Load prescale set
+   CHECK(initStorageMgr());
+
+   bool loadSuccess = dynamic_cast<TrigConf::StorageMgr*>
+      (m_storageMgr)->hltPrescaleSetCollectionLoader().load( m_HLTFrame.thePrescaleSetCollection(), requestcount, m_partition );
+
+   CHECK(freeStorageMgr());
+
+   // Stop timer and fill histogram
+   uint64_t t2_ms = System::currentTime(System::milliSec);
+   if (m_hist_timePrescaleUpdate) m_hist_timePrescaleUpdate->Fill(t2_ms-t1_ms);
+
+   if(!loadSuccess) {
+      ATH_MSG_WARNING("HLTConfigSvc::updatePrescaleSets(): loading failed");
+      return StatusCode::FAILURE;
+   } else {
+      ATH_MSG_INFO ( m_HLTFrame.thePrescaleSetCollection() );
+   }
+   return StatusCode::SUCCESS;
+}
+
+
+// Helper for assignPrescalesToChains
+namespace {
+   inline void fillPrescaleHist(TH2I* h, uint lb, int psk) {
+      if (h==0) return;
+      // Use alpha-numeric bin labels to ensure correct gathering
+      char buf_psk[6], buf_lb[6];
+      snprintf(buf_psk, sizeof(buf_psk), "%d", psk);  // faster than stringstream
+      snprintf(buf_lb, sizeof(buf_lb), "%03d", lb);
+      // Save number of bins and perform a locked Fill
+      int xbins = h->GetNbinsX();    
+      int ybins = h->GetNbinsY();
+      lock_histogram_operation<TH2I> locked_hist(h);
+
+      locked_hist->Fill(buf_lb, buf_psk, 1);
+    
+      // Need to make sure that all bins have labels (see Savannah #58243)    
+      // Label additional bins on x-axis
+      if ( h->GetNbinsX()!=xbins ) {
+         const int N = h->GetNbinsX();
+         for (int b=xbins+2; b<=N; ++b) {
+            snprintf(buf_lb, sizeof(buf_lb), "%03d", ++lb);
+            locked_hist->GetXaxis()->SetBinLabel(b, buf_lb);
+         }
+      }
+      // Remove additional bins on y-axis
+      if ( h->GetNbinsY()!=ybins ) locked_hist->LabelsDeflate("Y");
+   }
+}
+
+
+// Assigns the prescales that are valid for a given lumiblock to the chains
+// This method is called by TrigSteer on *every* event (keep it fast)
+StatusCode
+TrigConf::HLTConfigSvc::assignPrescalesToChains(uint lumiblock) {
+
+   if(! fromDB() ) // xml
+      return StatusCode::SUCCESS;
+
+   if(lumiblock == m_currentLumiblock) {
+      fillPrescaleHist(m_hist_prescaleLB, lumiblock, m_currentPSS);
+      return StatusCode::SUCCESS;
+   }
+
+   m_currentLumiblock = lumiblock;
+   
+   // get the HLTPrescaleSet
+   const HLTPrescaleSet* pss = m_HLTFrame.getPrescaleSetCollection().prescaleSet(lumiblock);
+   if (pss == 0) {
+      ATH_MSG_ERROR("Could not retrieve HLT prescale set for lumiblock = " << lumiblock);
+      return StatusCode::FAILURE;
+   }
+
+   fillPrescaleHist(m_hist_prescaleLB, lumiblock, pss->id());
+   
+   // still the same HLTPSS -> nothing to do
+   if(pss->id() ==  m_currentPSS) {
+      return StatusCode::SUCCESS;
+   }
+
+   ATH_MSG_INFO("Changing PSK from " << m_currentPSS << " to " << pss->id()
+                << " for lumiblock " << lumiblock);
+
+   applyPrescaleSet(*pss);
+   
+   return StatusCode::SUCCESS;
+}
+
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTJobOptionsSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTJobOptionsSvc.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..ee1e20d06b422b5d93697f5cec5ff1effd2fa56d
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/HLTJobOptionsSvc.cxx
@@ -0,0 +1,519 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include <exception>
+#include <vector>
+#include <string>
+#include <fstream>
+
+#include "GaudiKernel/Property.h"
+#include "PathResolver/PathResolver.h"
+
+// Local includes:
+#include "TrigConfigSvc/HLTJobOptionsSvc.h"
+#include "TrigConfBase/TrigDBConnectionConfig.h"
+#include "TrigConfL1Data/HelperFunctions.h"
+#include "TrigConfJobOptData/JobOptionTable.h"
+#include "TrigConfStorage/IJobOptionTableLoader.h"
+#include "TrigConfStorage/SessionMgr.h"
+#include "TrigConfStorage/StorageMgr.h"
+
+using namespace std;
+
+TrigConf::HLTJobOptionsSvc::HLTJobOptionsSvc( const std::string& name, ISvcLocator* pSvcLocator ) :
+   base_class( name, pSvcLocator ),
+   m_sourcePath(""),
+   m_sourceType("DB") // DB, FILE
+{
+   declareProperty( "TYPE", m_sourceType );
+   declareProperty( "PATH", m_sourcePath );
+}
+
+
+TrigConf::HLTJobOptionsSvc::~HLTJobOptionsSvc() 
+{}
+
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::HLTJobOptionsSvc::readEnv()
+{
+  // reads the setup from a file
+  // depreciated
+  return StatusCode::SUCCESS;
+}
+
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::HLTJobOptionsSvc::initialize() {
+
+   // CHECK(ConfigSvcBase::initialize());
+
+   ATH_MSG_INFO("Initializing the HLTJobOptionsSvc");
+
+   decltype(m_dbconfig->m_smkey) oldsmk{0};
+   if(m_dbconfig) {
+      ATH_MSG_INFO("TrigDBConnectionConfig before initialization: " << m_dbconfig->toString());
+      oldsmk = m_dbconfig->m_smkey;
+   }
+
+   if ( m_sourceType == "FILE" ) {
+      // Read job options from a text file
+      if ( readOptions( m_sourcePath, m_dirSearchPath ).isFailure() ) {
+         ATH_MSG_ERROR("error reading options");
+         return StatusCode::FAILURE;
+      }
+   } else if( m_sourceType == "DB" ) {
+
+      // this fills in all members of TrigDBConnectionConfig that are specified
+      // in the path string
+      m_dbconfig = std::unique_ptr<TrigDBConnectionConfig>{
+         new TrigDBConnectionConfig(m_sourcePath)};
+
+      ATH_MSG_INFO("TrigDBConnectionConfig for initialization: " << m_dbconfig->toString());
+
+      if (m_dbconfig->m_type == TrigDBConnectionConfig::DBLookup)
+         m_dbconfig->m_user = m_dbconfig->m_password = "";
+      
+      if(!oldsmk || oldsmk != m_dbconfig->m_smkey) {
+         if ( readDbWithMasterKey().isFailure() ) {
+            ATH_MSG_FATAL("Could not read DB with keys: " << m_dbconfig->m_smkey << "-" << m_dbconfig->m_hltkey << " - " << m_dbconfig->m_lvl1key);
+            return StatusCode::FAILURE;
+         }
+      } else {
+         ATH_MSG_INFO("HLTJobOptionsSvc holds already the configuration of SMK: " << m_dbconfig->m_smkey);
+      }
+
+   }
+
+   ATH_MSG_INFO("TrigDBConnectionConfig after initialization: " << m_dbconfig->toString());
+
+   return StatusCode::SUCCESS;
+}
+
+
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::HLTJobOptionsSvc::readDbWithMasterKey()
+//----------------------------------------------------------------------------
+{
+
+   if(m_sourceType=="FILE") {
+      ATH_MSG_ERROR("HLTJobOptionsSvc is configured to run from a file, cannot connect to database!");
+      return StatusCode::FAILURE;
+   }
+
+
+   CHECK(initStorageMgr());
+
+   int connectionTimeout=5;
+   dynamic_cast<TrigConf::StorageMgr*>(m_storageMgr)->sessionMgr().createSession(m_dbconfig->m_retrialPeriod,
+                                                                                 m_dbconfig->m_retrialPeriod*(m_dbconfig->m_maxRetrials+1),
+                                                                                 connectionTimeout);
+   
+   TrigConf::JobOptionTable jot;
+   jot.setSMK(m_dbconfig->m_smkey);
+   m_storageMgr->jobOptionTableLoader().load( jot );
+
+   freeStorageMgr();
+
+   //jot.print();
+
+   if( FillCatalogue(jot).isSuccess() ) {
+
+      //PrintCatalogue(msg().stream());
+
+      // Now we have to resolve still all the entries which are
+      // references to other Properties
+      if ( m_catalogue.resolveOptions(msg()).isSuccess() ) {
+         ATH_MSG_INFO("Job options successfully read in from " << m_dbconfig->toString());
+      } else {
+         ATH_MSG_FATAL("Job options references cannot be resolved.");
+         m_catalogue.printUnresolvedOptions(msg());
+         return StatusCode::FAILURE;
+      }
+   } else {
+      ATH_MSG_FATAL("Failed to read in job options");
+      return StatusCode::FAILURE;
+   }
+
+
+
+
+
+   return StatusCode::SUCCESS;
+}
+
+
+
+//----------------------------------------------------------------------------
+void
+TrigConf::HLTJobOptionsSvc::PrintCatalogue(ostream & os) const {
+
+   os << "++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
+   os << "Job options catalogue" << endl;
+
+   uint nc(0), np(0);
+
+   for(const string& algName: m_catalogue.getClients() ) {
+      nc++;
+      os << "Client: " << algName << endl;
+
+      vector<const Property*>* pl;
+
+      m_catalogue.optionsOf( algName, pl);
+
+      for(const Property* prop: *pl) {
+         np++;
+         os << "      property ";
+         prop->fillStream(os) << endl; // for Gaudi_V19
+         //(*plIt)->nameAndValueAsStream(os) << std::endl;
+      }
+   }
+   ATH_MSG_INFO("Job options catalogue contains " << nc << " clients with a total of " << np << " properties." << endl);
+}
+
+
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::HLTJobOptionsSvc::FillCatalogue(const JobOptionTable & jot) {
+
+   for(const JobOption& jo : jot.jobOptionVector() ) {
+
+      std::string client   = jo.component_alias();
+      std::string propName = jo.name();
+      std::string propVal  = jo.value();
+      std::vector<std::string> valArr;
+
+      bool isArrayProp = false;
+      if(propVal[0]=='[') { // indicates an array, start parsing
+         isArrayProp = true;
+         std::string::size_type pos = 1;
+         bool isStringtypeA = propVal.find('\"',pos) != std::string::npos;
+         bool isStringtypeB = propVal.find('\'',pos) != std::string::npos;
+         if(isStringtypeA||isStringtypeB) {
+            if(isStringtypeA){
+               while( (pos = propVal.find('\"',pos))!=std::string::npos) {
+                  int posEnd = propVal.find('\"',pos+1);
+                  std::string arrS = propVal.substr(pos,posEnd-pos+1);
+                  pos=posEnd+1;
+                  valArr.push_back(arrS);
+               }
+            }
+            if(isStringtypeB){
+               while( (pos = propVal.find('\'',pos))!=std::string::npos) {
+                  int posEnd = propVal.find('\'',pos+1);
+                  std::string arrS = propVal.substr(pos,posEnd-pos+1);
+                  pos=posEnd+1;
+                  valArr.push_back(arrS);
+               }
+            }
+         } else {
+            TrigConf::removeAllSpaces(propVal);
+            std::string propValNoBrackets = propVal.substr(1,propVal.rfind("]")-1);
+            valArr = split(propValNoBrackets, ",");
+         }
+      }
+      if( isArrayProp ) {
+         m_catalogue.addOption(client, new StringArrayProperty(propName, valArr));
+      } else  {
+         m_catalogue.addOption(client, new StringProperty(propName, propVal));
+      }
+   }
+   return StatusCode::SUCCESS;
+}
+
+
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::HLTJobOptionsSvc::finalize() {
+  ATH_MSG_DEBUG("Finalizing");
+  CHECK(Service::finalize());
+  return StatusCode::SUCCESS;
+}
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::HLTJobOptionsSvc::queryInterface( const InterfaceID& riid, void** ppvIF )
+//----------------------------------------------------------------------------
+{
+  if ( IJobOptionsSvc::interfaceID() == riid )  {
+    *ppvIF = (IJobOptionsSvc*) this;
+  } else if ( IProperty::interfaceID() == riid ) {
+    *ppvIF = (IProperty*) this;
+  } else  {
+    return Service::queryInterface(riid, ppvIF);
+  }
+  addRef();
+  return StatusCode::SUCCESS;
+}
+
+
+
+
+
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::HLTJobOptionsSvc::setMyProperties( const std::string& client, IProperty* myInt ) {
+
+   ATH_MSG_DEBUG("Client " << client << " has requested its options from HLTJobOptionsSvc");
+
+   StatusCode sc;
+
+   std::vector<Property*>::const_iterator propIt;
+   //   cout << "The following properties are defined for IProperty myInt" << endl;
+   //   for( propIt = myInt->getProperties().begin() ; propIt != myInt->getProperties().end(); propIt++ )   {
+   //     cout << " --- " << (*propIt)->name() << endl;
+   //   }
+
+
+
+   // now the list of job options for the client is sorted as it appears in the database
+   // but we need it in the order as it is defined in the client (myInt->getProperties())
+   // that is of particular importance for the ApplicationMgr, where the dll-jobOption needs to be set
+   // before the services
+
+   // define a sorted list of properties, which will be used from now on
+   std::vector<const Property*> myListSorted;
+   std::vector<const Property*>::const_iterator iter;
+   {
+      // Get the list of available (in the DB) options for this client
+      std::vector<const Property*>* myList;
+      sc = m_catalogue.optionsOf( client, myList );
+      if( !sc.isSuccess() ) return StatusCode::SUCCESS;  // Algorithm has no options
+
+      for( propIt = myInt->getProperties().begin(); propIt != myInt->getProperties().end(); propIt++ )   {
+         for( iter = myList->begin(); iter != myList->end(); iter++ ) {
+            if( (*iter)->name() == (*propIt)->name() ) {
+               myListSorted.push_back(*iter);
+               break;
+            }
+         }
+      }
+
+      if( myListSorted.size() != myList->size() ) {
+         //find the properties that differ between the two lists
+         std::vector<const Property*> myListDiffer;
+         for( iter = myList->begin(); iter != myList->end(); iter++ ) {
+            int getAmatch=0;
+            for(const Property* differ: myListSorted ) {
+               if( (*iter)->name() == differ->name() ) {
+                  getAmatch++;
+               }
+            }
+            if(getAmatch!=1){
+               myListDiffer.push_back(*iter);
+            }
+         }
+         ATH_MSG_WARNING(client << " asks for " << myListSorted.size() << " properties while the database knows about "
+                        << myList->size() << ", properties that differ are: ");
+         for(const Property*  differ: myListDiffer ) {
+            ATH_MSG_WARNING( "   " << differ->name() );
+         }
+      }
+
+   }
+
+   //   cout << "The following properties are found in the DB" << endl;
+   //   for(auto prop: myListSorted.begin() )   {
+   //     cout << prop->name() << endl;
+   //   }
+
+   bool fail = false;
+
+   // this is for the case of old configurations
+   if(client=="HLTConfigSvc") {
+      sc = myInt->setProperty( "DBHLTPSKeySet", m_dbconfig->hltKeysToString() );
+      if( !sc.isSuccess() ) {
+         ATH_MSG_ERROR("Unable to set StringProperty DBHLTPSKeySet to " << m_dbconfig->m_hltkeys);
+         fail = true;
+      } else {
+         ATH_MSG_DEBUG("Set property DBHLTPSKeySet to " << m_dbconfig->m_hltkeys);
+      }
+   }
+
+   // Iterate over the sorted list to set the options
+   for( iter = myListSorted.begin(); iter != myListSorted.end(); iter++ ) {
+
+      // some exceptions
+      // Go and Exit are used by LHCb
+      // They are bound to an updateHandler which starts the
+      // ApplicationMgr as soon as Go is set, and exits as soon as Exit
+      // is modified -- we don't want that
+      if(client=="ApplicationMgr" && (*iter)->name()=="Go") continue;
+      if(client=="ApplicationMgr" && (*iter)->name()=="Exit") continue;
+
+
+      sc = StatusCode::FAILURE;
+
+      const StringProperty* sp = dynamic_cast<const StringProperty*>(*iter);
+      if( 0 != sp ) {
+
+         std::string spval = sp->value();
+
+         ATH_MSG_DEBUG("Attempt to set property " << (*iter)->name() << " to " << spval);
+      
+         // now we have to intervene to get the HLTMenu and the Level 1 menu
+         // and thresholds from the database and not from the xml files
+         if(client=="HLTConfigSvc") {
+            if ((*iter)->name()=="ConfigSource") spval = m_dbconfig->m_type;
+            if ((*iter)->name()=="DBServer")     spval = m_dbconfig->m_server;
+            if ((*iter)->name()=="DBUser")       spval = m_dbconfig->m_user;
+            if ((*iter)->name()=="DBPassword")   spval = m_dbconfig->m_password;
+            if ((*iter)->name()=="DBTable")      spval = m_dbconfig->m_schema;
+            if ((*iter)->name()=="DBSMKey") {
+               std::ostringstream keystream;
+               keystream << m_dbconfig->m_smkey;
+               spval = keystream.str();
+            }
+            if ((*iter)->name()=="DBHLTPSKey") {
+               std::ostringstream keystream;
+               keystream << m_dbconfig->m_hltkey;
+               spval = keystream.str();
+            }
+            if ((*iter)->name()=="DBHLTPSKeySet") spval = m_dbconfig->hltKeysToString();
+         }
+
+
+
+         if(m_dbconfig->m_lvl1key && client=="LVL1ConfigSvc") {
+            if ((*iter)->name()=="ConfigSource") spval = m_dbconfig->m_type;
+            if ((*iter)->name()=="DBServer")     spval = m_dbconfig->m_server;
+            if ((*iter)->name()=="DBAccount")    spval = m_dbconfig->m_schema;
+            if ((*iter)->name()=="DBUser")       spval = m_dbconfig->m_user;
+            if ((*iter)->name()=="DBPass")       spval = m_dbconfig->m_password;
+            if ((*iter)->name()=="DBSMKey") {
+               std::ostringstream keystream;
+               keystream << m_dbconfig->m_smkey;
+               spval = keystream.str();
+            }
+            if ((*iter)->name()=="DBLVL1PSKey") {
+               std::ostringstream keystream;
+               keystream << m_dbconfig->m_lvl1key;
+               spval = keystream.str();
+            }
+         }
+
+         sc = myInt->setProperty( (*iter)->name(), spval );
+         if( !sc.isSuccess() ) {
+            ATH_MSG_ERROR("Unable to set StringProperty " << (*iter)->name() << " to " << spval);
+            fail = true;
+         } else {
+            ATH_MSG_DEBUG("Set property " << (*iter)->name() << " to " << spval);
+         }
+         continue;
+      }
+
+
+      const StringArrayProperty* sap = dynamic_cast<const StringArrayProperty*>(*iter);
+      if( 0 != sap ) {
+         std::string prop = "[";
+         const std::vector<std::string>& vals = sap->value();
+         for ( unsigned int i = 0; i < vals.size(); i++ )   {
+            prop += vals[i];
+            if ( i+1 < vals.size() ) prop += ",";
+         }
+         prop += "]";
+
+         ATH_MSG_DEBUG("Attempt to set property " << (*iter)->name() << " to " << prop);
+
+         sc = myInt->setProperty( (*iter)->name(), prop );
+         if( !sc.isSuccess() ) {
+            ATH_MSG_ERROR("Unable to set StringArrayProperty " << (*iter)->name() << " of " << client << " to " << prop);
+            fail = true;
+         } else {
+            ATH_MSG_DEBUG("Set Property " << (*iter)->name() << " to :" << prop << ":");
+         }
+         continue;
+      }
+
+      ATH_MSG_ERROR("Unable to set property " << (*iter)->name() << " of " << client << "\n Neither String nor StringArray");
+      fail = true;
+   }
+
+
+   ATH_MSG_DEBUG("Finished setting properties for " << client);
+
+   return fail? StatusCode::FAILURE : StatusCode::SUCCESS;
+}
+
+
+
+
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::HLTJobOptionsSvc::addPropertyToCatalogue( const std::string & client,
+                                                    const Property& property )
+//----------------------------------------------------------------------------
+{
+  //cout << "Start HLTJobOptionsSvc::addPropertyToCatalogue("<< client << ", " << property->name() << ")" << endl;
+  StatusCode sc = StatusCode(StatusCode::SUCCESS,true);
+  // remove property from catalogue if already exists
+  removePropertyFromCatalogue( client, property.name() );
+
+  // add property
+
+  Property* p = new StringProperty ( property.name(), "" ) ;
+  if ( !property.load( *p ) ) { delete p ; return StatusCode::FAILURE ; }
+
+  m_catalogue.addOption( client , p );
+
+  return sc;
+}
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::HLTJobOptionsSvc::removePropertyFromCatalogue(const std::string& client,
+                                                        const std::string& name )
+//----------------------------------------------------------------------------
+{
+  StatusCode sc = StatusCode(StatusCode::SUCCESS,true);
+  std::vector<const Property*>* opts = 0;
+  if ( m_catalogue.optionsOf( client, opts).isSuccess() ) {
+    std::vector<const Property*>::iterator it;
+    for ( it = opts->begin(); it != opts->end(); it++ ) {
+      if ((*it)->name() == name )  {
+        // delete existing property
+        delete *it;
+        opts->erase(it);
+        return sc;
+      }
+    }
+  }
+  return sc;
+}
+
+//----------------------------------------------------------------------------
+const std::vector<const Property*>*
+TrigConf::HLTJobOptionsSvc::getProperties( const std::string& client) const
+//----------------------------------------------------------------------------
+{
+  std::vector<const Property*>* opts = 0;
+  if ( m_catalogue.optionsOf( client, opts).isSuccess() ) {
+    return opts;
+  }
+  return 0;
+}
+//----------------------------------------------------------------------------
+std::vector<std::string>
+TrigConf::HLTJobOptionsSvc::getClients() const
+//----------------------------------------------------------------------------
+{
+  return m_catalogue.getClients();
+}
+
+
+//----------------------------------------------------------------------------
+StatusCode TrigConf::HLTJobOptionsSvc::readOptions( const std::string& /*file*/ ,
+                                                    const std::string& /*path*/ )
+//----------------------------------------------------------------------------
+{
+  return StatusCode::SUCCESS;
+}
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/JobOptionsCatalogue.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/JobOptionsCatalogue.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..ee72e8d05243956ddad7b2777d614eaa15374474
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/JobOptionsCatalogue.cxx
@@ -0,0 +1,244 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// $Id: JobOptionsCatalogue.cxx,v 1.1 2007-07-29 13:25:49 stelzer Exp $
+// JobOptionsCatalogue.cpp: implementation of the JobOptionsCatalogue class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "GaudiKernel/Kernel.h"
+#include "GaudiKernel/Property.h"
+#include "GaudiKernel/MsgStream.h"
+#include "TrigConfigSvc/JobOptionsCatalogue.h"
+
+#include <string.h>
+
+//----------------------------------------------------------------------------
+TrigConf::JobOptionsCatalogue::~JobOptionsCatalogue() {
+	// Delete the JobOptionsLists created by this catalogue
+	for( algorithmsIterator iter = m_algorithmoptions.begin();
+       iter != m_algorithmoptions.end(); iter++ ) {
+		delete *iter;
+	}
+}
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::JobOptionsCatalogue::findAlgorithm( const std::string myAlg, 
+                                               JobOptionsList*& myList ) const {
+  std::vector<JobOptionsList*>::const_iterator iter;
+	for( iter = m_algorithmoptions.begin();
+     	 iter != m_algorithmoptions.end();
+       iter++ ) {
+    std::string ss = ((*iter)->algorithmName());
+                if ( (*iter)->algorithmName().compare(myAlg) == 0 ) {
+			myList = *iter;
+			return StatusCode::SUCCESS;
+		}
+	}
+	return StatusCode::FAILURE;
+}
+
+//----------------------------------------------------------------------------
+void
+TrigConf::JobOptionsCatalogue::addOption( const std::string myAlg, 
+                                          const Property* const& myOpt ) {
+	JobOptionsList* myList;
+	StatusCode sc = this->findAlgorithm( myAlg, myList );
+	if( sc.isSuccess() ) {
+		myList->addOption( myOpt );
+	}
+	else {
+	// If algorithm was not found, create a new list
+		JobOptionsList* j = new JobOptionsList(myAlg, myOpt);
+		m_algorithmoptions.insert( m_algorithmoptions.end(), j );
+	}
+}
+
+ 
+//---------------------------------------------------------------------------- 
+StatusCode
+TrigConf::JobOptionsCatalogue::optionsOf( const std::string& myAlg,
+                                          std::vector<const Property*>*& myOpts) const {
+	JobOptionsList* myList;
+	StatusCode sc = this->findAlgorithm( myAlg, myList );
+	if( sc.isSuccess() ) {
+	  myOpts 
+	    = const_cast<std::vector<const Property*>*>(myList->properties() );
+	  return StatusCode::SUCCESS;
+	}
+	else {
+		return StatusCode::FAILURE; // Algorithm has no options
+	}
+}
+
+//----------------------------------------------------------------------------
+const Property* 
+TrigConf::JobOptionsCatalogue::getOption(const std::string& which) {
+  size_t loc = which.find('.');
+  if ( loc != std::string::npos )   {
+    std::vector<const Property*>* opts = 0;
+    StatusCode sc = optionsOf( which.substr(0, loc), opts);
+    if ( sc.isSuccess() )   {
+      std::string propName = which.substr(loc+1);
+      std::vector<const Property*>::const_iterator itr;
+      for ( itr = opts->begin(); itr != opts->end(); itr++ )    {
+        if ( (*itr)->name() == propName )    {
+          return *itr;
+        }
+      }
+    }
+  }
+  return 0;
+}
+
+//----------------------------------------------------------------------------
+void
+TrigConf::JobOptionsCatalogue::printUnresolvedOptions(MsgStream& msgStream) {
+	for( algorithmsIterator iter = m_algorithmoptions.begin();
+       iter != m_algorithmoptions.end();
+       iter++ ) {
+    std::vector<const Property*>* opts =
+      const_cast<std::vector<const Property*>*>((*iter)->properties());
+    std::vector<const Property*>::const_iterator itr;
+    for ( itr = opts->begin(); itr != opts->end(); itr++ )    {
+      Property* p = const_cast<Property*>(*itr);
+      StringArrayProperty* sap = dynamic_cast<StringArrayProperty*> (p);
+      if ( sap != 0 )    {
+        typedef std::vector<std::string> OptsArray;
+        OptsArray& res = const_cast<OptsArray&>(sap->value());
+        for ( unsigned int i = 0; i != res.size(); i++ )  {
+          std::string& s = res[i];
+          if ( s.length() > 0 && s[0] == '@' )    {
+            msgStream << MSG::FATAL << "Found problematic option:" 
+                      << (*iter)->algorithmName() << "." << p->name() 
+                      << " Value[" << i << "] = " << s << endreq;
+          }
+        }
+      }
+      else    {
+        StringProperty* sp = dynamic_cast<StringProperty*> (p);
+        if ( sp != 0 )    {
+          const std::string& s = sp->value();
+          if ( s.length() > 0 && s[0] == '@' )
+            msgStream << MSG::FATAL << "Found problematic option:" 
+                      << (*iter)->algorithmName() << "." << p->name() 
+                      << " Value = " << s << endreq;
+        }
+      }
+    }
+  }
+}
+
+//----------------------------------------------------------------------------
+StatusCode
+TrigConf::JobOptionsCatalogue::resolveOptions(MsgStream& log) {
+  long loops = 10000, missing_syms = 0;
+
+  // loop over all algorithms in the catalogue
+	for( algorithmsIterator iter = m_algorithmoptions.begin();
+       iter != m_algorithmoptions.end();
+       iter++ ) {
+
+    bool restart_flag = false;
+
+    // for each algorithm get the list of properties
+    std::vector<const Property*>* opts =
+      const_cast<std::vector<const Property*>*>((*iter)->properties());
+    std::vector<const Property*>::const_iterator itr;
+
+    // loop over the properties
+    for ( itr = opts->begin(); itr != opts->end(); itr++ )    {
+
+      Property* p = const_cast<Property*>(*itr);
+
+      StringArrayProperty* sap = dynamic_cast<StringArrayProperty*> (p);
+
+      // property is an array, that means the value of the property is a vector of strings
+      if ( sap != 0 ) {
+        typedef std::vector<std::string> OptsArray;
+        OptsArray& res = const_cast<OptsArray&>(sap->value());
+        OptsArray new_opts;
+        // loop over the string values
+        for ( OptsArray::iterator i = res.begin(); i != res.end(); i++ )  {
+          std::string& s = *i;
+          if ( s.length() > 0 && s[0] == '@' )   {
+            Property* prop = const_cast<Property*>(getOption( s.substr(1) ));
+            if ( prop != p ) { // Self-references are not allowed!!!
+              StringArrayProperty* sp =
+                dynamic_cast<StringArrayProperty*> (prop);
+              if ( 0 != sp )     {
+                OptsArray rep = sp->value();
+                for ( OptsArray::iterator j = rep.begin(); j != rep.end(); j++){
+                  new_opts.push_back(*j);
+                }
+                restart_flag = true;
+              }
+              else    {
+                new_opts.push_back(s);
+                missing_syms++;
+              }
+            }
+            else    {
+              log << endreq
+                  << MSG::FATAL << "Self references to options are not allowed!"
+                  << (*iter)->algorithmName() << "." << p->name() 
+                  << " Value = " << s << endreq;
+              return StatusCode::FAILURE;
+            }
+          }
+          else    {
+            new_opts.push_back(s);
+          }
+        }
+        res = new_opts;
+      }
+      else    {
+        StringProperty* sp = dynamic_cast<StringProperty*> (p);
+        if ( sp != 0 )    {
+          const std::string& s = sp->value();
+          if ( s.length() > 0 && s[0] == '@' )   {
+            const Property* prop = getOption(s.substr(1));
+            const StringProperty* sprp =
+              dynamic_cast<const StringProperty*> (prop);
+            if ( 0 != sprp )     {
+              sp->set(sprp->value());
+              restart_flag = true;
+            }
+            else    {
+              missing_syms++;
+            }
+          }
+        }
+      }
+    }
+    if ( restart_flag )   {
+      if ( loops-- > 0 )   {
+        iter = m_algorithmoptions.begin();
+        missing_syms = 0;
+      }
+    }
+  }
+  if ( loops <= 0 || missing_syms > 0 )   {
+    log << MSG::FATAL
+        << "Job option symbols cannot be resolved. Bad symbols found."
+        << endreq;
+    return StatusCode::FAILURE;
+  }
+  return StatusCode::SUCCESS;
+}
+
+
+//----------------------------------------------------------------------------
+std::vector<std::string>
+TrigConf::JobOptionsCatalogue::getClients() const {
+  std::vector<std::string> clients;
+  std::vector<JobOptionsList*>::const_iterator iter;
+
+	for( iter = m_algorithmoptions.begin();
+     					   iter != m_algorithmoptions.end(); iter++ ) {
+		clients.push_back((*iter)->algorithmName());
+	}
+  return clients;
+}
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/JobOptionsList.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/JobOptionsList.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..c912eb9648234d08a503a10ab9733bc8f0eef94a
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/JobOptionsList.cxx
@@ -0,0 +1,38 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+// JobOptionsList.cpp: implementation of the JobOptionsList class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "TrigConfigSvc/JobOptionsList.h"
+#include "GaudiKernel/Property.h"
+
+TrigConf::JobOptionsList::~JobOptionsList() {
+	// Delete the Properties held by this catalogue
+	for( std::vector<const Property*>::iterator iter = m_properties.begin();
+       iter != m_properties.end(); iter++ ) {
+		delete *iter;
+	}
+}
+
+TrigConf::JobOptionsList::JobOptionsList( const std::string myAlg, const Property* const& myOpt ){
+	m_algorithmName = myAlg;
+	this->addOption( myOpt );
+}
+
+std::string
+TrigConf::JobOptionsList::algorithmName() const {
+	return m_algorithmName;
+}
+
+void
+TrigConf::JobOptionsList::addOption( const Property* const& myOpt ){
+	m_properties.insert( m_properties.end(), myOpt );
+}
+
+const std::vector<const Property*>*
+TrigConf::JobOptionsList::properties() const {
+	return &m_properties;
+}
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/L1TopoConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/L1TopoConfigSvc.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..b328f05345fdbfb62f681dca53824757d813e073
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/L1TopoConfigSvc.cxx
@@ -0,0 +1,55 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "TrigConfigSvc/L1TopoConfigSvc.h"
+#include "L1TopoConfig/L1TopoMenu.h"
+#include "TrigConfStorage/IStorageMgr.h"
+
+
+using namespace std;
+
+TrigConf::L1TopoConfigSvc::L1TopoConfigSvc(const string& name, ISvcLocator* pSvcLocator) : 
+   base_class(name, pSvcLocator),
+   m_menu(new TXC::L1TopoMenu)
+{
+   base_class::declareCommonProperties();
+}
+
+
+TrigConf::L1TopoConfigSvc::~L1TopoConfigSvc()
+{}
+
+
+StatusCode
+TrigConf::L1TopoConfigSvc::initialize() {
+
+   CHECK(ConfigSvcBase::initialize());
+
+   if( !fromDB() and m_xmlFile=="NONE" ) {
+      ATH_MSG_INFO("xml file set to NONE, will not load L1TopoMenu");
+      return StatusCode::SUCCESS;
+   }
+
+   CHECK(initStorageMgr());
+
+   bool loadSuccess = m_storageMgr->l1topoMenuLoader().load( *m_menu );
+
+   CHECK(freeStorageMgr());
+
+//   m_menu->print();
+
+   return loadSuccess ? StatusCode::SUCCESS : StatusCode::FAILURE;
+}
+
+
+StatusCode
+TrigConf::L1TopoConfigSvc::start() {
+   return StatusCode::SUCCESS;
+}
+
+
+StatusCode
+TrigConf::L1TopoConfigSvc::finalize() {
+   return StatusCode::SUCCESS;
+}
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/LVL1ConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/LVL1ConfigSvc.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..723de2c873d405cd612196498bfbdddd64958a28
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/LVL1ConfigSvc.cxx
@@ -0,0 +1,219 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+// STL includes:
+#include <exception>
+#include <vector>
+
+// Athena/Gaudi includes:
+#include "PathResolver/PathResolver.h"
+
+#include "GaudiKernel/ServiceHandle.h"
+#include "GaudiKernel/IIncidentSvc.h"
+#include "GaudiKernel/Incident.h"
+
+#include "StoreGate/StoreGateSvc.h"
+
+// Local includes:
+#include "TrigConfigSvc/Verifyer.h"
+
+// Trigger database interface includes:
+
+#include "TrigConfL1Data/DeadTime.h"
+#include "TrigConfL1Data/CTPConfig.h"
+#include "TrigConfL1Data/CTPConfigOnline.h"
+#include "TrigConfL1Data/Menu.h"
+#include "TrigConfL1Data/ThresholdConfig.h"
+#include "TrigConfL1Data/Muctpi.h"
+#include "TrigConfL1Data/PrescaledClock.h"
+#include "TrigConfL1Data/Random.h"
+#include "TrigConfStorage/StorageMgr.h"
+#include "TrigConfStorage/XMLStorageMgr.h"
+#include "TrigConfL1Data/TriggerThreshold.h"
+#include "TrigConfL1Data/TriggerThresholdValue.h"
+#include "TrigConfL1Data/ClusterThresholdValue.h"
+#include "TrigConfL1Data/EtThresholdValue.h"
+#include "TrigConfL1Data/JetThresholdValue.h"
+#include "TrigConfL1Data/L1DataDef.h"
+
+#include "TrigConfigSvc/LVL1ConfigSvc.h"
+
+#include "boost/algorithm/string/case_conv.hpp"
+#include "boost/lexical_cast.hpp"
+
+using namespace std;
+using namespace TrigConf;
+
+LVL1ConfigSvc::LVL1ConfigSvc( const std::string& name, ISvcLocator* pSvcLocator ) :
+   base_class( name, pSvcLocator ),
+   m_detectorStore(0),
+   m_ctpConfig(0),
+   m_thrcfg(0),
+   m_muctpi(0),
+   m_prescaleSetID(0),
+   m_bunchgroupSetID(0),
+   m_dumpTTVmap(false)
+{
+
+   base_class::declareCommonProperties();
+
+   declareProperty( "DBLVL1PSKey", m_prescaleSetID, "L1 Prescale key");
+   declareProperty( "DBBGSKey",    m_bunchgroupSetID, "L1 Bunchgroup key");
+   declareProperty( "DumpTTVmap",  m_dumpTTVmap, "Dump threshold vector");
+}
+
+LVL1ConfigSvc::~LVL1ConfigSvc()
+{}
+
+
+StatusCode
+LVL1ConfigSvc::initialize() {
+
+   CHECK(ConfigSvcBase::initialize());
+   
+   // could be that this is needed when running from DB
+   CHECK(setProperties());
+
+   if( !fromDB() and m_xmlFile=="NONE" ) {
+      ATH_MSG_INFO("xml file set to NONE, will not load LVL1 Menu");
+      return StatusCode::SUCCESS;
+   }
+
+   if( fromDB() ) {
+      ATH_MSG_INFO("  DB LVL1 PrescaleKey  = " << m_prescaleSetID);
+      ATH_MSG_INFO("  DB BunchGroupSetKey  = " << m_bunchgroupSetID);
+   }
+
+   CHECK(initStorageMgr());
+
+   try {
+
+      //       m_storageMgr->setLevel(MSGTC::DEBUG);  // TODO check if this is propagated to the loader
+      //       m_storageMgr->masterTableLoader().setLevel(MSGTC::DEBUG);
+
+      m_ctpConfig = new CTPConfig();
+      m_ctpConfig->setSMK( m_dbSMKey );
+      m_ctpConfig->setPrescaleSetId( m_prescaleSetID );
+      m_ctpConfig->setBunchGroupSetId( m_bunchgroupSetID );
+      m_storageMgr->masterTableLoader().load( *m_ctpConfig );
+      ATH_MSG_VERBOSE("CTPConfig object loaded");
+
+      m_thrcfg = &m_ctpConfig->menu().thresholdConfig();
+
+      m_muctpi = new Muctpi();
+      m_muctpi->setSMK( m_dbSMKey );
+      //m_muctpi->setLvl1MasterTableId( 0 );
+      m_storageMgr->masterTableLoader().load( *m_muctpi );
+      ATH_MSG_VERBOSE("MuCTPI configuration object loaded");
+
+   } catch ( std::exception & e ) {
+
+      CHECK(freeStorageMgr());
+
+      ATH_MSG_ERROR("Standard C++ exception caught: " << e.what());
+      return StatusCode::FAILURE;
+
+   } catch ( ... ) {
+
+      CHECK(freeStorageMgr());
+
+      ATH_MSG_ERROR("Unknown exception caught.");
+      return StatusCode::FAILURE;
+
+   }
+
+   CHECK(freeStorageMgr());
+
+
+   //
+   // Check if we have a valid trigger menu:
+   //
+   if( Verifyer::verify( m_ctpConfig->menu(), msg() ) ) {
+      ATH_MSG_ERROR("Loaded trigger menu fails verification");
+      return StatusCode::FAILURE;
+   } else {
+      ATH_MSG_DEBUG("Loaded trigger menu passed verification");
+   }
+
+   ATH_MSG_DEBUG("Dumping LVL1 configuration");
+
+   if (msgSvc()->outputLevel(name()) <= MSG::INFO) {
+      m_ctpConfig->print("  ", m_printMenuLevel);
+   }
+
+   // Dump threshold value map
+   if (m_dumpTTVmap) {
+      ATH_MSG_DEBUG("Dumping ThresholdValue map from ThresholdConfig");
+      m_thrcfg->printThresholdValueMap();
+   }
+
+   // Get a hold of the DetectorStore:
+   CHECK(service( "DetectorStore", m_detectorStore ));
+
+   //
+   // fire incident
+   // 
+   ServiceHandle<IIncidentSvc> incSvc("IncidentSvc",name());
+   if (incSvc.retrieve().isFailure()) {
+      ATH_MSG_WARNING("Cannot retrieve IncidentSvc");
+   } else {
+      // prefered
+      std::string incname = "";
+      incname += "L1Menu";
+      incname += "L1PS";
+      incSvc->fireIncident(Incident(incname,"TrigConf"));
+      ATH_MSG_INFO("Fired Incident 'TrigConf' - " << incname);    
+   }
+
+   return StatusCode::SUCCESS;
+}
+
+StatusCode
+LVL1ConfigSvc::finalize() {
+
+   ATH_MSG_DEBUG("Finalizing");
+
+   // Delete configuration objects:
+   //delete m_thrcfg;
+   delete m_ctpConfig;
+   delete m_muctpi;
+
+   CHECK(AthService::finalize());
+
+   return StatusCode::SUCCESS;
+
+}
+
+StatusCode
+LVL1ConfigSvc::queryInterface( const InterfaceID& riid, void** ppvIF ) {
+
+   StatusCode sc = StatusCode::FAILURE;
+
+   if( ppvIF ) {
+      *ppvIF = 0;
+
+      if( riid == ILVL1ConfigSvc::interfaceID() ) {
+         try {
+            *ppvIF = dynamic_cast<ILVL1ConfigSvc*>( this );
+         } catch( bad_cast ) {
+            return StatusCode::FAILURE;
+         }
+         sc = StatusCode::SUCCESS;
+      } else {
+         sc = Service::queryInterface( riid, ppvIF );
+      }
+
+   }
+
+   return sc;
+
+}
+
+
+const BunchGroupSet*
+LVL1ConfigSvc::bunchGroupSet() const { 
+   if (ctpConfig()==0) return 0;
+   return &ctpConfig()->bunchGroupSet();
+}
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfDataIOVChanger.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfDataIOVChanger.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..af855e58aa2246d8df5f3a666f5e5c91861a634b
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfDataIOVChanger.cxx
@@ -0,0 +1,323 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**************************************************************************
+ **
+ **   File:         TrigConfDataIOVChanger.cxx
+ **
+ **   Description: 
+ **
+ **                - algorithm to trigger the copy of trigger
+ **                configuration meta-data from COOL to ESD/AOD. This
+ **                should only run when data is transformed from
+ **                BS/RDO into ESD/AOD.
+ **
+ **                - Additionally the algorithm changes the IOVrange
+ **                in the ESD/AOD trigger configuration meta-data,
+ **                which should ONLY be done on simulated data
+ **
+ * @author Joerg Stelzer  <stelzer@cern.ch>  - CERN
+ **
+ **   Created:      Tue May  09 14:55:56 GMT 2006
+ **   Modified:
+ **
+ **************************************************************************/
+
+#include "TrigConfigSvc/TrigConfDataIOVChanger.h"
+
+#include "EventInfo/EventInfo.h"
+#include "EventInfo/EventID.h"
+#include "EventInfo/EventType.h"
+
+#include "IOVDbDataModel/IOVMetaDataContainer.h"
+
+#include "AthenaKernel/IOVTime.h"
+#include "AthenaKernel/IOVRange.h"
+
+#include "AthenaPoolUtilities/AthenaAttributeList.h"
+#include "AthenaPoolUtilities/CondAttrListCollection.h"
+
+#include "TrigConfInterfaces/ITrigConfigSvc.h"
+
+#define TRIGGER_CONF_HLTMENU  "/TRIGGER/HLT/Menu"
+#define TRIGGER_CONF_HLTKEYS  "/TRIGGER/HLT/HltConfigKeys"
+#define TRIGGER_CONF_LVL1KEY  "/TRIGGER/LVL1/Lvl1ConfigKey"
+#define TRIGGER_CONF_LVL1MENU "/TRIGGER/LVL1/Menu"
+#define TRIGGER_CONF_LVL1PS   "/TRIGGER/LVL1/Prescales"
+#define TRIGGER_CONF_LVL1ITD  "/TRIGGER/LVL1/ItemDef"
+#define TRIGGER_CONF_HLTPS    "/TRIGGER/HLT/Prescales"
+#define TRIGGER_CONF_HLTPSK   "/TRIGGER/HLT/PrescaleKey"
+
+using namespace std;
+using namespace TrigConf;
+
+TrigConfDataIOVChanger::TrigConfDataIOVChanger(const std::string &name, ISvcLocator *pSvcLocator)
+  : AthAlgorithm(name, pSvcLocator),
+    m_AdjustIOV(false),
+    m_LastRun(0),
+    m_storeGate("StoreGateSvc", name),
+    m_metaDataStore("StoreGateSvc/MetaDataStore",name),
+    m_detStore("StoreGateSvc/DetectorStore",name)
+{
+  declareProperty("AdjustIOV", m_AdjustIOV, "Set to true if the IOV needs adjustment (MC production), false (default) for data-reco");
+}
+
+
+TrigConf::TrigConfDataIOVChanger::~TrigConfDataIOVChanger() {}
+
+
+StatusCode
+TrigConf::TrigConfDataIOVChanger::initialize() {
+
+   ATH_MSG_DEBUG("Initializing TrigConfDataIOVChanger..." << endl << "Properties:");
+
+   CHECK(m_storeGate.retrieve());
+
+   CHECK(m_metaDataStore.retrieve());
+
+   return StatusCode::SUCCESS;
+}
+
+
+
+StatusCode
+TrigConf::TrigConfDataIOVChanger::finalize() {
+  return StatusCode::SUCCESS;
+}
+
+
+StatusCode
+TrigConf::TrigConfDataIOVChanger::execute() {
+
+   // First get the runnumber:
+   const EventInfo* eventInfo = 0;
+   CHECK(m_storeGate->retrieve(eventInfo));
+
+   if (!eventInfo) {
+      ATH_MSG_ERROR("EventInfo from storegate is 0");
+      return StatusCode::FAILURE;
+   }
+
+   EventID* myEventID = eventInfo->event_ID();
+   unsigned int runNumber = myEventID->run_number();
+  
+   if(m_LastRun == runNumber)       // already executed in this run?
+      return StatusCode::SUCCESS;
+
+   m_LastRun = runNumber;
+
+   // execute only once
+   //   if(m_AlreadyExecuted)
+   //     return StatusCode::SUCCESS;
+  
+   //   m_AlreadyExecuted = true;
+  
+
+   // ----------------------------------------
+   // the copying of the cool folders into the
+   // metadatastore (which is written out to 
+   // ESD/AOD) is triggered by accessing them
+   // in the detectorstore
+   // (perhaps at some point a forced copy flag
+   // will be implemented, but for now...)
+   // ----------------------------------------
+   const DataHandle<CondAttrListCollection> listColl;
+   const DataHandle<AthenaAttributeList> attList;
+
+   if( m_detStore->retrieve(listColl, TRIGGER_CONF_HLTMENU  ).isSuccess() && listColl) {
+      ATH_MSG_INFO("Triggered reading of  " << TRIGGER_CONF_HLTMENU);    
+   } else {
+      ATH_MSG_INFO("Failed to read " << TRIGGER_CONF_HLTMENU);    
+   }
+   if( m_detStore->retrieve( attList, TRIGGER_CONF_HLTKEYS  ).isSuccess() && listColl) {
+      ATH_MSG_INFO("Triggered reading of  " << TRIGGER_CONF_HLTKEYS);    
+   } else {
+      ATH_MSG_INFO("Failed to read " << TRIGGER_CONF_HLTKEYS);    
+   }
+   if( m_detStore->retrieve( attList, TRIGGER_CONF_LVL1KEY  ).isSuccess() && listColl) {
+      ATH_MSG_INFO("Triggered reading of  " << TRIGGER_CONF_LVL1KEY);    
+   } else {
+      ATH_MSG_INFO("Failed to read " << TRIGGER_CONF_LVL1KEY);    
+   }
+   if( m_detStore->retrieve(listColl, TRIGGER_CONF_LVL1MENU ).isSuccess() && listColl) {
+      ATH_MSG_INFO("Triggered reading of  " << TRIGGER_CONF_LVL1MENU);    
+   } else {
+      ATH_MSG_INFO("Failed to read " << TRIGGER_CONF_LVL1MENU);    
+   }
+   if( m_detStore->retrieve(listColl, TRIGGER_CONF_LVL1PS   ).isSuccess() && listColl) {
+      ATH_MSG_INFO("Triggered reading of  " << TRIGGER_CONF_LVL1PS);    
+   } else {
+      ATH_MSG_INFO("Failed to read " << TRIGGER_CONF_LVL1PS);    
+   } 
+   if( m_detStore->retrieve(listColl, TRIGGER_CONF_LVL1ITD   ).isSuccess() && listColl) {
+      ATH_MSG_INFO("Triggered reading of  " << TRIGGER_CONF_LVL1ITD);
+   } else {
+      ATH_MSG_INFO("Failed to read " << TRIGGER_CONF_LVL1ITD);
+   }
+   if( m_detStore->retrieve(listColl, TRIGGER_CONF_HLTPS   ).isSuccess() && listColl) {
+      ATH_MSG_INFO("Triggered reading of  " << TRIGGER_CONF_HLTPS);
+   } else {
+      ATH_MSG_INFO("Failed to read " << TRIGGER_CONF_HLTPS);
+   }
+   if( m_detStore->retrieve(listColl, TRIGGER_CONF_HLTPSK   ).isSuccess() && listColl) {
+      ATH_MSG_INFO("Triggered reading of  " << TRIGGER_CONF_HLTPSK);
+   } else {
+      ATH_MSG_INFO("Failed to read " << TRIGGER_CONF_HLTPSK);
+   }
+
+
+   if(!m_AdjustIOV) return StatusCode::SUCCESS;
+
+   // ----------------------------------------
+   // in the following section the IOV is 
+   // adjusted to cover the range of the run
+   // ----------------------------------------
+
+   // Second retrieve all meta data containers from the MetaDataStore
+   // (the one that goes out into the ESD/AOD)
+   const DataHandle<IOVMetaDataContainer> cont;
+   const DataHandle<IOVMetaDataContainer> contEnd;
+
+   CHECK(m_metaDataStore->retrieve(cont, contEnd));
+
+   // For each container, print out its folder name, get the payload
+   // (containing data + IOVs) and adjust the IOV for each
+   // attributeList (we have only one) and each channel therein
+   for (; cont != contEnd; ++cont) {
+      if(cont->folderName() != TRIGGER_CONF_HLTMENU  &&
+         cont->folderName() != TRIGGER_CONF_HLTKEYS  &&
+         cont->folderName() != TRIGGER_CONF_LVL1KEY  &&
+         cont->folderName() != TRIGGER_CONF_LVL1MENU &&
+         cont->folderName() != TRIGGER_CONF_LVL1PS   &&
+         cont->folderName() != TRIGGER_CONF_LVL1ITD  &&
+         cont->folderName() != TRIGGER_CONF_HLTPS    &&
+         cont->folderName() != TRIGGER_CONF_HLTPSK) continue;
+    
+
+      IOVPayloadContainer*  payload = const_cast<IOVPayloadContainer*>(cont->payloadContainer());
+
+      ATH_MSG_DEBUG("Size of folder payload is " << payload->size());
+
+      if(payload->size()==0) {
+         ATH_MSG_ERROR("Size of folder payload is 0, no configuration meta data, please check setup");
+         return StatusCode::FAILURE;
+      }
+
+      IOVPayloadContainer::const_iterator itAttList    = payload->begin();
+      IOVPayloadContainer::const_iterator itAttListEnd = payload->end();
+
+      bool needToChangeIOV = false; // if there is already multiple payloads (= multiple IOV's then a new one needs to be added
+      if(payload->size()==1) // if there is one payload, a new one needs to be added if the existing one is a valid run
+         needToChangeIOV = CheckIOV(*itAttList);
+
+      itAttList    = payload->begin();
+      if(needToChangeIOV) {
+         ATH_MSG_INFO("Adjusting IOV of folder " << cont->folderName() << " to run " << runNumber);
+         for (; itAttList != itAttListEnd; ++itAttList)
+            ChangeIOV((*itAttList), runNumber);
+      } else {
+         ATH_MSG_INFO("Adding new IOV for folder " << cont->folderName() << " for run " << runNumber);
+         for (; itAttList != itAttListEnd; ++itAttList) {
+            CondAttrListCollection * pl = CreatePayload((*itAttList), runNumber);
+            if(!payload->merge(pl))
+               delete pl; 
+         }
+      }
+
+      if( outputLevel()<=MSG::VERBOSE) {
+         itAttList    = payload->begin();
+         for (; itAttList != itAttListEnd; ++itAttList)
+            printOut((*itAttList));
+      }
+   }
+
+   return StatusCode::SUCCESS;
+}
+
+//--------------------------------------------------------------------------
+bool
+TrigConf::TrigConfDataIOVChanger::CheckIOV(const CondAttrListCollection* coll) const {
+
+  // check for the IOVRange of the first channel
+  CondAttrListCollection::iov_const_iterator  itIOV    = coll->iov_begin();
+
+  // if it starts at run=0, lb=0, then the range needs to be changed
+  if((*itIOV).second.start() == IOVTime(0,0)) return true;
+
+  // otherwise a new payload needs to be added
+  return false;
+}
+
+
+//--------------------------------------------------------------------------
+void
+TrigConf::TrigConfDataIOVChanger::ChangeIOV(const CondAttrListCollection* coll, unsigned int runNumber) const {
+  CondAttrListCollection* cColl = const_cast<CondAttrListCollection*>(coll);
+
+  // loop over the internal map<ChanNum, IOVRange>
+  CondAttrListCollection::iov_const_iterator  itIOV    = cColl->iov_begin();
+  CondAttrListCollection::iov_const_iterator  itIOVEnd = cColl->iov_end  ();
+  std::vector<CondAttrListCollection::ChanNum> channels; channels.reserve(cColl->iov_size());
+  for (; itIOV != itIOVEnd; ++itIOV) {
+    CondAttrListCollection::ChanNum channel = (*itIOV).first;
+    //    std::cout << channel << ": name = " << coll->chanName(channel) << ", start time = " << (*itIOV).second.start() << std::endl;
+     //if((*itIOV).second.start()!=IOVTime(0,0)) continue;
+    channels.push_back(channel);
+  }
+
+  std::vector<CondAttrListCollection::ChanNum>::const_iterator itCh = channels.begin();
+  std::vector<CondAttrListCollection::ChanNum>::const_iterator itChEnd = channels.end();
+  for(; itCh != itChEnd; ++itCh) {
+    cColl->add( (*itCh), IOVRange(IOVTime(runNumber,0), IOVTime(runNumber+1,0)) );
+  }
+  
+  return;
+}
+
+
+//--------------------------------------------------------------------------
+CondAttrListCollection*
+TrigConf::TrigConfDataIOVChanger::CreatePayload(const CondAttrListCollection* coll, unsigned int runNumber) const {
+  CondAttrListCollection * pl = new CondAttrListCollection(true);
+
+  // loop over the internal map<ChanNum, IOVRange>
+  CondAttrListCollection::iov_const_iterator  itIOV    = coll->iov_begin();
+  CondAttrListCollection::iov_const_iterator  itIOVEnd = coll->iov_end  ();
+  CondAttrListCollection::const_iterator      itAttr   = coll->begin();
+  for (; itIOV != itIOVEnd; ++itIOV, ++itAttr) {
+    CondAttrListCollection::ChanNum channel = (*itIOV).first;
+    pl->add( channel, (*itAttr).second ); // add the attribute list to the new collection
+    pl->add( channel, IOVRange(IOVTime(runNumber,0), IOVTime(runNumber+1,0)) ); // add the IOV to the new collection
+  }
+  return pl;
+}
+
+
+
+//--------------------------------------------------------------------------
+void
+TrigConf::TrigConfDataIOVChanger::printOut(const CondAttrListCollection* coll) const
+{
+    ATH_MSG_VERBOSE(coll->minRange() << " iov size " 
+        <<     coll->iov_size());
+    CondAttrListCollection::iov_const_iterator  itIOV    = coll->iov_begin();
+    CondAttrListCollection::iov_const_iterator  itIOVEnd = coll->iov_end  ();
+    for (; itIOV != itIOVEnd; ++itIOV) {
+        ATH_MSG_VERBOSE((*itIOV).first << " " << (*itIOV).second);
+    }
+
+    CondAttrListCollection::const_iterator  itAtt    = coll->begin();
+    CondAttrListCollection::const_iterator  itAttEnd = coll->end  ();
+    for (; itAtt != itAttEnd; ++itAtt) {
+        std::ostringstream attrStr;
+        attrStr << "{";
+        for (coral::AttributeList::const_iterator itr= (*itAtt).second.begin();
+             itr !=  (*itAtt).second.end();++itr) {
+            if (itr !=  (*itAtt).second.begin()) attrStr << ",";
+            itr->toOutputStream(attrStr);
+        }
+        attrStr << "}";
+        ATH_MSG_VERBOSE((*itAtt).first << " " << attrStr.str());
+    }
+}
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfigSvc.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfigSvc.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..9467c363d889916a0bec329617053f8770f8e703
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/TrigConfigSvc.cxx
@@ -0,0 +1,275 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "GaudiKernel/ServiceHandle.h"
+
+#include "TrigConfigSvc/TrigConfigSvc.h"
+#include "TrigConfigSvc/HLTConfigSvc.h"
+#include "TrigConfHLTData/HLTChainList.h"
+#include "TrigConfL1Data/BunchGroupSet.h"
+
+#include "boost/foreach.hpp"
+#include "boost/algorithm/string.hpp"
+
+#include <algorithm>
+
+using namespace std;
+using namespace TrigConf;
+
+TrigConfigSvc::TrigConfigSvc( const std::string& name,
+                              ISvcLocator* pSvcLocator ) :
+   AthService( name, pSvcLocator ),
+   m_l1topoSvc("TrigConf::L1TopoConfigSvc/L1TopoConfigSvc", name),
+   m_lvl1Svc("TrigConf::LVL1ConfigSvc/LVL1ConfigSvc", name),
+   m_hltSvc("TrigConf::HLTConfigSvc/HLTConfigSvc", name),
+   m_dsSvc("TrigConf::DSConfigSvc/DSConfigSvc", name),
+   m_l1service(0),
+   m_hltservice(0)
+{
+  declareProperty( "LVL1ConfigSvc", m_lvl1Svc, "LVL1 config svc -> retrieve trigger configuration from (XML/DB)");
+  declareProperty( "HLTConfigSvc",  m_hltSvc,  "HLT config svc -> retrieve trigger configuration from (XML/DB)");
+  declareProperty( "DSConfigSvc",   m_dsSvc,   "TrigConfig svc -> retrieve trigger configuration from DetectorStore");
+  declareProperty( "PriorityList",  m_priorityList, "priority list of TrigConfigSvc in which to query. Allowed values are ['xml','ds']");
+  m_priorityList.push_back("ds");
+  m_priorityList.push_back("xml");
+}
+
+
+StatusCode
+TrigConfigSvc::initialize() {
+
+   CHECK(AthService::initialize());
+
+   ATH_MSG_INFO("TrigConfigSvc::initialize(): Testing for available services in this order : ");
+
+   bool l1fromxml(false), hltfromxml(false);
+
+   for(const string& svc: m_priorityList) {
+      string testsvc(boost::to_lower_copy(svc));
+
+      ATH_MSG_INFO("    => " << testsvc);
+
+      if ( testsvc == "ds" ) {
+         if (m_dsSvc.retrieve().isSuccess()) {
+            if(m_l1service==0) m_l1service = m_dsSvc.operator->();
+            if(m_hltservice==0) m_hltservice = m_dsSvc.operator->(); 
+         } else {
+            ATH_MSG_WARNING("failed to retrieve DetStore TrigConfigSvc: " << m_dsSvc);
+         }
+      }
+
+      if ( m_l1toposervice == 0 && (testsvc == "xmll1" || testsvc == "xml") ) {
+         if (m_l1topoSvc.retrieve().isSuccess()) {
+            m_l1toposervice = m_l1topoSvc.operator->();
+         } else {
+            ATH_MSG_WARNING("failed to retrieve L1TopoConfigSvc: " << m_l1topoSvc);
+         }
+      }
+
+      if ( m_l1service == 0 && (testsvc == "xmll1" || testsvc == "xml") ) {
+         if (m_lvl1Svc.retrieve().isSuccess()) {
+            m_l1service = m_lvl1Svc.operator->();
+            l1fromxml = true;
+         } else {
+            ATH_MSG_WARNING("failed to retrieve LVL1 ConfigSvc: " << m_lvl1Svc);
+         }
+      }
+
+    
+      if ( m_hltservice == 0 && (svc == "xmlhlt" || svc == "xml") ) {
+         if (m_hltSvc.retrieve().isSuccess()) {
+            m_hltservice = m_hltSvc.operator->();
+            hltfromxml = true;
+         } else {
+            ATH_MSG_WARNING("failed to retrieve HLT ConfigSvc: " << m_hltSvc);
+         }
+      }
+
+      if( m_l1toposervice!=0 && m_l1service!=0 && m_hltservice!=0 )   break;
+   }
+
+   if( m_l1toposervice==0 && m_l1service==0 && m_hltservice==0 ) {
+      ATH_MSG_FATAL("No trigger configuration service found");
+      return StatusCode::FAILURE;
+   }
+
+   ATH_MSG_INFO("Using for L1 topo configuration  : " << (m_l1toposervice!=0?m_l1toposervice->name():"none") );
+   ATH_MSG_INFO("Using for L1 configuration       : " << (m_l1service!=0?m_l1service->name():"none") );
+   ATH_MSG_INFO("Using for HLT configuration      : " << (m_hltservice!=0?m_hltservice->name():"none") );
+
+   // when configuring from xml we have to set the CTP items as lower chains for the HLT
+
+   if(l1fromxml && hltfromxml && m_lvl1Svc->ctpConfig()!=0 ) {
+      ATH_MSG_DEBUG("Setting lower chain counters since reading menu from XML");
+      dynamic_cast<HLTConfigSvc&>(*m_hltSvc).setL2LowerChainCounter(m_lvl1Svc->ctpConfig()); // not sure this makes sense
+   }
+
+   ATH_MSG_INFO("Done with initialization of the trigger configuration provider");
+   return StatusCode::SUCCESS;
+}
+
+
+
+StatusCode
+TrigConfigSvc::queryInterface( const InterfaceID& riid,
+                               void** ppvIF )
+{
+
+   if ( riid == ITrigConfigSvc::interfaceID() )  {
+      *ppvIF = static_cast< ITrigConfigSvc* >(this);
+   } else if ( riid == IProperty::interfaceID() ) {
+      *ppvIF = static_cast< IProperty* >(this);
+   } else if ( riid == IL1TopoConfigSvc::interfaceID() )  {
+      *ppvIF = static_cast< IL1TopoConfigSvc* >(this);
+   } else if ( riid == ILVL1ConfigSvc::interfaceID() )  {
+      *ppvIF = static_cast< ILVL1ConfigSvc* >(this);
+   } else if ( riid == IHLTConfigSvc::interfaceID() )  {
+      *ppvIF = static_cast< IHLTConfigSvc* >(this);
+   } else   {
+      return AthService::queryInterface( riid, ppvIF );
+   }
+
+   addRef();
+   return StatusCode::SUCCESS;
+}
+
+
+const TXC::L1TopoMenu*
+TrigConfigSvc::menu() const {
+   if(m_l1toposervice)
+      return m_l1toposervice->menu();
+      
+   REPORT_MESSAGE(MSG::WARNING) << "No LVL1 trigger configuration available" << endreq;
+   return 0;
+}
+
+const Muctpi*
+TrigConfigSvc::muctpiConfig() const {
+   if(m_l1service)
+      return m_l1service->muctpiConfig();
+      
+   REPORT_MESSAGE(MSG::WARNING) << "No LVL1 trigger configuration available" << endreq;
+   return 0;
+}
+
+
+const CTPConfig*
+TrigConfigSvc::ctpConfig() const {
+   if(m_l1service)
+      return m_l1service->ctpConfig();
+      
+   REPORT_MESSAGE(MSG::WARNING) << "No LVL1 trigger configuration available" << endreq;
+   return 0;
+}
+
+
+const ThresholdConfig*
+TrigConfigSvc::thresholdConfig() const {
+   if(m_l1service)
+      return m_l1service->thresholdConfig();
+   
+   REPORT_MESSAGE(MSG::WARNING) << "No LVL1 trigger configuration available" << endreq;
+   return 0;
+}
+
+
+const BunchGroupSet*
+TrigConfigSvc::bunchGroupSet() const {
+   if(m_l1service)
+      return m_l1service->bunchGroupSet();
+
+   REPORT_MESSAGE(MSG::WARNING) << "No LVL1 trigger configuration available" << endreq;
+   return 0;
+}
+
+
+uint32_t
+TrigConfigSvc::lvl1PrescaleKey() const {
+   if(m_l1service)
+      return m_l1service->lvl1PrescaleKey();
+   
+   REPORT_MESSAGE(MSG::WARNING) << "No LVL1 trigger configuration available" << endreq;
+   return 0;
+}
+
+
+const HLTChainList&
+TrigConfigSvc::chains() const {
+   if(m_hltservice)
+      return m_hltservice->chains();
+
+   REPORT_MESSAGE(MSG::WARNING) << "No HLT trigger configuration available" << endreq;
+   return m_NullFrame.chains();
+}
+
+
+const HLTChainList*
+TrigConfigSvc::chainList() const {
+   if(m_hltservice)
+      return m_hltservice->chainList();
+
+   REPORT_MESSAGE(MSG::WARNING) << "No HLT trigger configuration available" << endreq;
+   return 0;
+}
+
+
+const HLTSequenceList&
+TrigConfigSvc::sequences() const {
+   if(m_hltservice)
+      return m_hltservice->sequences();
+
+   REPORT_MESSAGE(MSG::WARNING) << "No HLT trigger configuration available" << endreq;
+   return m_NullFrame.sequences();
+}
+
+
+const HLTSequenceList*
+TrigConfigSvc::sequenceList() const {
+   if(m_hltservice)
+      return m_hltservice->sequenceList();
+
+   REPORT_MESSAGE(MSG::WARNING) << "No HLT trigger configuration available" << endreq;
+   return 0;
+}
+
+
+uint32_t
+TrigConfigSvc::masterKey() const {
+   if(m_hltservice)
+      return m_hltservice->masterKey();
+
+   REPORT_MESSAGE(MSG::WARNING) << "No HLT trigger configuration available" << endreq;
+   return 0;
+}
+
+
+uint32_t
+TrigConfigSvc::hltPrescaleKey() const {
+   if(m_hltservice)
+      return m_hltservice->hltPrescaleKey();
+
+   REPORT_MESSAGE(MSG::WARNING) << "No HLT trigger configuration available" << endreq;
+   return 0;
+}
+
+
+StatusCode
+TrigConfigSvc::assignPrescalesToChains(uint lumiblock ) {
+   if(m_hltservice)
+      return m_hltservice->assignPrescalesToChains(lumiblock);
+
+   REPORT_MESSAGE(MSG::WARNING) << "No HLT trigger configuration available" << endreq;
+   return StatusCode::RECOVERABLE;
+}
+
+
+StatusCode
+TrigConfigSvc::updatePrescaleSets(uint requestcount) {
+   if(m_hltservice)
+      return m_hltservice->updatePrescaleSets(requestcount);
+
+   REPORT_MESSAGE(MSG::WARNING) << "No HLT trigger configuration available" << endreq;
+   return StatusCode::RECOVERABLE;
+}
+
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/Verifyer.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/Verifyer.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..0fc6e764a30d8f43bd5129dec16d8f8617033424
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/Verifyer.cxx
@@ -0,0 +1,495 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+#include <vector>
+#include <cmath>
+
+#include "GaudiKernel/MsgStream.h"
+
+// Configuration interface includes:
+#include "TrigConfL1Data/Menu.h"
+#include "TrigConfL1Data/TriggerThreshold.h"
+#include "TrigConfL1Data/L1DataDef.h"
+
+#include "TrigConfigSvc/Verifyer.h"
+
+using namespace std;
+
+namespace TrigConf {
+
+   const unsigned int Verifyer::MUON_CABLE_MASK  = 0x0003ffff;
+   const unsigned int Verifyer::CP1_CABLE_MASK   = 0x00ffffff;
+   const unsigned int Verifyer::CP2_CABLE_MASK   = 0x00ffffff;
+   const unsigned int Verifyer::JEP1_CABLE_MASK  = 0xffffffff;
+   const unsigned int Verifyer::JEP2_CABLE_MASK  = 0x0000ffff;
+   const unsigned int Verifyer::JEP3_CABLE_MASK  = 0x00000fff;
+
+   /**
+    * Function checking if the trigger menu can be used in the simulation. A return value of true means the
+    * trigger menu failed the test, a return value of false means the trigger menu passed the test.
+    */
+   bool Verifyer::verify( const Menu& menu, MsgStream& log ) {
+
+      log << MSG::DEBUG << "---> Verifying the validity of the trigger menu..." 
+          << endreq;
+
+      if( verifyThCount( menu, log ) ) {
+         log << MSG::ERROR << "Verifyer::verifyThCount() failed" << endreq;
+         return true;
+      }
+
+      //if( verifyThLayout( menu, log ) ) {
+      //  log << MSG::ERROR << "Verifyer::verifyThLayout() failed" << endreq;
+      //  return true;
+      //}
+
+      log << MSG::DEBUG << "---> Trigger menu found to be valid" << endreq;
+      return false;
+
+   }
+
+   bool Verifyer::verifyThCount( const Menu& menu, MsgStream& log ) {
+
+      L1DataDef def;
+
+      log << MSG::VERBOSE << "  ---> Checking trigger threshold counts" << endreq;
+
+      //
+      // Count all the thresholds in the configuration:
+      //
+      unsigned int muon_th_count = 0;
+      unsigned int em_th_count = 0;
+      unsigned int tau_th_count = 0;
+      unsigned int emtau_th_count = 0;
+      unsigned int jet_th_count = 0;
+      unsigned int jetenergy_th_count = 0;
+      unsigned int jb_th_count = 0;
+      unsigned int jf_th_count = 0;
+      unsigned int energy_th_count = 0;
+      unsigned int missen_th_count = 0;
+      unsigned int rndm_th_count = 0;
+      unsigned int pclk_th_count = 0;
+      unsigned int bgrp_th_count = 0;
+      unsigned int nim_th_count = 0;
+      unsigned int mbts_th_count = 0;
+      unsigned int mbtssi_th_count = 0;
+      unsigned int zdc_th_count = 0;
+      unsigned int trt_th_count = 0;
+      unsigned int bcm_th_count = 0;
+      unsigned int bcmcmb_th_count = 0;
+      unsigned int lucid_th_count = 0;
+      unsigned int calreq_th_count = 0;
+      unsigned int zb_th_count = 0;
+      unsigned int xs_th_count = 0;
+
+      vector<unsigned int> count(L1DataDef::UNDEF);
+      for(auto& c: count) c=0;
+
+      for ( TriggerThreshold* thr : menu.thresholdVector() ) {
+
+         count[ thr->ttype() ] ++ ;
+         
+         if( thr->type() == def.muonType() ) {
+            muon_th_count++;
+         } else if( thr->type() == def.emType() ) {
+            em_th_count++;
+            emtau_th_count++;
+         } else if( thr->type() == def.tauType() ) {
+            tau_th_count++;
+            emtau_th_count++;
+         } else if( thr->type() == def.jetType() ) {
+            jet_th_count++;
+         } else if( thr->type() == def.jeType() ) {
+            jetenergy_th_count++;
+         } else if( thr->type() == def.jbType() ) {
+            jb_th_count++;
+         } else if( thr->type() == def.jfType() ) {
+            jf_th_count++;
+         } else if( thr->type() == def.teType() ) {
+            energy_th_count++;
+         } else if( thr->type() == def.xeType() ) {
+            missen_th_count++;
+         } else if ( thr->type() == def.rndmType()) {
+            rndm_th_count ++;
+         } else if ( thr->type() == def.pclkType()) {
+            pclk_th_count ++;
+         } else if ( thr->type() == def.bgrpType()) {
+            bgrp_th_count ++;
+         } else if ( thr->type() == def.nimType()) {
+            nim_th_count ++;
+         } else if ( thr->type() == def.mbtsType()) {
+            mbts_th_count ++;
+         } else if ( thr->type() == def.mbtssiType()) {
+            mbtssi_th_count ++;
+         } else if ( thr->type() == def.trtType()) {
+            trt_th_count ++;
+         } else if ( thr->type() == def.zdcType()) {
+            zdc_th_count ++;
+         } else if ( thr->type() == def.bcmType()) {
+            bcm_th_count ++;
+         } else if ( thr->type() == def.bcmcmbType()) {
+            bcmcmb_th_count ++;
+         } else if ( thr->type() == def.lucidType()) {
+            lucid_th_count ++;
+         } else if ( thr->type() == def.calreqType()) {
+            calreq_th_count ++;
+         } else if ( thr->type() == def.zbType()) {
+            zb_th_count ++;
+         } else if ( thr->type() == def.xsType()) {
+            xs_th_count ++;
+         }
+
+      }
+
+      //
+      // Check if the thresholds can fit on the cables:
+      //
+      if( muon_th_count > def.max_MUON_Threshold_Number() ) {
+
+         log << MSG::ERROR << "Too many MUON thresholds defined in the configuration" << endreq;
+         return true;
+
+      } else if( muon_th_count != def.max_MUON_Threshold_Number() ) {
+
+         log << MSG::WARNING << "    ---> Less than 6 MUON thresholds defined, TGC simulation will override!" << endreq;
+
+      } else {
+
+         log << MSG::VERBOSE << "    ---> MUON threshold count passed the check" << endreq;
+
+      }
+
+      if( em_th_count > def.max_EM_Threshold_Number() ) {
+
+         log << MSG::ERROR << "Too many EM thresholds defined in the configuration" << endreq;
+         return true;
+
+      } else {
+
+         log << MSG::VERBOSE << "    ---> EM threshold count passed the check" << endreq;
+
+      }
+
+      if( tau_th_count > def.max_TAU_Threshold_Number() ) {
+
+         log << MSG::ERROR << "Too many TAU thresholds defined in the configuration" << endreq;
+         return true;
+
+      } else {
+
+         log << MSG::VERBOSE << "    ---> TAU threshold count passed the check" << endreq;
+
+      }
+
+      if( jet_th_count > def.max_JET_Threshold_Number() ) {
+
+         log << MSG::ERROR << "Too many JET thresholds defined in the configuration" << endreq;
+         return true;
+
+      } else {
+
+         log << MSG::VERBOSE << "    ---> JET threshold count passed the check" << endreq;
+
+      }
+
+      if( jetenergy_th_count > def.max_JE_Threshold_Number() ) {
+
+         log << MSG::ERROR << "Too many JE thresholds defined in the configuration" << endreq;
+         return true;
+
+      } else {
+
+         log << MSG::VERBOSE << "    ---> JE threshold count passed the check" << endreq;
+
+      }
+
+      if( jb_th_count > def.max_JB_Threshold_Number() ) {
+
+         log << MSG::ERROR << "Too many JB thresholds defined in the configuration" << endreq;
+         return true;
+
+      } else {
+
+         log << MSG::VERBOSE << "    ---> JB threshold count passed the check" << endreq;
+
+      }
+
+      if( jf_th_count > def.max_JF_Threshold_Number() ) {
+
+         log << MSG::ERROR << "Too many JF thresholds defined in the configuration" << endreq;
+         return true;
+
+      } else {
+
+         log << MSG::VERBOSE << "    ---> JF threshold count passed the check" << endreq;
+
+      }
+
+      if( energy_th_count > def.max_TE_Threshold_Number() ) {
+
+         log << MSG::ERROR << "Too many TE thresholds defined in the configuration" << endreq;
+         return true;
+
+      } else {
+
+         log << MSG::VERBOSE << "    ---> TE threshold count passed the check" << endreq;
+
+      }
+
+      if( missen_th_count > def.max_XE_Threshold_Number() ) {
+         log << MSG::ERROR << 
+            "Too many XE thresholds defined in the configuration" << endreq;
+         return true;
+      } else {
+         log << MSG::VERBOSE << 
+            "    ---> XE threshold count passed the check" << endreq;
+      }
+
+      if(rndm_th_count > def.max_RNDM_Threshold_Number()) {
+         log << MSG::ERROR << 
+            "Too many RNDM thresholds defined in the configuration" << endreq;
+         return true;
+      } else {
+         log << MSG::VERBOSE << 
+            "    ---> RNDM threshold count passed the check" << endreq;
+      }
+      if(pclk_th_count > def.max_PCLK_Threshold_Number()) {
+         log << MSG::ERROR << 
+            "Too many PCLK thresholds defined in the configuration" << endreq;
+         return true;
+      } else {
+         log << MSG::VERBOSE << 
+            "    ---> PCLK threshold count passed the check" << endreq;
+      }
+      if(bgrp_th_count > def.max_BGRP_Threshold_Number()) {
+         log << MSG::ERROR << 
+            "Too many BGRP thresholds defined in the configuration" << endreq;
+         return true;
+      } else {
+         log << MSG::VERBOSE << 
+            "    ---> BGRP threshold count passed the check" << endreq;
+      }
+
+
+      if( count[L1DataDef::TOPO] > L1DataDef::typeConfig( L1DataDef::TOPO ).max ) {
+         log << MSG::ERROR << 
+            "Too many TOPO thresholds defined in the configuration" << endreq;
+         return true;
+      } else {
+         log << MSG::VERBOSE << 
+            "TOPO threshold count passed the check" << endreq;
+      }
+
+
+
+
+
+      //===========================================================================
+      // NOW INTERNAL TRIGGERS ARE NOT DEFINED IN THE THRESHOLD LIST
+      // THEY ONLY APPEAR AS A STRING INSIDE ITERM LOGIC
+      //===========================================================================
+      //     if (rndm_th_count != def.max_RNDM_Threshold_Number()) {
+      //       log << MSG::WARNING << 
+      // 	"Only " << rndm_th_count << " RNDM thresholds are defined! " <<
+      // 	" maximum allowed is " << def.max_RNDM_Threshold_Number() << endreq;
+      //     }
+      //     if (pclk_th_count != def.max_PCLK_Threshold_Number()) {
+      //       log << MSG::WARNING << 
+      // 	"Only " << pclk_th_count << " PCLK thresholds are defined! " <<
+      // 	" maximum allowed is " << def.max_PCLK_Threshold_Number() << endreq;
+      //     }
+      //     if (bgrp_th_count != def.max_BGRP_Threshold_Number()) {
+      //       log << MSG::WARNING << 
+      // 	"Only " << bgrp_th_count << " BGRP thresholds are defined! " <<
+      // 	" maximum allowed is " << def.max_BGRP_Threshold_Number() << endreq;
+      //     }
+      //===========================================================================
+
+      log << MSG::VERBOSE << "  ---> Trigger threshold counts passed the tests" << endreq;
+      return false;
+
+   }
+
+   bool Verifyer::verifyThLayout( const Menu& menu, MsgStream& log ) {
+
+      L1DataDef def;
+      //
+      // Now check that the layout of the thresholds on the cables is possible or not:
+      //
+      log << MSG::VERBOSE << "  ---> Checking layout of trigger thresholds onto cables" << endreq;
+
+      unsigned int muon_cable = !MUON_CABLE_MASK;
+      unsigned int cp1_cable  = !CP1_CABLE_MASK;
+      unsigned int cp2_cable  = !CP2_CABLE_MASK;
+      unsigned int jep1_cable = !JEP1_CABLE_MASK;
+      unsigned int jep2_cable = !JEP2_CABLE_MASK;
+      unsigned int jep3_cable = !JEP3_CABLE_MASK;
+
+      for ( vector< TriggerThreshold* >::const_iterator it = menu.thresholdVector().begin();
+            it != menu.thresholdVector().end(); ++it ) {
+         if ( (*it)->type()==L1DataDef::rndmType() ||
+              (*it)->type()==L1DataDef::pclkType() ||
+              (*it)->type()==L1DataDef::bgrpType()) {
+            // Internal trigger, so there's no input cable
+            continue;
+         }
+
+         if( ( *it )->cableName() == "MU" ) {
+
+            if( ( *it )->type() != def.muonType() ) {
+               log << MSG::ERROR << "    ---> A(n) " << ( *it )->type() << " threshold can't be put on the MU cable!" << endreq;
+               return true;
+            }
+            if( muon_cable & createMask( ( *it )->cableStart(), ( *it )->cableEnd() ) ) {
+               log << MSG::ERROR << "    ---> The bits from " << ( *it )->cableStart() << " to " << ( *it )->cableEnd() << " on cable MU "
+                   << "are already partly or totally taken" << endreq;
+               log << MSG::ERROR << "         Threshold " << ( *it )->name() << " can't be placed" << endreq;
+               return true;
+            }
+            muon_cable |= createMask( ( *it )->cableStart(), ( *it )->cableEnd() );
+            log << MSG::VERBOSE << "    ---> Trigger threshold " << ( *it )->name() << " on cable MU verifyed" << endreq;
+
+
+         } else if( ( *it )->cableName() == "CP1" ) {
+
+            if( ( *it )->type() != def.emType() ) {
+               log << MSG::ERROR << "    ---> A(n) " << ( *it )->type() << " threshold can't be put on the CP1 cable!" << endreq;
+               return true;
+            }
+            if( cp1_cable & createMask( ( *it )->cableStart(), ( *it )->cableEnd() ) ) {
+               log << MSG::ERROR << "    ---> The bits from " << ( *it )->cableStart() << " to " << ( *it )->cableEnd() << " on cable CP1 "
+                   << "are already partly or totally taken" << endreq;
+               log << MSG::ERROR << "         Threshold " << ( *it )->name() << " can't be placed" << endreq;
+               return true;
+            }
+            cp1_cable |= createMask( ( *it )->cableStart(), ( *it )->cableEnd() );
+            log << MSG::VERBOSE << "    ---> Trigger threshold " << ( *it )->name() << " on cable CP1 verifyed" << endreq;
+
+
+         } else if( ( *it )->cableName() == "CP2" ) {
+
+            if( ! ( ( ( *it )->type() == def.emType() ) || ( ( *it )->type() == def.tauType() ) ) ) {
+               log << MSG::ERROR << "  ---> A(n) " << ( *it )->type() << " threshold can't be put on the CP2 cable!" << endreq;
+               return true;
+            }
+            if( cp2_cable & createMask( ( *it )->cableStart(), ( *it )->cableEnd() ) ) {
+               log << MSG::ERROR << "    ---> The bits from " << ( *it )->cableStart() << " to " << ( *it )->cableEnd() << " on cable CP2 "
+                   << "are already partly or totally taken" << endreq;
+               log << MSG::ERROR << "         Threshold " << ( *it )->name() << " can't be placed" << endreq;
+               return true;
+            }
+            cp2_cable |= createMask( ( *it )->cableStart(), ( *it )->cableEnd() );
+            log << MSG::VERBOSE << "    ---> Trigger threshold " << ( *it )->name() << " on cable CP2 verifyed" << endreq;
+
+         } else if( ( *it )->cableName() == "JEP1" ) {
+
+            if( ! ( ( ( *it )->type() == def.jetType() ) || ( ( *it )->type() == def.jeType() ) ) ) {
+               log << MSG::ERROR << "    ---> A(n) " << ( *it )->type() << " threshold can't be put on the JEP1 cable!" << endreq;
+               return true;
+            }
+            if( jep1_cable & createMask( ( *it )->cableStart(), ( *it )->cableEnd() ) ) {
+               log << MSG::ERROR << "    ---> The bits from " << ( *it )->cableStart() << " to " << ( *it )->cableEnd() << " on cable JEP1 "
+                   << "are already partly or totally taken" << endreq;
+               log << MSG::ERROR << "         Threshold " << ( *it )->name() << " can't be placed" << endreq;
+               return true;
+            }
+            jep1_cable |= createMask( ( *it )->cableStart(), ( *it )->cableEnd() );
+            log << MSG::VERBOSE << "    ---> Trigger threshold " << ( *it )->name() << " on cable JEP1 verifyed" << endreq;
+
+         } else if( ( *it )->cableName() == "JEP2" ) {
+
+            if( ! ( ( *it )->type()==def.jbType() || (*it)->type()==def.jfType()) ) {
+               log << MSG::ERROR << "    ---> A(n) " << ( *it )->type() << " threshold can't be put on the JEP2 cable!" << endreq;
+               return true;
+            }
+            if( jep2_cable & createMask( ( *it )->cableStart(), ( *it )->cableEnd() ) ) {
+               log << MSG::ERROR << "    ---> The bits from " << ( *it )->cableStart() << " to " << ( *it )->cableEnd() << " on cable JEP2 "
+                   << "are already partly or totally taken" << endreq;
+               log << MSG::ERROR << "         Threshold " << ( *it )->name() << " can't be placed" << endreq;
+               return true;
+            }
+            jep2_cable |= createMask( ( *it )->cableStart(), ( *it )->cableEnd() );
+            log << MSG::VERBOSE << "    ---> Trigger threshold " << ( *it )->name() << " on cable JEP2 verifyed" << endreq;
+
+         } else if( ( *it )->cableName() == "JEP3" ) {
+
+            if( ! ( ( ( *it )->type() == def.teType() ) || ( ( *it )->type() == def.xeType() ) ) ) {
+               log << MSG::ERROR << "    ---> A(n) " << ( *it )->type() << " threshold can't be put on the JEP3 cable!" << endreq;
+               return true;
+            }
+
+
+            if( jep3_cable & createMask( ( *it )->cableStart(), ( *it )->cableEnd() ) ) {
+               log << MSG::ERROR << "    ---> The bits from " << ( *it )->cableStart() << " to " << ( *it )->cableEnd() << " on cable JEP3 "
+                   << "are already partly or totally taken" << endreq;
+               log << MSG::ERROR << "         Threshold " << ( *it )->name() << " can't be placed" << endreq;
+               return true;
+            }
+            jep3_cable |= createMask( ( *it )->cableStart(), ( *it )->cableEnd() );
+            log << MSG::VERBOSE << "    ---> Trigger threshold " << ( *it )->name() << " on cable JEP3 verifyed" << endreq;
+
+         } else if( ( *it )->cableName() == "NIM" ) {
+
+            if( ! ( (*it)->type() == def.nimType() ||
+                    (*it)->type()==def.mbtsType() ||
+                    (*it)->type()==def.mbtssiType() ||
+                    (*it)->type()==def.zdcType() ||
+                    (*it)->type()==def.trtType() ||
+                    (*it)->type()==def.bcmType() ||
+                    (*it)->type()==def.bcmcmbType() || 
+                    (*it)->type()==def.lucidType())) {
+               log << MSG::ERROR << "    ---> A(n) " << (*it)->type() 
+                   << " threshold can't be put on the NIM cable!" << endreq; // This check seems tied to an outdated cabling...
+               return true;
+            }
+            log << MSG::VERBOSE << "    ---> Trigger threshold " 
+                << ( *it )->name() << " on cable NIM verifyed" << endreq;
+
+         } else if( ( *it )->cableName() == "MBTS" ) {
+         } else {
+	
+            log << MSG::ERROR << "     ---> There is no cable named: " << ( *it )->cableName() << endreq;
+            log << MSG::ERROR << "          Threshold " << ( *it )->name() << " can't be placed" << endreq;
+            return true;
+
+         }
+
+      }
+
+      log << MSG::VERBOSE << "  ---> Trigger thresholds layout passed the tests" << endreq;
+      return false;
+
+   }
+
+   unsigned int Verifyer::createMask( int startbit, int stopbit ) {
+
+      unsigned int result = 0;
+
+      for( int i = 0; i < ( abs( startbit - stopbit ) + 1 ); ++i ) {
+
+         result <<= 1;
+         result |= 0x1;
+
+      }
+
+      result <<= min( startbit, stopbit );
+
+      return result;
+
+   }
+
+   template< class T > T Verifyer::max( T i, T j ) {
+
+      return i > j ? i : j;
+
+   }
+
+   template< class T > T Verifyer::min( T i, T j ) {
+
+      return i > j ? j : i;
+
+   }
+
+} // namespace TrigConf
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/components/TrigConfigSvc_entries.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/components/TrigConfigSvc_entries.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..277c7e989873f621429acce049f9ea7e161f7280
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/components/TrigConfigSvc_entries.cxx
@@ -0,0 +1,31 @@
+
+
+#include "GaudiKernel/DeclareFactoryEntries.h"
+
+#include "TrigConfigSvc/L1TopoConfigSvc.h"
+#include "TrigConfigSvc/LVL1ConfigSvc.h"
+#include "TrigConfigSvc/DSConfigSvc.h"
+#include "TrigConfigSvc/HLTConfigSvc.h"
+#include "TrigConfigSvc/HLTJobOptionsSvc.h"
+#include "TrigConfigSvc/TrigConfigSvc.h"
+#include "TrigConfigSvc/TrigConfDataIOVChanger.h"
+
+DECLARE_NAMESPACE_ALGORITHM_FACTORY( TrigConf, TrigConfDataIOVChanger )
+
+DECLARE_NAMESPACE_SERVICE_FACTORY( TrigConf, L1TopoConfigSvc     )
+DECLARE_NAMESPACE_SERVICE_FACTORY( TrigConf, LVL1ConfigSvc     )
+DECLARE_NAMESPACE_SERVICE_FACTORY( TrigConf, HLTConfigSvc      )
+DECLARE_NAMESPACE_SERVICE_FACTORY( TrigConf, HLTJobOptionsSvc  )
+DECLARE_NAMESPACE_SERVICE_FACTORY( TrigConf, DSConfigSvc       )
+DECLARE_NAMESPACE_SERVICE_FACTORY( TrigConf, TrigConfigSvc     )
+
+DECLARE_FACTORY_ENTRIES( TrigConfigSvc ) {
+  DECLARE_NAMESPACE_ALGORITHM( TrigConf, TrigConfDataIOVChanger )
+
+  DECLARE_NAMESPACE_SERVICE( TrigConf, L1TopoConfigSvc   )
+  DECLARE_NAMESPACE_SERVICE( TrigConf, LVL1ConfigSvc     )
+  DECLARE_NAMESPACE_SERVICE( TrigConf, HLTConfigSvc      )
+  DECLARE_NAMESPACE_SERVICE( TrigConf, HLTJobOptionsSvc  )
+  DECLARE_NAMESPACE_SERVICE( TrigConf, DSConfigSvc       )
+  DECLARE_NAMESPACE_SERVICE( TrigConf, TrigConfigSvc     )
+}
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/components/TrigConfigSvc_load.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/components/TrigConfigSvc_load.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..8cd9e6b33dddbf310c08c114bc32137c6d2c4379
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/components/TrigConfigSvc_load.cxx
@@ -0,0 +1,10 @@
+//Notes:
+//
+//1. The argument to the LOAD_FACTORY_ENTRIES() is the name of the
+//   component library (libXXX.so).
+//
+// See Athena User Guide for more information
+
+#include "GaudiKernel/LoadFactoryEntries.h"
+
+LOAD_FACTORY_ENTRIES( TrigConfigSvc )
diff --git a/Trigger/TrigConfiguration/TrigConfigSvc/src/test/TrigConfigARATest.cxx b/Trigger/TrigConfiguration/TrigConfigSvc/src/test/TrigConfigARATest.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..8dc2728e8ad60cfe384bef6d5a538969a46e2174
--- /dev/null
+++ b/Trigger/TrigConfiguration/TrigConfigSvc/src/test/TrigConfigARATest.cxx
@@ -0,0 +1,38 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <stdint.h>
+
+#include "TrigConfigSvc/TrigConfigSvcARA.h"
+
+int main(int argc, char *argv[]) {
+
+   std::string inputFile("AOD.pool.root");
+
+   if(argc>1) inputFile = std::string(argv[1]);
+
+   unsigned int runnumber = 5200; // 106303
+   if(argc>2) {
+      std::stringstream s(argv[2]);
+      s >> runnumber;
+   }
+
+   std::cout << "Test program to read configuration from " << inputFile << std::endl;
+   
+   std::vector< std::string > filenames;
+   filenames.push_back(inputFile);
+   
+   TrigConf::TrigConfigSvcARA tcs( filenames );
+   tcs.setVerbose();
+   std::cout << "update for runnumber " << runnumber << std::endl;
+   tcs.update(runnumber,1);
+
+   std::cout << tcs << std::endl;
+
+   return 1;
+}