ATLAS Offline Software
Functions
python.BadLBFilterToolConfig Namespace Reference

Functions

def BadLBFilterAlgCfg (inputFlags, name, defects, writekey, ignoreRecoverable=False, origDbTag=None)
 
def BadLBFilterToolCfg (inputFlags, name, defects, alwaysReturnTrue=False, ignoreRecoverable=False, origDbTag=None)
 
def LArDefectList (inputFlags, origDbTag=None)
 
def LArBadLBFilterToolCfg (inputFlags, origDbTag=None)
 

Function Documentation

◆ BadLBFilterAlgCfg()

def python.BadLBFilterToolConfig.BadLBFilterAlgCfg (   inputFlags,
  name,
  defects,
  writekey,
  ignoreRecoverable = False,
  origDbTag = None 
)

Definition at line 11 of file BadLBFilterToolConfig.py.

11 def BadLBFilterAlgCfg(inputFlags,name, defects, writekey, ignoreRecoverable=False, origDbTag=None):
12  log = logging.getLogger('BadLBFilterAlgCfg')
13  result=ComponentAccumulator()
14 
15  from DQDefects import DefectsDB
16  ddb = DefectsDB('COOLOFL_GLOBAL/' + inputFlags.IOVDb.DatabaseInstance,
17  tag=origDbTag or inputFlags.IOVDb.GlobalTag)
18 
19  primary_defects = set()
20  for defect in defects:
21  if defect in ddb.defect_names:
22  primary_defects.add(defect)
23  elif defect in ddb.virtual_defect_names:
24  primary_defects |= ddb.virtual_defect_logics(defect).primary_defects
25  else:
26  raise ValueError('%s is not a known defect' % defect)
27 
28  log.debug ("Algorithm %s configured with intolerable defects %s" % (name, list(primary_defects)))
29 
30  primary_defect_ids = [ddb.defect_id_map[id] for id in primary_defects]
31 
32  monFilterAlg =CompFactory.DQBadLBFilterAlg(name)
33  monFilterAlg.defectList = sorted(primary_defect_ids)
34  monFilterAlg.ignoreRecoverable = ignoreRecoverable
35  monFilterAlg.WriteKey = writekey
36 
37  from IOVDbSvc.IOVDbSvcConfig import addFolders
38 
39  if not inputFlags.Input.isMC:
40  result.merge(addFolders(inputFlags,'/GLOBAL/DETSTATUS/DEFECTS',detDb='GLOBAL_OFL',className='CondAttrListCollection'))
41 
42  result.addCondAlgo(monFilterAlg)
43  return result
44 
45 
46 
47 # Set up the bad lb filter tool

◆ BadLBFilterToolCfg()

def python.BadLBFilterToolConfig.BadLBFilterToolCfg (   inputFlags,
  name,
  defects,
  alwaysReturnTrue = False,
  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.
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
    - origDbTag (optional): if set, will override automatic configuration of database tag (only for testing)

Definition at line 48 of file BadLBFilterToolConfig.py.

48 def BadLBFilterToolCfg(inputFlags,name, defects, alwaysReturnTrue=False, ignoreRecoverable=False, origDbTag=None):
49  """
50  Configure an instance of the bad LB filter tool. If called twice with the same options, will return the same instance.
51  Arguments:
52  - name: name of *algorithm* instance to create
53  - 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).
54  - alwaysReturnTrue (optional; default=False): if True, the tool will never reject any LBs.
55  - ignoreRecoverable (optional; default=False): if True, the tool will ignore defects that are marked as recoverable
56  - origDbTag (optional): if set, will override automatic configuration of database tag (only for testing)
57  """
58  log = logging.getLogger('BadLBFilterToolCfg')
59  result=ComponentAccumulator()
60 
61  if inputFlags.Common.isOnline or inputFlags.Input.isMC:
62  # if online or MC, we don't want to do any filtering, or even access
63  log.info('Disabling bad LB filter tool due to inappropriate environment; returning dummy')
64  result.setPrivateTools(CompFactory.DQDummyFilterTool(name))
65  return result
66 
67  sgkey = 'DQBadLBFilterAlgResult_%s' % name
68  #Schedule required cond-algo
69  result.merge(BadLBFilterAlgCfg(inputFlags,name+'_Alg',tuple(sorted(defects)),sgkey,ignoreRecoverable, origDbTag))
70 
71  monFilterTool=CompFactory.DQBadLBFilterTool(name,alwaysReturnTrue=alwaysReturnTrue,
72  ReadKey= sgkey)
73  result.setPrivateTools(monFilterTool)
74  return result
75 
76 
77 @AccumulatorCache

◆ LArBadLBFilterToolCfg()

def python.BadLBFilterToolConfig.LArBadLBFilterToolCfg (   inputFlags,
  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)

Definition at line 100 of file BadLBFilterToolConfig.py.

100 def LArBadLBFilterToolCfg(inputFlags,origDbTag=None):
101  """
102  Configure a LAr defect-specific instance of the bad LB filter tool. If called twice with the same options, will return the same instance.
103  Arguments:
104  - origDbTag (optional): if set, will override automatic configuration of database tag (only for testing)
105  """
106  from AthenaCommon.Logging import logging
107  log = logging.getLogger('BadLBFilterTool/LAr')
108 
109  if inputFlags.Common.isOnline or inputFlags.Input.isMC:
110  log.info('Disabling LAr bad LB filter tool due to inappropriate environment')
111  lar_defects= []
112  else:
113  lar_defects = LArDefectList(inputFlags,origDbTag)
114 
115  return BadLBFilterToolCfg(inputFlags,'LArBadLBFilterTool', tuple(lar_defects),
116  origDbTag=origDbTag)

◆ LArDefectList()

def python.BadLBFilterToolConfig.LArDefectList (   inputFlags,
  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)

Definition at line 78 of file BadLBFilterToolConfig.py.

78 def LArDefectList(inputFlags,origDbTag=None):
79  """
80  Get the defects to configure for LAr - cache results to avoid lots of DB lookups
81  Arguments:
82  - origDbTag (optional): if set, will override automatic configuration of database tag (only for testing)
83  """
84  import operator
85  from DQDefects import DefectsDB
86  ddb = DefectsDB('COOLOFL_GLOBAL/' + inputFlags.IOVDb.DatabaseInstance,
87  tag=origDbTag or inputFlags.IOVDb.GlobalTag)
88 
89  lar_defects = reduce(operator.or_, [set(ddb.virtual_defect_logics[z].clauses) for z in \
90  ('EMBA', 'EMBC', 'EMECA', 'EMECC',
91  'HECA', 'HECC', 'FCALA',
92  'FCALC')])-set(['LAR_UNCHECKED','LAR_GENERAL','DISABLED','NONGREEN'])
93  lar_defects = set(defect for defect in lar_defects
94  if ('LAR' in defect and
95  (('HVTRIP' in defect) or ('SEV' in defect) or
96  ('CORRUPT' in defect))))
97  return lar_defects
98 
99 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
reduce
void reduce(HepMC::GenEvent *ge, std::vector< HepMC::GenParticlePtr > toremove)
Remove unwanted particles from the event, collapsing the graph structure consistently.
Definition: FixHepMC.cxx:82
python.BadLBFilterToolConfig.LArDefectList
def LArDefectList(inputFlags, origDbTag=None)
Definition: BadLBFilterToolConfig.py:78
python.BadLBFilterToolConfig.LArBadLBFilterToolCfg
def LArBadLBFilterToolCfg(inputFlags, origDbTag=None)
Definition: BadLBFilterToolConfig.py:100
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
python.BadLBFilterToolConfig.BadLBFilterToolCfg
def BadLBFilterToolCfg(inputFlags, name, defects, alwaysReturnTrue=False, ignoreRecoverable=False, origDbTag=None)
Definition: BadLBFilterToolConfig.py:48
python.BadLBFilterToolConfig.BadLBFilterAlgCfg
def BadLBFilterAlgCfg(inputFlags, name, defects, writekey, ignoreRecoverable=False, origDbTag=None)
Definition: BadLBFilterToolConfig.py:11