Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
runSecVtxTruthMatching.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 
4 from glob import glob
5 
6 def get_args():
7  from argparse import ArgumentParser
8  parser = ArgumentParser(description='Parser for SecVertexTruthMatching configuration')
9  parser.add_argument("--filesInput", required=True)
10  parser.add_argument("--maxEvents", help="Limit number of events. Default: all input events", default=-1, type=int)
11  parser.add_argument("--skipEvents", help="Skip this number of events. Default: no events are skipped", default=0, type=int)
12  parser.add_argument("--mergeLargeD0Tracks", help='Consider LRT tracks in the matching', action='store_true', default=False)
13  parser.add_argument("--outputFile", help='Name of output file',default="TruthMatchHists.root")
14  parser.add_argument("--pdgIds", help='List of pdgIds to match', nargs='+', type=int, default=[36,51])
15  parser.add_argument("--vertexContainer", help='SG key of secondary vertex container',default='VrtSecInclusive_SecondaryVertices')
16  parser.add_argument("--truthVertexContainer", help='SG key of truth vertex container',default='TruthVertices')
17  return parser.parse_args()
18 
19 if __name__=='__main__':
20 
21  args = get_args()
22 
23  from AthenaConfiguration.AllConfigFlags import initConfigFlags
24  flags = initConfigFlags()
25 
26  flags.Input.Files = []
27  for path in args.filesInput.split(','):
28  flags.Input.Files += glob(path)
29  flags.Output.HISTFileName = args.outputFile
30 
31  flags.Exec.SkipEvents = args.skipEvents
32  flags.Exec.MaxEvents = args.maxEvents
33 
34  flags.lock()
35 
36  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
37  acc = MainServicesCfg(flags)
38  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
39  acc.merge(PoolReadCfg(flags))
40 
41  from TrackingAnalysisAlgorithms.TrackingAnalysisAlgorithmsConfig import SecVertexTruthMatchAlgCfg
42  acc.merge(SecVertexTruthMatchAlgCfg(flags,
43  useLRTTracks = args.mergeLargeD0Tracks,
44  TargetPDGIDs = args.pdgIds,
45  SecondaryVertexContainer = args.vertexContainer,
46  TruthVertexContainer = args.truthVertexContainer
47  )
48  )
49 
50  acc.printConfig(withDetails=True)
51 
52  # Execute and finish
53  sc = acc.run()
54 
55  # Success should be 0
56  import sys
57  sys.exit(not sc.isSuccess())
runSecVtxTruthMatching.get_args
def get_args()
Definition: runSecVtxTruthMatching.py:6
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
TrackingAnalysisAlgorithmsConfig.SecVertexTruthMatchAlgCfg
def SecVertexTruthMatchAlgCfg(flags, name="SecVertexTruthMatchAlg", useLRTTracks=False, **kwargs)
Definition: TrackingAnalysisAlgorithmsConfig.py:11
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69