Skip to content
Snippets Groups Projects
Commit 282d6a05 authored by Peter Onyisi's avatar Peter Onyisi Committed by Vakhtang Tsulaia
Browse files

Move DQ filters to new conditions infrastructure

parent af47a2d3
No related branches found
No related tags found
No related merge requests found
Showing
with 228 additions and 141 deletions
......@@ -13,7 +13,7 @@ if not 'rec' in dir():
from RecExConfig.RecFlags import rec
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool
......@@ -45,7 +45,7 @@ CaloBaseline = CaloBaselineMon(
BadLBTool = GetLArBadLBFilterTool(),
BunchCrossingTool=BunchCrossingTool(),
useReadyFilterTool = tmp_CaloBaselineMon["useReadyFilterTool"],
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useLArCollisionFilterTool = tmp_CaloBaselineMon["useLArCollisionFilter"],
useLArNoisyAlg = tmp_CaloBaselineMon["useLArNoisyAlg"],
useBeamBackgroundRemoval = tmp_CaloBaselineMon["useBeamBackgroundRemoval"],
......
......@@ -14,7 +14,7 @@ from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault
theCaloNoiseTool=CaloNoiseToolDefault()
......@@ -48,7 +48,7 @@ LArCellMon = LArCellMonTool(
BadLBTool = GetLArBadLBFilterTool(),
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useElectronicNoiseOnly = False,
#useTwoGaus = True, Tile-only
......@@ -164,7 +164,9 @@ LArCellMon = LArCellMonTool(
#Tile monitoring:
from CaloMonitoring.CaloMonitoringConf import TileCalCellMonTool
TileCalCellMon=TileCalCellMonTool("TileCalCellMon",
CaloNoiseTool=theCaloNoiseTool
CaloNoiseTool=theCaloNoiseTool,
BadLBTool = GetLArBadLBFilterTool(),
ReadyFilterTool = GetAtlasReadyFilterTool(),
)
......
......@@ -14,6 +14,7 @@ from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault
theCaloNoiseTool=CaloNoiseToolDefault()
......@@ -38,7 +39,7 @@ LArCellMon = LArCellMonTool(
BadLBTool = GetLArBadLBFilterTool(),
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useElectronicNoiseOnly = False,
#useTwoGaus = True, Tile-only
......
......@@ -19,7 +19,7 @@ from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
if DQMonFlags.monManEnvironment() == 'online':
tmp_timeGran = "run"
......@@ -64,7 +64,7 @@ CaloClusterMonNoTA = CaloClusterVecMon(
BadLBTool = GetLArBadLBFilterTool(),
useReadyFilterTool = tmp_useReadyFilterTool,
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useLArNoisyAlg = tmp_useLArNoisyAlg,
useBeamBackgroundRemoval = tmp_useBeamBackgroundRemoval,
......
......@@ -20,7 +20,7 @@ from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
if DQMonFlags.monManEnvironment() == 'online':
tmp_timeGran = "run"
......@@ -65,7 +65,7 @@ CaloClustMonCosmicsNoTA = CaloClusterVecMon(
BadLBTool = GetLArBadLBFilterTool(),
useReadyFilterTool = tmp_useReadyFilterTool,
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useLArNoisyAlg = tmp_useLArNoisyAlg,
......
......@@ -8,7 +8,7 @@ from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
if DQMonFlags.monManEnvironment() == 'online':
tmp_timeGran = "run"
......@@ -46,7 +46,7 @@ CaloTowerMonNoTA = CaloTowerVecMon(
BadLBTool = GetLArBadLBFilterTool(),
useReadyFilterTool = tmp_useReadyFilterTool,
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useLArNoisyAlg = tmp_useLArNoisyAlg,
......
......@@ -7,7 +7,7 @@ from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
if DQMonFlags.monManEnvironment() == 'online':
tmp_timeGran = "run"
......@@ -45,7 +45,7 @@ CaloTowerMonCosmicsNoTA = CaloTowerVecMon(
BadLBTool = GetLArBadLBFilterTool(),
useReadyFilterTool = tmp_useReadyFilterTool,
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useLArNoisyAlg = tmp_useLArNoisyAlg,
......
......@@ -21,7 +21,7 @@ from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
#if DQMonFlags.monManEnvironment() == 'online':
# tmp_CaloClusterContainer = "EMTopoCluster430"
......@@ -71,7 +71,7 @@ EMCaloClusterMonNoTA = CaloClusterVecMon(
BadLBTool = GetLArBadLBFilterTool(),
useReadyFilterTool = tmp_useReadyFilterTool,
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useLArNoisyAlg = tmp_useLArNoisyAlg,
......
......@@ -21,7 +21,7 @@ from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
#if DQMonFlags.monManEnvironment() == 'online':
# tmp_CaloClusterContainer = "EMTopoCluster430"
......@@ -71,7 +71,7 @@ EMCaloClusterMonCosmicsNoTA = CaloClusterVecMon(
BadLBTool = GetLArBadLBFilterTool(),
useReadyFilterTool = tmp_useReadyFilterTool,
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useLArNoisyAlg = tmp_useLArNoisyAlg,
......
......@@ -12,7 +12,7 @@ from AthenaCommon.GlobalFlags import globalflags
from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
include ("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
if (DQMonFlags.monManEnvironment == 'online' or globalflags.DataSource.get_Value() == 'geant4' or globalflags.DataSource.get_Value() == 'geant3'):
tmp_useBadLBTool=FALSE
......@@ -51,7 +51,7 @@ LArCosmicsClusterMon = CaloClusterVecMon(
BadLBTool = GetLArBadLBFilterTool(),
useReadyFilterTool = tmp_useReadyFilterTool,
ReadyFilterTool = monAtlasReadyFilterTool,
ReadyFilterTool = GetAtlasReadyFilterTool(),
useLArNoisyAlg = tmp_useLArNoisyAlg,
......
......@@ -13,8 +13,8 @@ CaloMonToolBase::CaloMonToolBase(const std::string& type, const std::string& nam
m_lb(0),
m_passBeamBackgroundRemoval(false),
m_h_EvtRejSumm(nullptr),
m_BadLBTool("DQBadLBFilterTool"),
m_ReadyFilterTool("DQAtlasReadyFilterTool")
m_BadLBTool(this, "DQBadLBFilterTool"),
m_ReadyFilterTool(this, "DQAtlasReadyFilterTool")
{
declareProperty("useBadLBTool", m_useBadLBTool=false);
declareProperty("BadLBTool", m_BadLBTool);
......
......@@ -8,6 +8,8 @@
#include "AthenaMonitoring/IDQFilterTool.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/StatusCode.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
// This filter tool rejects events where the ATLAS READY flag is not set
// @author Peter Onyisi <ponyisi@cern.ch>
......@@ -22,14 +24,11 @@ class DQAtlasReadyFilterTool : public AthAlgTool, virtual public IDQFilterTool
virtual bool accept() const override;
virtual StatusCode updateCache();
StatusCode callback( IOVSVC_CALLBACK_ARGS );
private:
bool m_fallbackValue;
bool m_alwaysReturnTrue;
bool m_valueCache;
SG::ReadCondHandleKey<AthenaAttributeList> m_key;
};
#endif //DQATLASREADYFILTERTOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef DQBadLBFILTERALG_H
#define DQBadLBFILTERALG_H
#include "AthenaBaseComps/AthAlgorithm.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "AthenaPoolUtilities/AthenaAttributeList.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "CoralBase/AttributeListSpecification.h"
#include "GaudiKernel/ICondSvc.h"
#include <string>
#include <vector>
// This filter tool rejects events where the a bad LB block is flagged from a given defect
// @author Michele Petteni <mpetteni@sfu.ca>
class DQBadLBFilterAlg : public AthAlgorithm {
public:
DQBadLBFilterAlg(const std::string&, ISvcLocator*);
virtual ~DQBadLBFilterAlg () override;
virtual StatusCode initialize() override;
virtual StatusCode execute() override;
private:
bool m_fallbackValue;
bool m_ignoreRecoverable;
bool m_alwaysReturnTrue;
std::vector<int> m_listofdefects;
std::vector<std::string> m_listofdefects_str;
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey;
SG::WriteCondHandleKey<AthenaAttributeList> m_writeKey;
ServiceHandle<ICondSvc> m_condSvc;
coral::AttributeListSpecification* m_attribListSpec;
};
#endif //DQATLASREADYFILTERALG_H
......@@ -8,6 +8,8 @@
#include "AthenaMonitoring/IDQFilterTool.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/StatusCode.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "AthenaPoolUtilities/AthenaAttributeList.h"
#include <string>
#include <vector>
......@@ -25,17 +27,10 @@ class DQBadLBFilterTool : public AthAlgTool, virtual public IDQFilterTool {
virtual bool accept() const override;
virtual StatusCode updateCache();
StatusCode callback( IOVSVC_CALLBACK_ARGS );
private:
bool m_fallbackValue;
bool m_ignoreRecoverable;
bool m_alwaysReturnTrue;
bool m_valueCache;
std::vector<int> m_listofdefects;
std::vector<std::string> m_listofdefects_str;
SG::ReadCondHandleKey<AthenaAttributeList> m_key;
};
#endif //DQATLASREADYFILTERTOOL_H
include.block('AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py')
# Set up the ATLAS Ready filter tool
from AthenaCommon.Logging import logging
arft_local_logger = logging.getLogger('AtlasReadyFilterTool_jobOptions')
def GetAtlasReadyFilterTool():
from AthenaCommon.Logging import logging
arft_local_logger = logging.getLogger('AtlasReadyFilterTool')
if not 'DQMonFlags' in dir():
arft_local_logger.debug("AtlasReadyFilterTool_jobOptions.py: DQMonFlags not yet imported - I import them now")
from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
if not 'monAtlasReadyFilterTool' in dir():
if globalflags.DataSource.get_Value() != 'geant4':
from IOVDbSvc.CondDB import conddb
conddb.addFolder('TDAQ', '/TDAQ/RunCtrl/DataTakingMode')
from AthenaMonitoring.AthenaMonitoringConf import DQAtlasReadyFilterTool
monAtlasReadyFilterTool = DQAtlasReadyFilterTool()
if (DQMonFlags.monManEnvironment == 'online'
or globalflags.DataSource.get_Value() == 'geant4'
or 'collisions' not in DQMonFlags.monManDataType.get_Value()
or DQMonFlags.disableAtlasReadyFilter.get_Value()):
arft_local_logger.info("Disabling ATLAS Ready monitoring filter")
monAtlasReadyFilterTool.alwaysReturnTrue = True
ToolSvc += monAtlasReadyFilterTool
from AthenaMonitoring.AthenaMonitoringConf import DQDummyFilterTool
return DQDummyFilterTool()
del arft_local_logger
if globalflags.DataSource.get_Value() != 'geant4':
from IOVDbSvc.CondDB import conddb
if not conddb.folderRequested('/TDAQ/RunCtrl/DataTakingMode'):
conddb.addFolder('TDAQ', '/TDAQ/RunCtrl/DataTakingMode', className='AthenaAttributeList')
from AthenaMonitoring.AthenaMonitoringConf import DQAtlasReadyFilterTool
return DQAtlasReadyFilterTool()
......@@ -29,39 +29,26 @@ def _InstanceFromProjectName():
else:
return "COMP200"
# Set up the bad lb filter tool
# Cache instances that are already created
# Set up the bad lb filter conditions algorithm
# Cache instance once already created
@memoize
def GetBadLBFilterTool(name, defects, alwaysReturnTrue=False, ignoreRecoverable=False, autoconfigure=True, origDbTag=None):
def GetBadLBFilterAlg(name, defects, writekey, ignoreRecoverable=False, origDbTag=None):
"""
Configure an instance of the bad LB filter tool. If called twice with the same options, will return the same instance.
Configure an instance of the bad LB filter conditions algorithm. Not intended to be called directly by users.
Arguments:
- name: name of instance to create
- defects: the defects to use for LB rejection. Tool will return false if any of these defects is present. These may be virtual defects. NOTE: the value you pass must be a 'hashable' type. The best choice is to pass a tuple; you can create a tuple from any iterable object with tuple(obj).
- alwaysReturnTrue (optional; default=False): if True, the tool will never reject any LBs.
- ignoreRecoverable (optional; default=False): if True, the tool will ignore defects that are marked as recoverable
- autoconfigure (optional; default=True): automatically handle certain cases, e.g. Monte Carlo, where we want to always return True
- ignoreRecoverable (optional; default=False): if True, the algorithm will ignore defects that are marked as recoverable
- origDbTag (optional): if set, will override automatic configuration of database tag (only for testing)
"""
import operator
from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.Logging import logging
log = logging.getLogger('BadLBFilterTool')
# if online or MC, we don't want to do any filtering, or even access
# the DBs
if autoconfigure and (DQMonFlags.monManEnvironment == 'online'
or globalflags.DataSource.get_Value() == 'geant4'
):
log.info('Disabling bad LB filter tool due to inappropriate environment; returning dummy')
from AthenaMonitoring.AthenaMonitoringConf import DQDummyFilterTool
monFilterTool = DQDummyFilterTool(name)
ToolSvc += monFilterTool
return monFilterTool
from AthenaCommon.AlgSequence import AthSequencer
log = logging.getLogger('BadLBFilterAlg')
from AthenaMonitoring.AthenaMonitoringConf import DQBadLBFilterTool
from AthenaMonitoring.AthenaMonitoringConf import DQBadLBFilterAlg
from DQDefects import DefectsDB
dbtag = _resolve_db_tag(origDbTag)
dbname=_InstanceFromProjectName()
......@@ -76,30 +63,95 @@ def GetBadLBFilterTool(name, defects, alwaysReturnTrue=False, ignoreRecoverable=
else:
raise ValueError('%s is not a known defect' % defect)
log.info ("Tool name %s to be configured with intolerable defects %s" % (name, list(primary_defects)))
log.info ("Algorithm name %s to be configured with intolerable defects %s" % (name, list(primary_defects)))
primary_defect_ids = [ddb.defect_id_map[id] for id in primary_defects]
monFilterTool = DQBadLBFilterTool(name)
monFilterTool.defectList = primary_defect_ids
monFilterTool.alwaysReturnTrue = alwaysReturnTrue
monFilterTool.ignoreRecoverable = ignoreRecoverable
monFilterAlg = DQBadLBFilterAlg(name)
monFilterAlg.defectList = primary_defect_ids
monFilterAlg.ignoreRecoverable = ignoreRecoverable
monFilterAlg.WriteKey = writekey
if globalflags.DataSource.get_Value() != 'geant4':
from IOVDbSvc.CondDB import conddb
if not conddb.folderRequested('/GLOBAL/DETSTATUS/DEFECTS'):
conddb.addFolder('GLOBAL_OFL', '/GLOBAL/DETSTATUS/DEFECTS')
conddb.addFolder('GLOBAL_OFL', '/GLOBAL/DETSTATUS/DEFECTS',
className='CondAttrListCollection')
condSequence = AthSequencer("AthCondSeq")
condSequence += monFilterAlg
return monFilterAlg
# Set up the bad lb filter tool
def GetBadLBFilterTool(name, defects, alwaysReturnTrue=False, ignoreRecoverable=False, autoconfigure=True, origDbTag=None):
"""
Configure an instance of the bad LB filter tool. If called twice with the same options, will return the same instance.
Arguments:
- name: name of *algorithm* instance to create
- defects: the defects to use for LB rejection. Tool will return false if any of these defects is present. These may be virtual defects. NOTE: the value you pass must be a 'hashable' type. The best choice is to pass a tuple; you can create a tuple from any iterable object with tuple(obj).
- alwaysReturnTrue (optional; default=False): if True, the tool will never reject any LBs.
- ignoreRecoverable (optional; default=False): if True, the tool will ignore defects that are marked as recoverable
- autoconfigure (optional; default=True): automatically handle certain cases, e.g. Monte Carlo, where we want to always return True
- origDbTag (optional): if set, will override automatic configuration of database tag (only for testing)
"""
import operator
from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.Logging import logging
log = logging.getLogger('BadLBFilterTool')
# if online or MC, we don't want to do any filtering, or even access
# the DBs
if autoconfigure and (DQMonFlags.monManEnvironment == 'online'
or globalflags.DataSource.get_Value() == 'geant4'
):
log.info('Disabling bad LB filter tool due to inappropriate environment; returning dummy')
from AthenaMonitoring.AthenaMonitoringConf import DQDummyFilterTool
monFilterTool = DQDummyFilterTool(name)
return monFilterTool
sgkey = 'DQBadLBFilterAlgResult_%s' % name
GetBadLBFilterAlg('DQBadLBFilterAlg_%s' % name,
defects, sgkey, ignoreRecoverable, origDbTag)
from AthenaMonitoring.AthenaMonitoringConf import DQBadLBFilterTool
monFilterTool = DQBadLBFilterTool(name)
monFilterTool.alwaysReturnTrue = alwaysReturnTrue
monFilterTool.ReadKey = sgkey
ToolSvc += monFilterTool
return monFilterTool
@memoize
def LArBadDefectList(origDbTag=None):
"""
Get the defects to configure for LAr - cache results to avoid lots of DB lookups
Arguments:
- origDbTag (optional): if set, will override automatic configuration of database tag (only for testing)
"""
import operator
from DQDefects import DefectsDB
dbtag = _resolve_db_tag(origDbTag)
dbname = _InstanceFromProjectName()
ddb = DefectsDB('COOLOFL_GLOBAL/'+dbname, tag=dbtag)
defects = ddb.defect_names
defectliststr = []
defectlist = []
lar_defects = reduce(operator.or_, [set(ddb.virtual_defect_logics[z].clauses) for z in \
('EMBA', 'EMBC', 'EMECA', 'EMECC',
'HECA', 'HECC', 'FCALA',
'FCALC')])-set(['LAR_UNCHECKED','LAR_GENERAL','DISABLED','NONGREEN'])
lar_defects = set(defect for defect in lar_defects
if ('LAR' in defect and
(('HVTRIP' in defect) or ('SEV' in defect) or
('CORRUPT' in defect))))
return lar_defects
def GetLArBadLBFilterTool(origDbTag=None):
"""
Configure a LAr defect-specific instance of the bad LB filter tool. If called twice with the same options, will return the same instance.
Arguments:
- origDbTag (optional): if set, will override automatic configuration of database tag (only for testing)
"""
import operator
from AthenaCommon.Logging import logging
log = logging.getLogger('BadLBFilterTool/LAr')
......@@ -113,20 +165,7 @@ def GetLArBadLBFilterTool(origDbTag=None):
log.info('Disabling LAr bad LB filter tool due to inappropriate environment')
lar_defects = []
else:
from DQDefects import DefectsDB
dbtag = _resolve_db_tag(origDbTag)
dbname = _InstanceFromProjectName()
ddb = DefectsDB('COOLOFL_GLOBAL/'+dbname, tag=dbtag)
defects = ddb.defect_names
defectliststr = []
defectlist = []
lar_defects = reduce(operator.or_, [set(ddb.virtual_defect_logics[z].clauses) for z in \
('EMBA', 'EMBC', 'EMECA', 'EMECC', 'HECA', 'HECC', 'FCALA', \
'FCALC')])-set(['LAR_UNCHECKED','LAR_GENERAL','DISABLED','NONGREEN'])
lar_defects = set(defect for defect in lar_defects
if ('LAR' in defect and
(('HVTRIP' in defect) or ('SEV' in defect) or
('CORRUPT' in defect))))
lar_defects = LArBadDefectList(origDbTag)
return GetBadLBFilterTool('LArBadLBFilterTool', tuple(lar_defects),
origDbTag=origDbTag)
# Set up the filled bunch filter tool
include.block('AthenaMonitoring/FilledBunchFilterTool_jobOptions.py')
from AthenaCommon.Logging import logging
def GetFilledBunchFilterTool():
from AthenaCommon.Logging import logging
fbft_local_logger = logging.getLogger('FilledBunchFilterTool_jobOptions')
fbft_local_logger = logging.getLogger('FilledBunchFilterTool')
fbft_local_logger.verbose('Configuring monFilledBunchFilterTool')
if not 'DQMonFlags' in dir():
fbft_local_logger.info("FilledBunchFilterTool_jobOptions.py: DQMonFlags not yet imported - I import them now")
from AthenaMonitoring.DQMonFlags import DQMonFlags
from AthenaCommon.GlobalFlags import globalflags
from RecExConfig.RecFlags import rec
if not 'monFilledBunchFilterTool' in dir():
fbft_local_logger.info('Configuring monFilledBunchFilterTool')
from AthenaMonitoring.AthenaMonitoringConf import DQFilledBunchFilterTool
from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool
monFilledBunchFilterTool = DQFilledBunchFilterTool()
monFilledBunchFilterTool.bunchCrossingTool = BunchCrossingTool()
if (rec.triggerStream() == 'CosmicCalo'
or globalflags.DataSource.get_Value() == 'geant4'
or 'collisions' not in DQMonFlags.monManDataType.get_Value()
or DQMonFlags.disableFilledBunchFilter.get_Value()):
fbft_local_logger.info('Filled bunch filter being configured to always return true')
monFilledBunchFilterTool.alwaysReturnTrue = True
ToolSvc += monFilledBunchFilterTool
fbft_local_logger.verbose('Filled bunch filter being configured to always return true')
from AthenaMonitoring.AthenaMonitoringConf import DQDummyFilterTool
return DQDummyFilterTool()
from AthenaMonitoring.AthenaMonitoringConf import DQFilledBunchFilterTool
from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool
monFilledBunchFilterTool = DQFilledBunchFilterTool()
monFilledBunchFilterTool.bunchCrossingTool = BunchCrossingTool()
return monFilledBunchFilterTool
del fbft_local_logger
......@@ -34,8 +34,8 @@ if DQMonFlags.doMonitoring():
from LumiBlockComps.TrigLivefractionToolDefault import TrigLivefractionToolDefault
ToolSvc+=TrigLivefractionToolDefault()
include("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
include("AthenaMonitoring/FilledBunchFilterTool_jobOptions.py")
from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool
from AthenaMonitoring.FilledBunchFilterTool import GetFilledBunchFilterTool
#---------------------------#
# Inner detector monitoring #
......@@ -247,9 +247,6 @@ if DQMonFlags.doMonitoring():
#--------------------------#
# Post-setup configuration #
#--------------------------#
if rec.triggerStream()=='express':
include("AthenaMonitoring/AtlasReadyFilterTool_jobOptions.py")
local_logger.debug('DQ Post-Setup Configuration')
# now the DQ tools are private, extract them from the set of monitoring algorithms
......@@ -273,7 +270,7 @@ if DQMonFlags.doMonitoring():
local_logger.debug('Setting up filters for tool %s', tool)
if rec.triggerStream()=='express':
local_logger.info('Stream is express and we will add ready tool for %s', tool)
tool.FilterTools += [monAtlasReadyFilterTool]
tool.FilterTools += [GetAtlasReadyFilterTool()]
# give all the tools the trigger translator
if DQMonFlags.useTrigger():
tool.TrigDecisionTool = monTrigDecTool
......
......@@ -492,35 +492,21 @@ initialize()
if( root_backend_for_lwhists != LWHistControls::hasROOTBackend() )
LWHistControls::setROOTBackend(root_backend_for_lwhists);
// if( m_monTools.size() > 0 ) {
// sc = m_monTools.retrieve();
// if( !sc.isSuccess() ) {
// msg(MSG::ERROR) << "!! Unable to retrieve monitoring tool " << m_monTools << endmsg;
// return sc;
// }
// if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " --> Retrieved AthenaMonTools" << endmsg;
// }
if( m_monTools.size() > 0 ) {
sc = m_monTools.retrieve();
if( !sc.isSuccess() ) {
msg(MSG::ERROR) << "!! Unable to retrieve monitoring tool " << m_monTools << endmsg;
return sc;
}
if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " --> Retrieved AthenaMonTools" << endmsg;
}
m_d->m_eventCounter = m_d->m_everyNevents;
ToolHandleArray<IMonitorToolBase>::iterator monToolsEnd = m_monTools.end();
for( ToolHandleArray<IMonitorToolBase>::iterator i = m_monTools.begin(); i != monToolsEnd; ++i ) {
ToolHandle<IMonitorToolBase>& tool = *i;
m_d->toolAudStart(tool);
AthMonBench bench_tmp;
if (m_d->m_doResourceMon)
bench_tmp.startMeasurement();
StatusCode sc_toolret = tool.retrieve();
if (m_d->m_doResourceMon)
bench_tmp.finishMeasurement();
m_d->toolAudEnd();
if( sc_toolret.isFailure() ) {
msg(MSG::ERROR) << "Failed to retrieve monitoring tool " << tool << endmsg;
return StatusCode::FAILURE;
}
else {
msg(MSG::INFO) << "Retrieved tool " << tool << endmsg;
}
IMonitorToolBase* mon = tool.operator->();
ManagedMonitorToolBase* managed = dynamic_cast<ManagedMonitorToolBase*>( mon );
if( managed != 0 ) {
......
......@@ -3,13 +3,13 @@
*/
#include "AthenaMonitoring/DQAtlasReadyFilterTool.h"
#include "AthenaPoolUtilities/AthenaAttributeList.h"
DQAtlasReadyFilterTool::DQAtlasReadyFilterTool(const std::string& type,const std::string& name,const IInterface* parent)
: AthAlgTool( type, name, parent )
, m_fallbackValue(true)
, m_alwaysReturnTrue(false)
, m_valueCache(true)
, m_key("/TDAQ/RunCtrl/DataTakingMode")
{
declareInterface<IDQFilterTool>(this);
declareProperty("fallbackValue", m_fallbackValue);
......@@ -21,49 +21,24 @@ DQAtlasReadyFilterTool::~DQAtlasReadyFilterTool () {}
StatusCode DQAtlasReadyFilterTool::initialize()
{
ATH_MSG_VERBOSE("ATLAS Ready initialize");
// don't register callback if we always return true anyway
// don't register if we always return true anyway
if (m_alwaysReturnTrue) return StatusCode::SUCCESS;
const DataHandle<AthenaAttributeList> attrList;
StatusCode sc = detStore()->regFcn(&DQAtlasReadyFilterTool::callback,
this, attrList,
"/TDAQ/RunCtrl/DataTakingMode");
if (sc.isFailure()) {
ATH_MSG_ERROR("Unable to register ATLAS Ready filter tool callback");
return StatusCode::FAILURE;
}
if (sc.isFailure()) {
ATH_MSG_ERROR("Unable to set up ready value cache");
return StatusCode::FAILURE;
}
ATH_CHECK( m_key.initialize() );
return StatusCode::SUCCESS;
}
StatusCode DQAtlasReadyFilterTool::updateCache() {
const AthenaAttributeList* attrList(0);
StatusCode sc = detStore()->retrieve(attrList, "/TDAQ/RunCtrl/DataTakingMode");
if (sc.isFailure()) {
ATH_MSG_WARNING("Unable to retrieve DataTakingMode information; falling back to" << m_fallbackValue);
m_valueCache = m_fallbackValue;
return StatusCode::SUCCESS;
}
if (attrList != 0) {
ATH_MSG_VERBOSE("ReadyForPhysics is: " << (*attrList)["ReadyForPhysics"].data<uint32_t>());
m_valueCache = ((*attrList)["ReadyForPhysics"].data<uint32_t>() != 0);
}
return StatusCode::SUCCESS;
}
bool DQAtlasReadyFilterTool::accept() const {
if (m_alwaysReturnTrue) {
return true;
} else {
ATH_MSG_DEBUG("ATLAS Ready accept called, value " << m_valueCache);
return m_valueCache;
SG::ReadCondHandle<AthenaAttributeList> rch(m_key);
const AthenaAttributeList* attrList{*rch};
if (attrList == 0) {
ATH_MSG_WARNING("Unable to retrieve DataTakingMode information; falling back to" << m_fallbackValue);
return m_fallbackValue;
}
ATH_MSG_DEBUG("ReadyForPhysics is: " << (*attrList)["ReadyForPhysics"].data<uint32_t>());
return ((*attrList)["ReadyForPhysics"].data<uint32_t>() != 0);
}
}
StatusCode DQAtlasReadyFilterTool::callback( IOVSVC_CALLBACK_ARGS) {
ATH_MSG_VERBOSE("ATLAS Ready callback called");
return updateCache();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment