Commit c324f894 authored by Joerg Stelzer's avatar Joerg Stelzer Committed by Graeme Stewart
Browse files

HLTConfigSvc.cxx: protect against empty PrescaleSets in hltPrescalekey() (TrigConfigSvc-01-01-31)

parent cf4dd8d2
/*
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
/*
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
/*
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
/*
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
// 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
// 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
// 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
// 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
// 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
// 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
/*
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);