ATLAS Offline Software
Loading...
Searching...
No Matches
LumiBlockMuWriterConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2#
3# File: LumiBlockComps/python/LumiBlockMuWriterConfig.py
4# Created: May 2020, sss
5# Purpose: Configure LumiBlockMuWriter.
6#
7
8
9from AthenaConfiguration.ComponentFactory import CompFactory
10from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11from AthenaConfiguration.Enums import BeamType
12
13
14def LumiBlockMuWriterCfg (flags, name = 'LumiBlockMuWriter', seqName="AthAlgSeq"):
15 result = ComponentAccumulator(seqName)
16
17 if flags.Beam.Type is BeamType.Cosmics or flags.Input.isMC:
18 condkey = ''
19 else:
20 from LumiBlockComps.LuminosityCondAlgConfig import LuminosityCondAlgCfg
21 result.merge (LuminosityCondAlgCfg (flags))
22 condkey = result.getCondAlgo ('LuminosityCondAlg').LuminosityOutputKey
23
24 from AthenaConfiguration.Enums import ProductionStep
25 kwargs={}
26 if flags.Common.ProductionStep in [ProductionStep.PileUpPretracking, ProductionStep.MinbiasPreprocessing]:
27 actualLumiKey=f"{flags.Overlay.BkgPrefix}EventInfo.actualInteractionsPerCrossing"
28 averageLumiKey=f"{flags.Overlay.BkgPrefix}EventInfo.averageInteractionsPerCrossing"
29
30 kwargs.update({"actualInteractionsPerCrossingKey" : actualLumiKey,
31 "averageInteractionsPerCrossingKey": averageLumiKey})
32
33 LumiBlockMuWriter = CompFactory.LumiBlockMuWriter # LumiBlockComps
34 alg = LumiBlockMuWriter (name,
35 LumiDataKey = condkey,
36 **kwargs)
37 #In the HLT we want to run LumiBlockMuWriter as a normal EventAlgo, but in a pre-event sequence (HLTBeginSeq)
38 if flags.Trigger.doHLT:
39 result.addEventAlgo(alg)
40 #For offline and particularly serial athena, add LumiBlockMuWriter to AthCondSeq to ensure it runs first (ATR-24721)
41 else:
42 result.addCondAlgo(alg)
43 return result
44
45
46if __name__ == "__main__":
47 from AthenaConfiguration.AllConfigFlags import initConfigFlags
48 from AthenaConfiguration.TestDefaults import defaultTestFiles
49
50 print ('--- collisions')
51 flags1 = initConfigFlags()
52 flags1.Input.Files = defaultTestFiles.RAW_RUN2
53 flags1.lock()
54 acc1 = LumiBlockMuWriterCfg (flags1)
55 acc1.printCondAlgs (summariseProps=True)
56 acc1.wasMerged()
57
58 print ('--- cosmics')
59 flags2 = initConfigFlags()
60 flags2.Input.Files = []
61 flags2.Beam.Type = BeamType.Cosmics
62 flags2.lock()
63 acc2 = LumiBlockMuWriterCfg (flags2)
64 acc2.printCondAlgs (summariseProps=True)
65 acc2.wasMerged()
LumiBlockMuWriterCfg(flags, name='LumiBlockMuWriter', seqName="AthAlgSeq")