ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
Tools
HitAnalysis
tools
RunHitAnalysis.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
"""Run HitAnalysis
3
4
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5
"""
6
import
sys
7
from
argparse
import
ArgumentParser
8
9
# Argument parsing
10
parser = ArgumentParser(
"HitAnalysis.py"
)
11
parser.add_argument(
"detectors"
, metavar=
"detectors"
, type=str, nargs=
"*"
,
12
help=
"Specify the list of detectors"
)
13
parser.add_argument(
"--localgeo"
, default=
False
, action=
"store_true"
,
14
help=
"Use local geometry XML files"
)
15
parser.add_argument(
"-n"
,
"--maxEvents"
, default=-1, type=int,
16
help=
"The number of events to run. -1 runs all events."
)
17
parser.add_argument(
"-i"
,
"--input"
,
18
help=
"The input HITS file to use"
)
19
args = parser.parse_args()
20
21
22
# Some info about the job
23
print
(
"----HitAnalysis----"
)
24
print
()
25
if
args.localgeo:
26
print
(
"Using local Geometry XML files"
)
27
print
(f
"Input file: {args.input}"
)
28
if
not
args.detectors:
29
print
(
"Running complete detector"
)
30
else
:
31
print
(
"Running with: {}"
.format(
", "
.join(args.detectors)))
32
print
()
33
34
# Configure
35
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
36
from
AthenaConfiguration.Enums
import
ProductionStep
37
flags = initConfigFlags()
38
flags.Common.ProductionStep = ProductionStep.Simulation
39
flags.Input.Files = [args.input]
40
if
args.localgeo:
41
flags.ITk.Geometry.AllLocal =
True
42
flags.Output.HISTFileName =
'SiHitAnalysis.root'
43
from
AthenaConfiguration.DetectorConfigFlags
import
setupDetectorFlags
44
setupDetectorFlags(flags, args.detectors, use_metadata=
True
, toggle_geometry=
True
)
45
flags.lock()
46
47
# Construct our accumulator to run
48
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
49
acc = MainServicesCfg(flags)
50
from
AthenaPoolCnvSvc.PoolReadConfig
import
PoolReadCfg
51
acc.merge(PoolReadCfg(flags))
52
from
HitAnalysis.HitAnalysisConfig
import
SiHitAnalysisCfg
53
acc.merge(SiHitAnalysisCfg(flags))
54
55
# Execute and finish
56
sc = acc.run(maxEvents=args.maxEvents)
57
58
# Success should be 0
59
sys.exit(
not
sc.isSuccess())
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
Generated on
for ATLAS Offline Software by
1.17.0