ATLAS Offline Software
Loading...
Searching...
No Matches
HICaloGeoExtract.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6
7def HICaloGeoExtractCfg(flags, **kwargs):
8 acc = ComponentAccumulator()
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 kwargs.setdefault("InputTowerKey", inputTowers)
17 kwargs.setdefault("CaloCellContainerKey", "AllCalo")
18 kwargs.setdefault("HistStream", "CALOGEOEXTRACTSTREAM")
19 extractCGC = CompFactory.ExtractCaloGeoConstants("ExtractCaloGeoConstants", **kwargs)
20 acc.addEventAlgo(extractCGC)
21
22 acc.addService(CompFactory.THistSvc(Output=["CALOGEOEXTRACTSTREAM DATAFILE='cluster.geo.W_ETA_PHI_R.root' OPT='RECREATE'"]))
23
24 return acc
25
26
27if __name__ == "__main__":
28 """
29 This macro will generate a new root weight file with histograms "h3_w", "h3_eta", "h3_phi", and "h3_R"
30 that are stored in "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HIJetCorrection/cluster.geo....root" files.
31 It's based on the code from https://gitlab.cern.ch/atlas-physics/hi/jets/HICaloGeo/
32 To have correct weights, one needs to assure:
33 1) have consistent input file, conditions, and geometry
34 2) have only 1 event processed
35 To get the new file:
36 1) setup Athena:
37 $ asetup Athena,main,latest,here
38 2) run this code:
39 $ python -m HIClusterGeoWeights.HICaloGeoExtract
40 3) the new file is "cluster.geo.W_ETA_PHI_R.root"
41
42 In the root weight file, there are also histograms "h3_eta_phi_response", "h3_eta_phi_offset",
43 and "h1_run_index". These are produced by "HIClusterGeoFiller" and "makeHIResponse".
44 """
45
46 from AthenaConfiguration.AllConfigFlags import initConfigFlags
47 from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
48 flags = initConfigFlags()
49
50
54
55
56 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"]
57 flags.IOVDb.GlobalTag = "CONDBR2-BLKPA-2022-09"
58 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
59
60
61
62 flags.Exec.MaxEvents=1 # always only 1 event!
63 flags.Concurrency.NumThreads=1
64 flags.Trigger.triggerConfig = "DB"
65 flags.Reco.EnableHI = True
66 flags.lock()
67
68 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
69 acc = MainServicesCfg(flags)
70
71 acc.merge(HICaloGeoExtractCfg(flags))
72
73 acc.printConfig(withDetails=True, summariseProps=True)
74 flags.dump()
75
76 import sys
77 sys.exit(acc.run().isFailure())
HICaloGeoExtractCfg(flags, **kwargs)