Commit a272773b authored by Frank Winklmeier's avatar Frank Winklmeier Committed by Graeme Stewart
Browse files

Remove prescale/conditions update methods from interface (TrigKernel-20-03-00)

parent 27493a6d
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef HltAcceptFlag_H
#define HltAcceptFlag_H
#include "TrigKernel/HltOnlHelper.h"
#include <string>
#include <stdint.h>
// Definition of different acceptance flags
namespace hltonl {
enum AcceptFlag {
PSC_FORCED_REJECT = -4,
STEERING_REJECT,
PSC_UNDEFINED,
PSC_DEBUG,
STEERING_DEBUG,
STEERING_ACCEPT,
PSC_FORCED_ACCEPT,
NUM_ACCEPTANCE_FLAGS = 7
};
/// helper class to map accept codes to string names or a int indexes
class MapAcceptFlag: virtual public hltonl::MapEnumeration<hltonl::AcceptFlag> {
public:
MapAcceptFlag();
virtual ~MapAcceptFlag() {};
};
/// helper function to print HLT accept flag in human readable form
std::string PrintHltAcceptFlag(hltonl::AcceptFlag) ;
}
inline hltonl::MapAcceptFlag::MapAcceptFlag() {
// add error codes and description
add(hltonl::PSC_FORCED_REJECT ,"PSC_FORCED_REJECT") ;
add(hltonl::STEERING_REJECT ,"STEERING_REJECT") ;
add(hltonl::PSC_UNDEFINED ,"PSC_UNDEFINED") ;
add(hltonl::PSC_DEBUG ,"PSC_DEBUG") ;
add(hltonl::STEERING_DEBUG ,"STEERING_DEBUG") ;
add(hltonl::STEERING_ACCEPT ,"STEERING_ACCEPT") ;
add(hltonl::PSC_FORCED_ACCEPT ,"PSC_FORCED_ACCEPT") ;
// return values in case of invalid code
invalidCode("UNDEFINED",-10);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef HltExtraStatusCode_H
#define HltExtraStatusCode_H
namespace hltonl {
/**
* Status flag bits used to encode the success/failure of HLT updates
*/
enum ExtraStatusCode {
HLT_PRESCALE_UPDATE = 1,
COOL_UPDATE = 2
// This is a bitmap. Next value to be used should be '4'.
};
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef HltOnlHelper_H
#define HltOnlHelper_H
#include <string>
#include <utility>
#include <map>
#include <stdint.h>
// Helper class for easy access of error codes defined in enumerations
namespace hltonl {
template <class Type> class MapEnumeration {
public:
typedef std::pair<std::string, int> EnumMapEntry;
typedef std::map<Type, EnumMapEntry> EnumMap;
MapEnumeration();
virtual ~MapEnumeration() {};
virtual std::string codeToName( Type );
virtual int codeToHash( Type );
virtual typename EnumMap::const_iterator begin();
virtual typename EnumMap::const_iterator end();
protected:
virtual void add( Type, std::string );
virtual void invalidCode(std::string, int );
private:
EnumMap m_enumMap;
int m_hash_index;
EnumMapEntry m_invalid_code;
};
} // end name space hltonl
template <class Type> hltonl::MapEnumeration<Type>::MapEnumeration():
m_hash_index(0), m_invalid_code("UNDEFINED",-1) {}
template <class Type> std::string hltonl::MapEnumeration<Type>::codeToName(Type code) {
typename EnumMap::const_iterator map_it = m_enumMap.find(code) ;
if(map_it != m_enumMap.end()) {
return ((*map_it).second).first ;
} else {
return m_invalid_code.first ;
}
}
template <class Type> int hltonl::MapEnumeration<Type>::codeToHash(Type code) {
typename EnumMap::const_iterator map_it = m_enumMap.find(code) ;
if(map_it != m_enumMap.end()) {
return ((*map_it).second).second ;
} else {
return m_invalid_code.second ;
}
}
template <class Type> typename hltonl::MapEnumeration<Type>::EnumMap::const_iterator hltonl::MapEnumeration<Type>::begin() {
return m_enumMap.begin();
}
template <class Type> typename hltonl::MapEnumeration<Type>::EnumMap::const_iterator hltonl::MapEnumeration<Type>::end() {
return m_enumMap.end();
}
template <class Type> void hltonl::MapEnumeration<Type>::add(Type code, std::string name) {
m_hash_index++;
m_enumMap[code] = EnumMapEntry(name, m_hash_index);
}
template <class Type> void hltonl::MapEnumeration<Type>::invalidCode(std::string inv_name, int inv_code) {
m_invalid_code = EnumMapEntry(inv_name, inv_code);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef HltOstreams_H
#define HltOstreams_H
#include <iostream>
#include <set>
#include <vector>
#include <stdint.h>
#include "eformat/eformat.h"
#include "hltinterface/HLTResult.h"
std::ostream& operator<<(std::ostream& os, const std::vector<eformat::helper::StreamTag>& rhs);
std::ostream& operator<<(std::ostream& os, const std::vector<uint32_t>& rhs);
std::ostream& operator<<(std::ostream& os, const std::vector<eformat::SubDetector>& rhs);
std::ostream& operator<<(std::ostream& os, const std::set<uint32_t>& rhs);
std::ostream& operator<<(std::ostream& os, const std::set<eformat::SubDetector>& rhs);
std::ostream& operator<<(std::ostream& os, const hltinterface::HLTResult& rhs);
#endif // HltOstreams_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PscErrorCode_H
#define PscErrorCode_H
#include "TrigKernel/HltOnlHelper.h"
#include <string>
#include <stdint.h>
// Definition of different error codes for the PSC
namespace hltonl {
enum PSCErrorCode {
PSC_ERROR_UNCLASSIFIED = 0x0,
PSC_ERROR_NO_L1_RESULT = 0x1,
PSC_ERROR_SG_CLEAR_FAILED = 0x2,
PSC_ERROR_NO_EVENTINFO = 0x3,
PSC_ERROR_NO_VALID_EVENT = 0x4,
PSC_ERROR_NO_HLTRESULT_FOUND = 0x10,
PSC_ERROR_NO_HLTRESULT_RETRIEVED = 0x11,
PSC_ERROR_INVALID_CTP_RESULT = 0x101,
PSC_ERROR_ROB_BUILD_FAILED = 0x102,
NUM_PSC_ERROR_CODES = 9
};
/// helper class to map HLT PSC error code on a string name or a int index
class MapPscErrorCode: virtual public hltonl::MapEnumeration<hltonl::PSCErrorCode> {
public:
MapPscErrorCode();
virtual ~MapPscErrorCode() {};
};
/// helper function to print HLT PSC error code in human readable form
std::string PrintPscErrorCode(hltonl::PSCErrorCode) ;
}
inline hltonl::MapPscErrorCode::MapPscErrorCode() {
// add error codes and description
add(hltonl::PSC_ERROR_UNCLASSIFIED ,"PSC_ERROR_UNCLASSIFIED") ;
add(hltonl::PSC_ERROR_NO_L1_RESULT ,"PSC_ERROR_NO_L1_RESULT") ;
add(hltonl::PSC_ERROR_SG_CLEAR_FAILED ,"PSC_ERROR_SG_CLEAR_FAILED") ;
add(hltonl::PSC_ERROR_NO_EVENTINFO ,"PSC_ERROR_NO_EVENTINFO") ;
add(hltonl::PSC_ERROR_NO_VALID_EVENT ,"PSC_ERROR_NO_VALID_EVENT") ;
add(hltonl::PSC_ERROR_NO_HLTRESULT_FOUND ,"PSC_ERROR_NO_HLTRESULT_FOUND") ;
add(hltonl::PSC_ERROR_NO_HLTRESULT_RETRIEVED,"PSC_ERROR_NO_HLTRESULT_RETRIEVED") ;
add(hltonl::PSC_ERROR_INVALID_CTP_RESULT ,"PSC_ERROR_INVALID_CTP_RESULT") ;
add(hltonl::PSC_ERROR_ROB_BUILD_FAILED ,"PSC_ERROR_ROB_BUILD_FAILED") ;
// return values in case of invalid code
invalidCode("UNDEFINED",-1);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef HltResultStatusCode_H
#define HltResultStatusCode_H
#include "TrigKernel/HltOnlHelper.h"
#include <string>
#include <stdint.h>
// Definition of different status codes for HLT result
namespace hltonl {
enum ResultStatusCode {
NORMAL_HLT_RESULT = 0x0,
DUMMY_HLT_RESULT = 0x1,
NORMAL_HLT_RESULT_TRUNCATED = 0x100,
DUMMY_HLT_RESULT_TRUNCATED = 0x101,
NUM_HLT_STATUS_CODES = 4
};
/// helper class to map HLT error code on a string name or a int index
class MapResultStatusCode: virtual public hltonl::MapEnumeration<hltonl::ResultStatusCode> {
public:
MapResultStatusCode();
virtual ~MapResultStatusCode() {};
};
/// helper function to print an HLT status code in human readable form
std::string PrintHltResultStatusCode(hltonl::ResultStatusCode) ;
}
inline hltonl::MapResultStatusCode::MapResultStatusCode() {
// add status codes and description
add(hltonl::NORMAL_HLT_RESULT ,"NORMAL_HLT_RESULT") ;
add(hltonl::DUMMY_HLT_RESULT ,"DUMMY_HLT_RESULT") ;
add(hltonl::NORMAL_HLT_RESULT_TRUNCATED ,"NORMAL_HLT_RESULT_TRUNCATED") ;
add(hltonl::DUMMY_HLT_RESULT_TRUNCATED ,"DUMMY_HLT_RESULT_TRUNCATED") ;
// return values in case of invalid code
invalidCode("UNDEFINED",-1);
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef HLTNETTHISTSVC_H
#define HLTNETTHISTSVC_H
/**
* @file IHltTHistSvc
* @author Tomasz Bold
* @date 2005-09-27
* @brief The extension of the histogramming service THistSvc
* This interface adds methods used to handle communication.
* Actually the send method is suppose to handle safely TTrees.
*/
#include "GaudiKernel/IService.h"
//class StatusCode;
static const InterfaceID IID_IHltTHistSvc("IHltTHistSvc", 1 , 0);
class IHltTHistSvc : virtual public IService {
public:
static const InterfaceID& interfaceID(){return IID_IHltTHistSvc;};
/**
* method which can be used to connet to
* histograms sink (do we need it since IService hast such calls?)
*/
virtual StatusCode connect() = 0;
/**
* this method is called each event
*/
virtual StatusCode send() = 0;
/**
* this method is called at the finalization of the
* service (do we need it since IService hast such calls?)
*/
virtual StatusCode disconnect() = 0;
};
#endif // IHLTNETTHISTSVC_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**@class ITrigEventLoopMgr
* @brief EventLoopMgr interface implemented by the HLT event loop manager
*
* Provides additional interfaces for TDAQ state transitions used by the PSC.
* It follows the usual Gaudi philosophy of separation framework and client
* implemenation into sysXYZ and XYZ methods.
*
* @author Frank Winklmeier
* @version $Id: ITrigEventLoopMgr.h 39 2013-06-10 17:21:44Z ricab $
*/
#ifndef TRIGKERNEL_ITRIGEVENTLOOPMGR_H
#define TRIGKERNEL_ITRIGEVENTLOOPMGR_H
#include "eformat/ROBFragment.h"
#include "GaudiKernel/IInterface.h"
#include <boost/property_tree/ptree.hpp>
#include <vector>
#include <stdint.h>
namespace hltinterface
{
class EventId;
class HLTResult;
}
class ITrigEventLoopMgr: virtual public IInterface {
public:
/*
* Retrieve interface ID
*/
static const InterfaceID& interfaceID();
/**
* prepareForRun method invoked by framework
*/
virtual StatusCode prepareForRun(const boost::property_tree::ptree &) = 0;
/**
* update parameters if necessary after forking workers and issue incident
*/
virtual StatusCode hltUpdateAfterFork(const boost::property_tree::ptree &) = 0;
/**
* propagate a processing time out via the HLT framework to the steering/algorithms
*/
virtual StatusCode timeOutReached(const boost::property_tree::ptree&) = 0;
/// process one event/RoI
virtual StatusCode
processRoIs(const std::vector<eformat::ROBFragment<const uint32_t*> >&,
hltinterface::HLTResult&,
const hltinterface::EventId& evId) = 0;
};
inline const InterfaceID& ITrigEventLoopMgr::interfaceID()
{
static const InterfaceID IID_ITrigEventLoopMgr("ITrigEventLoopMgr", 20, 1);
return IID_ITrigEventLoopMgr;
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGKERNEL_ITRIGIS_H
#define TRIGKERNEL_ITRIGIS_H
/**@class ITrigIS
* @brief Interface for IS publication service
*
* @author Frank Winklmeier
* @version $Id: ITrigIS.h 2 2013-05-10 13:12:14Z ricab $
*/
#include "GaudiKernel/IInterface.h"
#include <string>
class ISInfo;
class ISInfoDictionary;
class ITrigIS: virtual public IInterface {
public:
/*
* Retrieve interface ID
*/
static const InterfaceID& interfaceID();
/*
* Publish ISInfo object
*
* Forwards to IsInfoDictionary::checkin and catches exceptions.
* Ownership of info remains with caller.
*/
virtual StatusCode publish(const std::string& name, const ISInfo& info, bool keep_history=false) = 0;
/*
* Same as publish but might publish ISInfo object asynchronously.
* Ownership of info is transfered to this service.
*/
virtual void publish_async(const std::string& name, ISInfo* info, bool keep_history=false) = 0;
/*
* Return reference to ISInfoDictionary
*/
virtual ISInfoDictionary& infoDict() = 0;
};
inline const InterfaceID& ITrigIS::interfaceID()
{
static const InterfaceID IID_ITrigIS("ITrigIS", 1, 0);
return IID_ITrigIS;
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**@class ITrigMessageSvc
* @brief Additional MessageSvc interface for TrigMessageSvc
*
* Provides additional methods for the online message service
*
* @author Frank Winklmeier
* @version $Id: ITrigMessageSvc.h 2 2013-05-10 13:12:14Z ricab $
*/
#ifndef TRIGKERNEL_ITRIGMESSAGESVC_H
#define TRIGKERNEL_ITRIGMESSAGESVC_H
#include "GaudiKernel/IInterface.h"
class ITrigMessageSvc: virtual public IInterface {
public:
/// Retrieve interface ID
static const InterfaceID& interfaceID();
/*
* Reset all individual output levels
*/
virtual void resetOutputLevels() = 0;
};
inline const InterfaceID& ITrigMessageSvc::interfaceID()
{
static const InterfaceID IID_ITrigMessageSvc("ITrigMessageSvc", 1, 0);
return IID_ITrigMessageSvc;
}
#endif
package TrigKernel
author W. Wiedenmann <Werner.Wiedenmann@cern.ch>
author Ricardo Abreu <Ricardo.Abreu@cern.ch>
public
use AtlasPolicy AtlasPolicy-*
use GaudiInterface GaudiInterface-* External
use DataCollection DataCollection-* External
use AtlasBoost AtlasBoost-* External
use HLTtdaq HLTtdaq-* HLT/HLTExternal
library TrigKernel *.cxx
apply_pattern installed_library
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "TrigKernel/HltAcceptFlag.h"
//
// helper function to print HLT accept flag in human readable form
//
std::string hltonl::PrintHltAcceptFlag(hltonl::AcceptFlag hlt_flag) {
hltonl::MapAcceptFlag mapAccept;
return mapAccept.codeToName(hlt_flag) ;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//=========================================================================
// output operators for HLTResult
//=========================================================================
#include "TrigKernel/HltOstreams.h"
#include "TrigKernel/HltAcceptFlag.h"
#include "TrigKernel/HltResultStatusCode.h"
#include "TrigKernel/HltPscErrorCode.h"
std::ostream& operator<<(std::ostream& os, const std::vector<eformat::helper::StreamTag>& rhs)
{
std::string prefix("\n(");
for (std::vector<eformat::helper::StreamTag>::const_iterator it = rhs.begin(); it != rhs.end(); it++) {
os << prefix << (*it).name << "," << (*it).type << "," << (*it).obeys_lumiblock
<< ",[Rob=" << (*it).robs.size() << ":" << (*it).robs
<< "],[Det=" << (*it).dets.size() << ":" << (*it).dets
<< "])";
prefix=",\n(";
}
return os;
}
std::ostream& operator<<(std::ostream& os, const std::vector<uint32_t>& rhs)
{
std::string prefix("0x");
os << std::hex << std::setfill( '0' );
for (std::vector<uint32_t>::const_iterator it = rhs.begin(); it != rhs.end(); it++) {
os << prefix << std::setw(8) << *it;
prefix = ", 0x";
}
os << std::dec << std::setfill(' ');
return os;
}
std::ostream& operator<<(std::ostream& os, const std::vector<eformat::SubDetector>& rhs)
{
std::string prefix("0x");
for (std::vector<eformat::SubDetector>::const_iterator it = rhs.begin(); it != rhs.end(); it++) {
os << prefix << std::hex << *it << std::dec << "="
<< eformat::helper::SourceIdentifier(*it,0).human_detector();
prefix = ", 0x";
}
return os;
}
std::ostream& operator<<(std::ostream& os, const std::set<uint32_t>& rhs)
{
std::string prefix("0x");
os << std::hex << std::setfill( '0' );
for (std::set<uint32_t>::const_iterator it = rhs.begin(); it != rhs.end(); it++) {
os << prefix << std::setw(8) << *it;
prefix = ", 0x";
}
os << std::dec << std::setfill(' ');
return os;
}
std::ostream& operator<<(std::ostream& os, const std::set<eformat::SubDetector>& rhs)
{
std::string prefix("0x");
for (std::set<eformat::SubDetector>::const_iterator it = rhs.begin(); it != rhs.end(); it++) {
os << prefix << std::hex << *it << std::dec << "="
<< eformat::helper::SourceIdentifier(*it,0).human_detector();
prefix = ", 0x";
}
return os;
}
std::ostream& operator<<(std::ostream& os, const hltinterface::HLTResult& rhs) {
os << "[HLT Result]" ;
os << "\n HLT Result: fragment_pointer = " << std::hex << rhs.fragment_pointer << std::dec
<< ", max_result_size [words] = " << rhs.max_result_size ;
os << "\n HLT Result: Number of HLT result ROBs = " << rhs.hltResult_robs.size() ;
os << "\n [";
if (rhs.fragment_pointer != 0) {
for (const auto& hltrob : rhs.hltResult_robs) {
os << "\n HLT ROB: Source Identifier = 0x" << std::hex << (hltrob.source_id()) << std::dec
<< ", ROB fragment size [words] = " << std::setw(6) << hltrob.fragment_size_word()
<< ", # status words = " << hltrob.nstatus() << ", status words =" ;
const uint32_t* it;
hltrob.status(it);
for (uint32_t i(0); i < hltrob.nstatus(); ++i) {