Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
atlas
athena
Commits
20e1c446
Commit
20e1c446
authored
Sep 05, 2014
by
Michael Christian Rammensee
Committed by
Graeme Stewart
Sep 19, 2014
Browse files
fix for (ATR-8907) (TrigPSC-20-04-08)
parent
e7c117ca
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Config.h
0 → 100644
View file @
20e1c446
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file Config.h
* @author Frank Winklmeier, Ricardo Abreu
*
* @brief PSC Configuration type
*/
#ifndef TRIGPSC_CONFIG_H
#define TRIGPSC_CONFIG_H
#include
<map>
#include
<string>
#include
<vector>
#include
<sstream>
#include
<boost/property_tree/ptree.hpp>
namespace
TrigConf
{
class
TrigDBConnectionConfig
;
}
namespace
psc
{
/**
* PSC configuration object
*/
class
Config
{
public:
Config
(
const
boost
::
property_tree
::
ptree
&
config
);
void
updateUnique
();
/**
* Returns a string with all options which are held in the options cache
*/
std
::
string
dumpOptions
()
const
;
/**
* Gets an option in a "safer" way
*/
std
::
string
getOption
(
const
std
::
string
&
key
)
const
;
/**
* Incredibly simple minded way to access this object from python.
* Create a python dictionary with key/value pairs.
*/
std
::
string
toPython
(
const
std
::
string
&
dictName
)
const
;
// TODO: [2ndpass] remove this
unsigned
int
nworker
()
const
{
return
m_nworker
;
}
public:
/**
* Map with name/value pairs of parameters
*/
std
::
map
<
std
::
string
,
std
::
string
>
optmap
;
/**
* Lists of statically enabled/disabled ROBs and detectors
*/
std
::
vector
<
uint32_t
>
enabled_robs
;
private:
// setup needed optmap defaults for options that may not always be filled
void
setup_optmap_defaults
();
// fill in options for HLTImplementationJobOptions
void
fillopt_jo
(
const
boost
::
property_tree
::
ptree
&
hlt
);
// fill in options for HLTImplementationDB
void
fillopt_db
(
const
boost
::
property_tree
::
ptree
&
hlt
);
// fill in options for HLTImplementationDBPython
void
fillopt_dbpy
(
const
boost
::
property_tree
::
ptree
&
hlt
);
// fill in what is common to jo and dbpy
void
fillopt_py
(
const
boost
::
property_tree
::
ptree
&
hlt
);
// fill in common options
void
fillopt_common
(
const
boost
::
property_tree
::
ptree
&
hlt
);
// fill in athenaHLT specific options
void
fillopt_athenaHLT
();
// sets fields with info on this process
void
setPInfo
();
// fill the vector of enabled sub-detectors and the vectors of MET ROBs for
// LAr and Tile
void
fill_enabled_robs
(
const
boost
::
property_tree
::
ptree
&
ros2robs
);
// fill in the TrigDBConnectionConfig appropriately
void
fill_dbCon
(
const
boost
::
property_tree
::
ptree
&
hlt
,
TrigConf
::
TrigDBConnectionConfig
&
dbcon
);
void
updatePids
();
void
updateSeed
();
private:
// TODO: [2ndpass] remove this
unsigned
int
m_nworker
;
const
boost
::
property_tree
::
ptree
&
m_config
;
};
}
#endif
/* TRIGPSC_CONFIG_H */
HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Psc.h
0 → 100644
View file @
20e1c446
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file Psc.h
* @author Frank Winklmeier, Ricardo Abreu
*
* @brief HLT Pesa Steering Controller.
*
*/
#ifndef TRIGPSC_PSC_H
#define TRIGPSC_PSC_H
// Package includes
#include
"hltinterface/HLTInterface.h"
#include
"hltinterface/EventId.h"
// TDAQ includes
#include
"threads/ThreadData.h"
// Gaudi Includes
#include
"GaudiKernel/IEventProcessor.h"
// STL includes
#include
<map>
#include
<string>
#include
<vector>
// Boost includes
#include
<boost/function.hpp>
#include
<boost/property_tree/ptree.hpp>
class
IAppMgrUI
;
class
ITrigEventLoopMgr
;
namespace
psc
{
// Fwd decl
class
Config
;
/**
* Common base class for HLT Pesa Steering Controller.
*/
class
Psc
:
public
hltinterface
::
HLTInterface
{
public:
/**
* C'tor. (Nothing happens here...)
*/
Psc
()
;
/**
* D'tor virtualisation
*/
virtual
~
Psc
()
;
/**
* Configures the framework
*/
virtual
bool
configure
(
const
boost
::
property_tree
::
ptree
&
config
);
/**
* Connects the framework
*/
virtual
bool
connect
(
const
boost
::
property_tree
::
ptree
&
args
);
/**
* prepares the HLT framework for a run
*/
virtual
bool
prepareForRun
(
const
boost
::
property_tree
::
ptree
&
args
);
/**
* stops the HLT framework without re-configuring
*/
virtual
bool
stopRun
(
const
boost
::
property_tree
::
ptree
&
args
);
/**
* Disconnects the framework
*/
virtual
bool
disconnect
(
const
boost
::
property_tree
::
ptree
&
args
);
/**
* Unconfigures the framework, releasing all acquired resources.
*/
virtual
bool
unconfigure
(
const
boost
::
property_tree
::
ptree
&
args
);
/**
* Calls the HLT framework to publish statistics, after the run has
* finished.
*/
virtual
bool
publishStatistics
(
const
boost
::
property_tree
::
ptree
&
args
);
/**
* Calls the HLT framework to notify it that a time out is imminent
*/
virtual
void
timeOutReached
(
const
boost
::
property_tree
::
ptree
&
args
);
/**
* Calls the HLT framework to notify it that a user command has arrived
*/
virtual
bool
hltUserCommand
(
const
boost
::
property_tree
::
ptree
&
args
);
/**
* Process one event, taking as input, the LVL1 Result and producing as
* output, the HLT Result.
*
* @param l1r. LVL1 result ROBs (input)
* @param hltr. HLT result (output)
* @param evId. EventId structure containing global event number l1id and lb
* number (input)
*/
virtual
bool
process
(
const
std
::
vector
<
eformat
::
ROBFragment
<
const
uint32_t
*>>&
l1r
,
hltinterface
::
HLTResult
&
hltr
,
const
hltinterface
::
EventId
&
evId
);
/**
* Method which can be called for a worker to perform the necessary steps to set
* unique worker IDs and adapt histogram paths
*/
virtual
bool
prepareWorker
(
const
boost
::
property_tree
::
ptree
&
args
);
/**
* Method which can be called for a worker to perform a cleanup before the
* worker gets killed
*/
virtual
bool
finalizeWorker
(
const
boost
::
property_tree
::
ptree
&
args
);
private:
bool
setDFProperties
(
std
::
map
<
std
::
string
,
std
::
string
>
name_tr_table
);
/**
* Return pointer to (thread-specific) event processor
*/
virtual
IEventProcessor
*
eventProcessor
();
/**
* Returns the thread ID suffix
*
* @return Thread ID suffix (empty string if nworker = 0)
*/
std
::
string
getThreadSuffix
(
int
id
);
/**
* Call the given function for each EventLoopMgr
*
* @return The "AND" of all StatusCodes
*/
template
<
class
T
>
StatusCode
foreachEventLoopMgr
(
boost
::
function
<
StatusCode
(
T
*
)
>
func
,
const
std
::
string
&
msg
);
/**
* Initialize the application manager
*/
bool
doAppMgrInit
();
private:
uint32_t
m_run_number
;
///< (initial) run number to be used for this run
IAppMgrUI
*
m_pesaAppMgr
;
///< Application Manager
std
::
string
m_nameEventLoopMgr
;
///< name of the event loop manager
bool
m_interactive
;
///< Running in interactive mode (athenaMT/PT)
// for handling thread specific data
ThreadDataPtr
<
IEventProcessor
>
m_eventProcessor
;
std
::
map
<
unsigned
int
,
IEventProcessor
*>
m_availableEventProcessors
;
// User command handling
bool
m_failNextUsrCmd
;
unsigned
int
m_sleepNextUsrCmd
;
psc
::
Config
*
m_config
;
};
}
#endif
/* TRIGPSC_PSC_H */
HLT/Trigger/TrigControl/TrigPSC/TrigPSC/PscIssues.h
0 → 100644
View file @
20e1c446
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file PscIssues.h
* @author Frank Winklmeier, Ricardo Abreu
*
* @brief ERS Issues for PSC
*/
#ifndef PSC_ISSUES_H
#define PSC_ISSUES_H
#include
"ers/ers.h"
#include
<string>
// The base PSC Issue
ERS_DECLARE_ISSUE
(
psc
,
Issue
,
ERS_EMPTY
,
ERS_EMPTY
)
// A configuration issue in the PSC
ERS_DECLARE_ISSUE_BASE
(
psc
,
ConfigurationIssue
,
psc
::
Issue
,
"Configuration Issue: "
<<
reason
,
ERS_EMPTY
,
((
const
char
*
)
reason
)
)
// TODO - check whether we need to keep the stuff below
// Declare a PSC Message Issue
ERS_DECLARE_ISSUE
(
ers
,
PSCMessage
,
ERS_EMPTY
,
ERS_EMPTY
)
#define ERS_PSC_WARNING( message ) \
{ \
ERS_REPORT_IMPL( ers::warning, ers::PSCMessage, message, ); \
}
#define ERS_PSC_ERROR( message ) \
{ \
ERS_REPORT_IMPL( ers::error, ers::PSCMessage, message, ); \
}
#define ERS_PSC_FATAL( message ) \
{ \
ERS_REPORT_IMPL( ers::fatal, ers::PSCMessage, message, ); \
}
#endif
/* PSC_ISSUES_H */
HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Utils.h
0 → 100644
View file @
20e1c446
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file Utils.h
* @author Frank Winklmeier
* $Author: ricab $
* $Revision: 11 $
* $Date: 2013-05-14 17:22:39 +0200 (Tue, 14 May 2013) $
*
* @brief Some helpers for the PSC
*/
#ifndef PSC_UTILS_H
#define PSC_UTILS_H
#include
<vector>
#include
<string>
#include
<sys/time.h>
namespace
psc
{
namespace
Utils
{
/**
* @brief Execute a python command in the python interpreter
* @param pyCmd python statement
* @return Success/Failure
*/
bool
execPython
(
const
std
::
string
&
pyCmd
);
/**
* @brief Execute a set of python commands in the python interpreter
* @param pyCmds vector of python statements
* @return Success/Failure
*/
bool
execPython
(
const
std
::
vector
<
std
::
string
>
pyCmds
);
/**
* @brief Include a python file via AthenaCommon.Include
* @param pyFileName File name
* @param showIncludes Trace included files
* @return Success/Failure
*/
bool
pyInclude
(
const
std
::
string
&
pyFileName
);
/**
* @brief Very simple timer class
*
* Time between constructor and destructor call is measured and printed
*/
class
ScopeTimer
{
public:
/**
* Create timer and start timing
*/
ScopeTimer
(
const
std
::
string
&
descr
=
"Timer"
);
/**
* Stop timer (if still running)
*/
~
ScopeTimer
()
{
if
(
m_running
)
stop
();
}
/**
* Stop timer manually
*/
void
stop
();
private:
std
::
string
m_descr
;
///< description of timer
struct
timeval
m_t1
;
///< start time
bool
m_running
;
///< timer running?
};
}
/* namespace Utils */
}
/* namespace psc */
#endif
/* PSC_UTILS_H */
HLT/Trigger/TrigControl/TrigPSC/TrigPSC/factory.h
0 → 100644
View file @
20e1c446
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/*
* factory.h
*
* Created on: Apr 29, 2013
* Author: ricab
*/
#ifndef FACTORY_H_
#define FACTORY_H_
#include
"hltinterface/HLTInterface.h"
extern
"C"
{
hltinterface
::
HLTInterface
*
hlt_factory
();
}
#endif
/* FACTORY_H_ */
HLT/Trigger/TrigControl/TrigPSC/cmt/requirements
0 → 100644
View file @
20e1c446
package
TrigPSC
author
Frank
Winklmeier
<
frank
.
winklmeier
@
cern
.
ch
>
author
Ricardo
Abreu
<
Ricardo
.
Abreu
@
cern
.
ch
>
public
use
AtlasPolicy
AtlasPolicy
-*
use
AtlasBoost
AtlasBoost
-*
External
use
DataCollection
DataCollection
-*
External
use
GaudiInterface
GaudiInterface
-*
External
use
HLTtdaqcommon
HLTtdaqcommon
-*
HLT
/
HLTExternal
use
HLTtdaq
HLTtdaq
-*
HLT
/
HLTExternal
library
TrigPSC
*.
cxx
apply_pattern
linked_library
apply_pattern
declare_joboptions
files
=
"*.py"
apply_pattern
declare_python_modules
files
=
"*.py"
private
use
AtlasPython
AtlasPython
-*
External
use
PathResolver
PathResolver
-*
Tools
use
TrigKernel
TrigKernel
-*
HLT
/
Trigger
/
TrigControl
use
TrigConfBase
TrigConfBase
-*
Trigger
/
TrigConfiguration
#
use
IOVDbSvc
IOVDbSvc
-*
Database
use
AtlasCORAL
AtlasCORAL
-*
External
#
use
online
libraries
macro_append
TrigPSC_linkopts
" -lers -leformat -leformat_write -lhltinterface "
HLT/Trigger/TrigControl/TrigPSC/python/PscConfig.py
0 → 100644
View file @
20e1c446
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
## @file PscConfig.py
## @brief Python flags that are used to configure C++ Psc
## @author Frank Winklmeier
##
## This module is loaded in Psc.cxx and flags are set in TrigPSCPython*Setup.py
## Add flags here that are used to configure the C++ instance
## In interactive mode, call AppMgr::initialize() in connect instead of configure
interactive
=
False
## string:string map equivalent to TrigPsc/Config.h (filled in TrigPsc.cxx)
optmap
=
{}
HLT/Trigger/TrigControl/TrigPSC/python/__init__.py
0 → 100644
View file @
20e1c446
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# File: TrigPSC/python/__init__.py
HLT/Trigger/TrigControl/TrigPSC/share/TrigHLTImplementationDBPythonSwitchToDebug.py
0 → 100644
View file @
20e1c446
#
# Switch Output Level to DEBUG when using HLTImplementationDBPython in OKS
#
from
AthenaCommon.Include
import
include
from
AthenaCommon.Constants
import
*
from
TrigPSC
import
PscConfig
from
TrigServices.TriggerUnixStandardSetup
import
_Conf
_Conf
.
useOnlineTHistSvc
=
True
PscConfig
.
optmap
[
'LOGLEVEL'
]
=
'DEBUG'
include
(
'TrigPSC/TrigPSCPythonDbSetup.py'
)
HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonDbSetup.py
0 → 100644
View file @
20e1c446
###############################################################
## @file TrigPSCPythonDbSetup.py
## @brief Minimal Python setup for running from TrigDB
## @author Frank Winklmeier
## $Id: TrigPSCPythonDbSetup.py 11 2013-05-14 15:22:39Z ricab $
###############################################################
## This is a very minimal Python setup. It is only included when
## the POSTCOMMAND is non-empty while running from the DB.
## Besides providing basic python bindings it also takes care of
## switching the OutputLevel in case the "-l" option was used.
## !!! Do NOT import theApp. It will screw up the configuration !!!
import
string
,
os
,
sys
def
setTHistSvcOutput
():
"""Helper to set THistSvc.Output"""
## Do this only in a function to not pollute the global namespace
from
TriggerJobOpts.HLTTriggerGetter
import
setTHistSvcOutput
output
=
[]
setTHistSvcOutput
(
output
)
setattr
(
iProperty
(
"THistSvc"
),
"Output"
,
output
)
return
### logging and messages -----------------------------------------------------
from
AthenaCommon.Logging
import
*
from
AthenaCommon.Constants
import
*
import
AthenaCommon.ExitCodes
as
ExitCodes
from
TrigPSC
import
PscConfig
logLevel
=
string
.
upper
(
PscConfig
.
optmap
[
'LOGLEVEL'
])
logLevel
=
string
.
split
(
logLevel
,
","
)
if
len
(
logLevel
)
==
0
:
logLevel
=
[
"INFO"
,
"ERROR"
]
if
len
(
logLevel
)
==
1
:
logLevel
.
append
(
"ERROR"
)
## test and set log level
try
:
exec
(
'log.setLevel( logging.%s )'
%
logLevel
[
0
]
)
except
:
sys
.
exit
(
ExitCodes
.
OPTIONS_UNKNOWN
)
if
not
os
.
environ
.
has_key
(
"POOL_OUTMSG_LEVEL"
):
exec
'os.environ[ "POOL_OUTMSG_LEVEL" ] = str(%s)'
%
logLevel
[
1
]
## Minimal Python bindings
from
GaudiPython
import
*
from
GaudiPython.Bindings
import
iProperty
import
PyCintex
from
TrigCommon.TrigPyHelper
import
trigApp
## Set OutputLevel in JobOptionsSvc if "-l" option was used in athenaMT/PT
if
logLevel
[
0
]
!=
"INFO"
:
outputLevel
=
int
(
locals
()[
logLevel
[
0
]])
outputLevelProp
=
gbl
.
IntegerProperty
(
"OutputLevel"
,
outputLevel
)
## Reset message levels
trigApp
.
service
(
"MessageSvc"
,
gbl
.
ITrigMessageSvc
).
resetOutputLevels
()
trigApp
.
service
(
"MessageSvc"
,
gbl
.
IMessageSvc
).
setOutputLevel
(
outputLevel
)
jobOptSvc
=
trigApp
.
service
(
"JobOptionsSvc"
,
gbl
.
IJobOptionsSvc
)
## Set OutputLevel in JobOptionsSvc
for
client
in
jobOptSvc
.
getClients
():
for
prop
in
jobOptSvc
.
getProperties
(
client
):
if
prop
.
name
()
==
"OutputLevel"
:
iProperty
(
client
).
OutputLevel
=
outputLevel
## For running with offline THistSvc from online DB
from
TrigServices.TriggerUnixStandardSetup
import
_Conf
if
not
_Conf
.
useOnlineTHistSvc
:
isvcMgr
=
InterfaceCast
(
gbl
.
ISvcManager
)(
gbl
.
Gaudi
.
svcLocator
())
## Change service type from TrigMonTHistSvc to THistSvc
isvcMgr
.
declareSvcType
(
"THistSvc"
,
"THistSvc"
)
setTHistSvcOutput
()
if
'interactive'
in
dir
():
PscConfig
.
interactive
=
bool
(
interactive
)
del
interactive
## Some cleanup
del
_Conf
del
logLevel
HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonSetup.py
0 → 100755
View file @
20e1c446