ATLAS Offline Software
HICaloGeoExtract.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 
7 def HICaloGeoExtractCfg(flags):
9 
10  from CaloRec.CaloRecoConfig import CaloRecoCfg
11  acc.merge(CaloRecoCfg(flags))
12  from CaloRec.CaloTowerMakerConfig import CaloTowerMakerCfg
13  towerMaker = acc.getPrimaryAndMerge(CaloTowerMakerCfg(flags))
14  inputTowers = towerMaker.TowerContainerName
15 
16  extractCGC = CompFactory.ExtractCaloGeoConstants("ExtractCaloGeoConstants", InputTowerKey=inputTowers, HistStream="CALOGEOEXTRACTSTREAM")
17  acc.addEventAlgo(extractCGC)
18 
19  acc.addService(CompFactory.THistSvc(Output=["CALOGEOEXTRACTSTREAM DATAFILE='cluster.geo.XXX.root' OPT='RECREATE'"]))
20 
21  return acc
22 
23 
24 if __name__ == "__main__":
25  """
26  This macro will generate a new root weight file with histograms "h3_w", "h3_eta", "h3_phi", and "h3_R"
27  that are stored in "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HIJetCorrection/cluster.geo....root" files.
28  It's based on the code from https://gitlab.cern.ch/atlas-physics/hi/jets/HICaloGeo/
29  To have correct weights, one needs to assure:
30  1) have consistent input file, conditions, and geometry
31  2) have only 1 event processed
32  To get the new file:
33  1) setup Athena:
34  $ asetup Athena,master,latest,here
35  2) run this code:
36  $ python -m HIEventUtils.HICaloGeoExtract
37  3) the new file is "cluster.geo.XXX.root"; rename it however is appropriate
38 
39  In the root weight file, there are also histograms "h3_eta_phi_response", "h3_eta_phi_offset",
40  and "h1_run_index". These are produced elsewhere.
41  """
42 
43  from AthenaConfiguration.AllConfigFlags import initConfigFlags
44  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
45  flags = initConfigFlags()
46 
47 
51 
52 
53  flags.Input.Files = [defaultTestFiles.d + "/RecJobTransformTests/data22_hi/RAWFiles/data22_hi.00440101.physics_MinBias.daq.RAW/data22_hi.00440101.physics_MinBias.daq.RAW._lb0214._SFO-11._0001.data"]
54  flags.IOVDb.GlobalTag = "CONDBR2-BLKPA-2022-09"
55  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
56 
57 
58 
59  flags.Exec.MaxEvents=1 # always only 1 event!
60  flags.Concurrency.NumThreads=1
61  flags.Trigger.triggerConfig = "DB"
62  flags.Reco.EnableHI = True
63  flags.lock()
64 
65  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
66  acc = MainServicesCfg(flags)
67 
68  acc.merge(HICaloGeoExtractCfg(flags))
69 
70  acc.printConfig(withDetails=True, summariseProps=True)
71  flags.dump()
72 
73  import sys
74  sys.exit(acc.run().isFailure())
python.CaloRecoConfig.CaloRecoCfg
def CaloRecoCfg(flags, clustersname=None)
Definition: CaloRecoConfig.py:9
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
HICaloGeoExtract.HICaloGeoExtractCfg
def HICaloGeoExtractCfg(flags)
Definition: HICaloGeoExtract.py:7
python.CaloTowerMakerConfig.CaloTowerMakerCfg
def CaloTowerMakerCfg(flags)
Definition: CaloTowerMakerConfig.py:7
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19