ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
HeavyIonPhys
HIClusterGeoWeights
python
HIClusterGeoFiller.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3
def
HIClusterGeoFillerCfg
(flags, **kwargs):
4
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
5
from
AthenaConfiguration.ComponentFactory
import
CompFactory
6
acc = ComponentAccumulator()
7
8
# main algorithm
9
kwargs.setdefault(
"EventInfoKey"
,
"EventInfo"
)
10
kwargs.setdefault(
"CaloClusterContainerKey"
,
"HIClusters"
)
11
kwargs.setdefault(
"HIEventShapeKey"
,
"CaloSums"
)
12
kwargs.setdefault(
"HistStream"
,
"CLUSTERGEOFILLERSTREAM"
)
13
kwargs.setdefault(
"minFCalET"
, 0.0)
14
kwargs.setdefault(
"maxFCalET"
, 5.4)
15
hiClusterGeoFiller = CompFactory.HIClusterGeo_HistoFiller(
"HIClusterGeo_HistoFiller"
, **kwargs)
16
acc.addEventAlgo(hiClusterGeoFiller)
17
18
# writing histograms into a root file
19
thistSvc = CompFactory.THistSvc(Output=[
"CLUSTERGEOFILLERSTREAM DATAFILE='HIClusterGeo_HistoFiller.root' OPT='RECREATE'"
])
20
acc.addService(thistSvc)
21
22
return
acc
23
24
25
if
__name__ ==
"__main__"
:
26
"""
27
This macro will generate a new root file. There will be one histogram per lumiblock in the input files.
28
There will be no histograms for lumiblocks that are not present in the input files.
29
To get the output:
30
1) setup Athena:
31
$ asetup Athena,main,latest,here
32
2) run this code:
33
$ python -m HIClusterGeoWeights.HIClusterGeoFiller
34
2.B) alternatively, specify the input file:
35
$ python -m HIClusterGeoWeights.HIClusterGeoFiller --filesInput=some.input.file.AOD.root
36
2.C) alternatively, submit the job to grid:
37
$ lsetup panda
38
$ pathena --trf "python -m HIClusterGeoWeights.HIClusterGeoFiller --filesInput=%IN" --inDS some.input.dataset --outDS user.$USER.some.output.dataset --extOutFile=HIClusterGeo_HistoFiller.root
39
3) the new file is "HIClusterGeo_HistoFiller.root"
40
The output file shall be fed to "makeHIResponse" macro. There shall be one file per each run. Thus, it might be
41
necessary to merge several "HIClusterGeo_HistoFiller.root" files with "hadd".
42
"""
43
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
44
45
flags = initConfigFlags()
46
47
# for testing
48
from
os
import
listdir, path
49
direc =
"../storage/data18_hi.00367165.physics_PC.merge.AOD.f1030_m2048"
# Pb+Pb 5.02TeV
50
# direc = "../storage/data24_hi.00490182.physics_MinBias.merge.AOD.f1550_m2267" # Pb+Pb 5.36TeV
51
if
path.isdir(direc):
52
# add files from the folder only if such folder exists; this prevents throwing an error from 'listdir' on grid
53
flags.Input.Files = [
"%s/%s"
% (direc, x)
for
x
in
listdir(direc)
if
x[x.rfind(
"."
) + 1:]
in
[
"root"
,
"1"
,
"2"
]]
54
55
flags.Exec.MaxEvents=-1
56
flags.Exec.SkipEvents=0
57
flags.Concurrency.NumThreads=1
58
59
# enables unit tests to switch only parts of reco such as (note the absence of spaces around the equal sign):
60
61
flags.fillFromArgs()
62
63
flags.lock()
64
65
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
66
acc = MainServicesCfg(flags)
67
68
# to read from AOD
69
from
AthenaPoolCnvSvc.PoolReadConfig
import
PoolReadCfg
70
acc.merge(PoolReadCfg(flags))
71
72
# main task
73
acc.merge(
HIClusterGeoFillerCfg
(flags))
74
75
acc.printConfig(withDetails=
True
, summariseProps=
True
)
76
flags.dump()
77
78
import
sys
79
sys.exit(acc.run().isFailure())
HIClusterGeoFiller.HIClusterGeoFillerCfg
HIClusterGeoFillerCfg(flags, **kwargs)
Definition
HIClusterGeoFiller.py:3
Generated on
for ATLAS Offline Software by
1.17.0