Commit 66c79d66 authored by Scott Snyder's avatar Scott Snyder Committed by Graeme Stewart
Browse files

Migrate Algorithm -> AthAlgorithm. (TrigInterfaces-01-01-52)

parent 2cdfdc85
This diff is collapsed.
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGINTERFACES_ALGOCONFIG_H
#define TRIGINTERFACES_ALGOCONFIG_H
#include <string>
#include "TrigSteeringEvent/Enums.h"
class TriggerStore;
class StoreGateSvc;
class MsgStream;
class PartialEventBuildingInfo;
class ScoutingInfo;
class TrigOperationalInfo;
namespace HLT
{
class Navigation;
class RobRequestInfo;
/**
* @brief Class describing the configuration for HLT algorithms.
*
* @author Tomasz Bold <Tomasz.Bold@cern.ch> - U. of California, Irvine
* @author Till Eifert <Till.Eifert@cern.ch> - U. of Geneva, Switzerland
*
* This class holds all the common configuration variables for the HLT steering and
* the HLT algorithms.
*/
class AlgoConfig {
public:
/** @brief Constructor setting all the variables to default values. */
AlgoConfig()
: m_hltLevel(HLT::L2),
m_useL1Simulation(true),
m_useL1CaloSimulation(true),
m_useL1MuonSimulation(false),
m_doTiming(false),
m_updateCaloRoIs(false),
m_doPoolReferencing(false),
m_ratioForcedAccept(0.),
m_lvl1Id(0),
m_lumiBlockNumber(0),
m_triggerConfigVectorLocation("storeL2Location"),
m_instance("_L2"),
m_lvlConverterStatus(HLT::OK),
m_hltStatus(HLT::OK),
m_storeGate(0),
m_triggerStore(0),
m_log(0),
m_loglvl(0),
m_navigation(0),
m_pebi(0),
m_scouting(0),
m_doOperationalInfo(0),
m_steeringOPI(0),
m_robi(0)
{}
/** @brief Destructor. */
~AlgoConfig() {}
/**
* @brief Event reset method.
* Method resetting all the relevant status variables to their default value for each processed event.
*/
void reset() {
m_hltStatus = HLT::OK;
m_lvlConverterStatus = HLT::OK;
}
/**
* @brief Getter method for the HLT level flag.
* @return HLT level flag for this algorithm.
* The HLT level flag specifies at which HLT level (LVL2 or EF) the algorithm will execute.
*/
inline HLTLevel getHLTLevel() const { return m_hltLevel; }
/**
* @brief Getter method for the instance flag.
* @return instance flag for this algorithm.
* The instance flag specifies which is the level ("_L2", "_EF" or "_UNKNOWN") of the current instance of this algorithm.
*/
inline const std::string& getInstance() const { return m_instance; }
/**
* @brief Getter method for the L1 simulation enable/disable flag.
* @return L1 simulation enable/disable flag for this algorithm.
* The L1 simulation enable/disable flag specifies whether the LVL1 simulation is going to be used by this algorithm.
*/
inline bool getUseL1Simulation() const { return m_useL1Simulation; }
/**
* @brief Getter method for the L1 calo simulation enable/disable flag.
* @return L1 calo simulation enable/disable flag for this algorithm.
* The L1 calo simulation enable/disable flag specifies whether the LVL1 calorimeter simulation is going to be used by this algorithm.
*/
inline bool getUseL1CaloSimulation() const { return m_useL1CaloSimulation; }
/**
* @brief Getter method for the L1 muon simulation enable/disable flag.
* @return L1 muon simulation enable/disable flag for this algorithm.
* The L1 muon simulation enable/disable flag specifies whether the LVL1 muon simulation is going to be used by this algorithm.
*/
inline bool getUseL1MuonSimulation() const { return m_useL1MuonSimulation; }
/**
* @brief Getter method for the timing enable/disable flag.
* @return timing enable/disable flag for this algorithm.
* The timing enable/disable flag specifies whether timing measurements are going to be performed for this algorithm.
*/
inline bool getDoTiming() const { return m_doTiming; }
/**
* @brief Getter method for the calo RoI update enable/disable flag.
* @return calo RoI update enable/disable flag for this algorithm.
* The calo RoI update enable/disable flag specifies whether this algorithm should use updated calorimeter RoI positions or not
* (needed for running on bytestream before 12.x.x).
*/
inline bool getUpdateCaloRoIs() const { return m_updateCaloRoIs; }
/**
* @brief Getter method for the Pool referencing enable/disable flag.
* @return Pool referencing enable/disable flag for this algorithm.
* The Pool referencing enable/disable flag specifies whether this algorithm should use Pool referencing or not.
*/
inline bool getDoPoolReferencing() const { return m_doPoolReferencing; }
/**
* @brief Getter method for the forced accept rate flag.
* @return forced accept rate flag for this algorithm.
* The forced accept rate specifies which is the rate of forced accepted events for this algorithm.
*/
inline float getRatioForcedAccept() const { return m_ratioForcedAccept; }
/**
* @brief Getter method for the LVL1 Id.
* @return current LVL1 Id.
*/
inline unsigned int getLvl1Id() const { return m_lvl1Id; }
/**
* @brief Getter method for the Lumi Block Number.
* @return current Lumi Block Number.
*/
inline unsigned int getLumiBlockNumber() const { return m_lumiBlockNumber; }
/**
* @brief Getter method for the L2 config vector location.
* @return L2 config vector location for this algorithm.
* The forced accept rate specifies the store location of the LVL2 config vector.
*/
inline const std::string& getTriggerConfigVectorL2Location() const { return m_triggerConfigVectorLocation; }
/**
* @brief Getter method for the pointer to the StoreGate service.
* @return pointer to the StoreGate service.
*/
inline StoreGateSvc* getStoreGate() const { return m_storeGate; }
/**
* @brief Getter method for the pointer to the TriggerStore service.
* @return pointer to the TriggerStore service.
*/
inline TriggerStore* getTriggerStore() const { return m_triggerStore; }
/**
* @brief Getter method for the pointer to the MsgStream service.
* @return pointer to the MsgStream service.
*/
inline MsgStream& getMsgStream() const { return (*m_log); }
/**
* @brief Getter method for the pointer to the MsgStream service.
* @return pointer to the MsgStream service.
*/
inline MsgStream* getMsgStreamP() const { return m_log; }
/**
* @brief Getter method for the message level flag.
* @return message level flag for this algorithm.
*/
inline unsigned int getMsgLvl() const { return m_loglvl; }
/**
* @brief Getter method for the pointer to the Navigation service.
* @return pointer to the Navigation service.
*/
inline Navigation* getNavigation() const { return m_navigation; }
/**
* @brief Getter method for the level converter status variable.
* @return level converter status variable.
*/
inline ErrorCode getLvlConverterStatus() const { return m_lvlConverterStatus; }
/**
* @brief Getter method for the HLT status variable.
* @return HLT status variable.
*/
inline ErrorCode getHltStatus() const { return m_hltStatus; }
/**
* @brief Setter method for the HLT level flag.
* The HLT level flag specifies at which HLT level (LVL2 or EF) the algorithm will execute.
*/
void setHLTLevel(HLTLevel l);
/**
* @brief Setter method for the L1 simulation enable/disable flag.
* The L1 simulation enable/disable flag specifies whether the LVL1 simulation is going to be used by this algorithm.
*/
void setUseL1Simulation(bool l1) { m_useL1Simulation = l1; }
/**
* @brief Setter method for the L1 calo simulation enable/disable flag.
* The L1 calo simulation enable/disable flag specifies whether the LVL1 calorimeter simulation is going to be used by this algorithm.
*/
void setUseL1CaloSimulation(bool l1) { m_useL1CaloSimulation = l1; }
/**
* @brief Setter method for the L1 muon simulation enable/disable flag.
* The L1 muon simulation enable/disable flag specifies whether the LVL1 muon simulation is going to be used by this algorithm.
*/
void setUseL1MuonSimulation(bool l1) { m_useL1MuonSimulation = l1; }
/**
* @brief Setter method for the timing enable/disable flag.
* The timing enable/disable flag specifies whether timing measurements are going to be performed for this algorithm.
*/
void setUseTiming(bool t) { m_doTiming = t; }
/**
* @brief Setter method for the calo RoI update enable/disable flag.
* The calo RoI update enable/disable flag specifies whether this algorithm should use updated calorimeter RoI positions or not
* (needed for running on bytestream before 12.x.x).
*/
void setUpdateCaloRoIs(bool u) { m_updateCaloRoIs = u; }
/**
* @brief Setter method for the Pool referencing enable/disable flag.
* The Pool referencing enable/disable flag specifies whether this algorithm should use Pool referencing or not.
*/
void setDoPoolReferencing(bool p) { m_doPoolReferencing = p; }
/**
* @brief Setter method for the forced accept rate flag.
* The forced accept rate specifies which is the rate of forced accepted events for this algorithm.
*/
void setRatioForcedAccept(float f) { m_ratioForcedAccept = f; }
/**
* @brief Setter method for the LVL1 Id.
*/
void setLvl1Id(unsigned int l) { m_lvl1Id = l; }
/**
* @brief Setter method for the LumiBlockNumber.
*/
void setLumiBlockNumber(unsigned int l) { m_lumiBlockNumber = l; }
/**
* @brief Setter method for the trigger config vector location.
* The trigger config vector location specifies the store location of the trigger config vector.
*/
void setTriggerConfigVectorLocation(const std::string& s) { m_triggerConfigVectorLocation = s; }
/**
* @brief Setter method for the pointer to the StoreGate service.
*/
void setStoreGate(StoreGateSvc* p) { m_storeGate = p; }
/**
* @brief Setter method for the pointer to the TriggerStore service.
*/
void setTriggerStore(TriggerStore* p) { m_triggerStore = p; }
/**
* @brief Setter method for the pointer to the MsgStream service.
*/
void setMsgStream(MsgStream* p) { m_log = p; }
/**
* @brief Setter method for the message level flag.
*/
void setMsgLvl(unsigned int i) { m_loglvl = i; }
/**
* @brief Setter method for the pointer to the Navigation service.
*/
void setNavigation(Navigation* p) { m_navigation = p; }
/**
* @brief Setter method for the level converter status variable.
*/
void setLvlConverterStatus(HLT::ErrorCode ec) { m_lvlConverterStatus = ec; }
/**
* @brief Setter method for the HLT status variable.
*/
void setHltStatus(HLT::ErrorCode ec) { m_hltStatus = ec; }
/**
* @brief accessors for PartialEventBuildingInfo object
*/
PartialEventBuildingInfo* getPEBI() const { return m_pebi; }
void setPEBI(PartialEventBuildingInfo* p) { m_pebi = p; }
/**
* @brief accessors for ScoutingInfo object
*/
ScoutingInfo* getScoutingInfo() const { return m_scouting; }
void setScoutingInfo(ScoutingInfo* sI) { m_scouting = sI; }
/**
* @brief accessors for OPI verbosity level
*/
void setSteeringOPILevel(unsigned int i) { m_doOperationalInfo = i; }
inline unsigned int getSteeringOPILevel() const { return m_doOperationalInfo; }
/**
* @brief accessors for currently filled by steering OPI object
*/
inline TrigOperationalInfo* getSteeringOPI() const { return m_steeringOPI; }
inline void setSteeringOPI( TrigOperationalInfo* opi ) { m_steeringOPI = opi; }
RobRequestInfo* robRequestInfo() const { return m_robi; }
void setRobRequestInfo(RobRequestInfo* robi) { m_robi = robi; }
private:
/** @brief HLT level flag. */
HLTLevel m_hltLevel;
/** @brief L1 simulation enable/disable flag. */
bool m_useL1Simulation;
/** @brief L1 calo simulation enable/disable flag. */
bool m_useL1CaloSimulation;
/** @brief L1 muon simulation enable/disable flag. */
bool m_useL1MuonSimulation;
/** @brief Timing enable/disable flag. */
bool m_doTiming;
/** @brief Calo RoI update enable/disable flag. */
bool m_updateCaloRoIs;
/** @brief Pool referencing enable/disable flag. */
bool m_doPoolReferencing;
/** @brief Forced accept rate flag. */
float m_ratioForcedAccept;
/** @brief LVL1 Id. */
unsigned int m_lvl1Id;
/** @brief Lumi Block Number */
unsigned int m_lumiBlockNumber;
/** @brief Getter method for the L2 config vector location. */
std::string m_triggerConfigVectorLocation;
/** @brief Getter method for the instance flag. */
std::string m_instance;
/** @brief Getter method for the level converter status variable. */
ErrorCode m_lvlConverterStatus;
/** @brief Getter method for the HLT status variable. */
ErrorCode m_hltStatus;
/** @brief Pointer to the StoreGate service. */
StoreGateSvc* m_storeGate;
/** @brief Pointer to the TriggerStore service. */
TriggerStore* m_triggerStore;
/** @brief Pointer to the MsgStream service. */
MsgStream* m_log;
/** @brief Message level flag. */
unsigned int m_loglvl;
/** @brief Pointer to the Navigation service. */
Navigation* m_navigation;
/** @brief pointer to partial event building info */
PartialEventBuildingInfo* m_pebi;
/** @brief pointer to scouting info */
ScoutingInfo* m_scouting;
/** @brief flag to collect operational information
* 0 - none
* 1... - more
*/
unsigned int m_doOperationalInfo;
TrigOperationalInfo* m_steeringOPI;
/** @brief pointer to partial event building info */
RobRequestInfo* m_robi;
};
/**
* @brief Setter method for the HLT level flag.
* The HLT level flag specifies at which HLT level (LVL2 or EF) the algorithm will execute.
*/
inline void AlgoConfig::setHLTLevel(HLTLevel l) {
m_hltLevel = l;
if(l == HLT::L2) m_instance = "_L2";
else if (l == HLT::EF) m_instance = "_EF";
else if (l == HLT::HLT) m_instance = "_HLT";
else m_instance = "_UNKNOWN";
}
} // end of namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGINTERFACES_AllTEAlgo_H
#define TRIGINTERFACES_AllTEAlgo_H
#include "TrigInterfaces/TECreateAlgo.h"
class TrigRoiDescriptor;
class TrigSuperRoi;
namespace HLT
{
/**
* @brief Base class for algorithms processing arbitrary lists of TEs (AllTE).
*
* @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN
* @author Till Eifert <Till.Eifert@cern.ch> - U. of Geneva, Switzerland
*
* This is the class from which developers should inherit their implementation of an AllTE algorithm.
*
* The main characteristics of an AllTE algorithm are:
* - receives N input TE types, producing output TEs of a single type;
* - receives as input all TE instances of each requested input type;
* - runs once per event, independently on the number of RoIs; can be unseeded;
* - the developer is responsible for the creation of output TEs.
*
* The AllTE algorithm developer must re-implement the following three methods:
* - hltInitialize(); this method must contain the code to be executed during the initialization phase,
* before starting a new run; example: memory allocation for static objects;
* - hltExecute(); this method must contain the code to be executed for each event; this is the core part
* of the algorithm, taking care of reconstructing the relevant quantities, creating the output TEs with
* attached the reconstructed features;
* - hltFinalize(); this method must contain the code to be executed during the finalization phase,
* after the run has been stopped; example: freeing the memory allocated to static objects during the
* initialization.
*
* Some general implementation guidelines that developers should follow, e.g. regarding features handling
* or RoIDescriptors usage, can be found in HLT::FexAlgo class documentation.
*
* \par Specific guidelines for AllTE algorithms developers
*
* In order to decouple algorithm development from the implementation details for the Navigation service,
* the developers should use the protected addRoI() methods to create the output TEs (to which an RoI will
* be associated).
*/
class AllTEAlgo : public TECreateAlgo {
public:
/**
* @brief Constructor; gets the algorithm name and service locator as arguments.
*/
AllTEAlgo(const std::string& name, ISvcLocator* pSvcLocator);
/**
* @brief Destructor.
*/
~AllTEAlgo() { }
/**
* @brief Method implementing the algorithmic code, executed for each event.
* @return HLT::ErrorCode for the execution of the algorithm.
* @param inputs vector of input TEs containing all the TEs of all the types on which the algorithm
* has to be executed;
* @param output type of the output TEs.
*
* This is the core method of a Combo algorithm, where developers must put all the algorithmic
* intelligence needed to reconstruct features starting from the information retrieved from the input
* TEs and to create the corresponding output TEs.
*/
virtual HLT::ErrorCode hltExecute(std::vector<TEVec>& inputs,
unsigned int output) = 0;
/**
* @brief Method to register ROB requests. Should be overridden by algorithms.
*/
virtual HLT::ErrorCode prepareRobRequests(const std::vector<HLT::TEConstVec>& inputs );
protected:
/**
* @brief Method enabling to add a new TE corresponding to a given RoIDescriptor.
* @return pointer to the newly added TriggerElement.
* @param type type of the TE to be added;
* @param roiDescriptor pointer to the RoI descriptor to be attached to the TE; null pointer by default.
*
* This method is specific to AllTE algorithms and enables to create a new TE node and attach an RoI to
* it, given its RoI descriptor.
*/
TriggerElement* addRoI(unsigned int type, const TrigRoiDescriptor* roiDescriptor = 0);
// TriggerElement* addRoI(unsigned int type, const TrigSuperRoi* roiDescriptor ); // no longer needed
/**
* @brief Method enabling to add a new TE corresponding to a given RoI direction.
* @return pointer to the newly added TriggerElement.
* @param type type of the TE to be added;
* @param eta eta direction of the RoI to be attached to the TE;
* @param phi phi direction of the RoI to be attached to the TE.
*
* This method is specific to AllTE algorithms and enables to create a new TE node and attach an RoI to
* it, given its eta/phi direction.
* NB: OBSOLETE - DO NOT USE
*/
// TriggerElement* addRoI(unsigned int type, double eta, double phi);
/**
* @brief Common method to register ROB requests to be called by the steering.
*/
virtual HLT::ErrorCode processRobRequests(const std::vector< unsigned int >& inputs );
private:
/**
* @brief Method implementing creation and processing of the output TEs.
* @return HLT::ErrorCode for TE creation and processing.
* @param inputs vector of input TE types.
* @param output TE type.
* @param outputTEs vector of newly created output TE pointers.
*
* This method performs the creation of output TEs and the processing of all the input TEs. In this case, this
* means: retrieving all the TEs of all the input types; call the user-implemented hltExecute method, which
* will do the input processing and output creation; retrieve and return the output TEs created during the
* execution.
*/
virtual HLT::ErrorCode createAndProcessTEs(std::vector<unsigned int>& inputs,
unsigned int outputType,
TEVec& outputTEs,
const std::vector<unsigned int>& topologicalStartFrom);
/**
* @brief Method implementing the processing of an output TE.
* @return HLT::ErrorCode for TE processing.
* @param inputTEs vector of input TEs.
* @param outputTE output TE pointer.
*
* This method performs the processing of a input/output TEs set. This method will never be called, since AllTE
* algorithms have the responsibility to create their output TEs on their own (see the plugin_createAndProcessTEs()
* method).
*/
virtual HLT::ErrorCode plugin_processTE(TEConstVec& inputTEs, TriggerElement* outputTE);
bool m_provideInactiveTEs;
};
} // end namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**********************************************************************************
* @Project: HLT Steering
* @Package: TrigInterface
* @Class : ComboAlgo
*
* @brief base class for FexAlgo, HypoAlgo ... used by PESA HLT Algorithms
*
* @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN
* @author Till Eifert <Till.Eifert@cern.ch> - U. of Geneva, Switzerland
*
* File and Version Information:
* $Id: ComboAlgo.h,v 1.11 2008-03-20 10:30:56 tbold Exp $
**********************************************************************************/
#ifndef TRIGINTERFACES_ComboAlgo_H
#define TRIGINTERFACES_ComboAlgo_H
#include "TrigInterfaces/TECombineAlgo.h"
namespace HLT
{
class ComboIteratorBase;
/**
* @brief Base class for algorithms combining together more TEs (Combo).
*
* @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN
* @author Till Eifert <Till.Eifert@cern.ch> - U. of Geneva, Switzerland
*
* This is the class from which developers should inherit their implementation of a TE-combining algorithm.
*
* The main characteristics of a Combo algorithm are:
* - receives N input TE types, producing output TEs of a single type;
* - performs all the combinatorial groupings of input TEs;
* - is executed once on each combination of input TEs;
* - an output TE is created for each validated combination.
*
* The Combo algorithm developer must re-implement the following three methods:
* - hltInitialize(); this method must contain the code to be executed during the initialization phase,
* before starting a new run; example: memory allocation for static objects;
* - hltExecute(); this method must contain the code to be executed on each combination of input TEs passed
* to the algorithm; this is the core part of the algorithm, taking care of reconstructing the relevant
* quantities and attaching reconstructed features to the corresponding output TE;
* - hltFinalize(); this method must contain the code to be executed during the finalization phase,
* after the run has been stopped; example: freeing the memory allocated to static objects during the
* initialization.
*
* Some general implementation guidelines that developers should follow, e.g. regarding features handling
* or RoIDescriptors usage, can be found in HLT::FexAlgo class documentation.
*
* \par Specific guidelines for Combo algorithms developers
*
* To avoid processing all the possible combinations of input TEs, a preliminary selection can be performed.
* This is achieved, in Combo algorithms, by implementing the member method acceptInputs(). The steering will
* create an output TE only for those combination of input TEs that passed this selection. Please note that
* the acceptInputs() method is seen only for the first Combo algo in a sequence.
*/
class ComboAlgo : public TECombineAlgo {
public: