ATLAS Offline Software
Loading...
Searching...
No Matches
runInDetSecVtxFinder.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2# Define method to construct configures Sec Vtx Finder alg
3# attempted by N Ribaric (@LancasterUNI) neza.ribaric@cern.ch
4
5if __name__ == "__main__":
6 import AthenaCommon.Constants as Lvl
7
8 # import the flags and set them
9 from AthenaConfiguration.AllConfigFlags import initConfigFlags
10 flags = initConfigFlags()
11
12 flags.Exec.MaxEvents = 50
13
14 # use one of the predefined files
15 from AthenaConfiguration.TestDefaults import defaultTestFiles
16 flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
17 flags.Input.isMC=True
18
19 # lock the flags
20 flags.lock()
21
22 # create basic infrastructure
23 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
24 acc = MainServicesCfg(flags)
25
26 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
27 acc.merge(PoolReadCfg(flags))
28
29 # add the algorithm to the configuration
30 from InDetConfig.InDetSecVtxFinderConfig import InDetSecVtxFinderAlgCfg
31 acc.merge(InDetSecVtxFinderAlgCfg(flags,
32 name = "InDetSecVtxFinder",
33 FinderTool = "ISV",
34 useTrackParticles = True,
35 inputTrackParticles = "InDetTrackParticles",
36 outputSecondaryVertices = "RecoSecVtx",
37 doVertexMerging = False,
38 OutputLevel = Lvl.INFO))
39
40 # Contents
41 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
42 TRUTH0SlimmingHelper = SlimmingHelper("TRUTH0SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
43 TRUTH0SlimmingHelper.AppendToDictionary = {'EventInfo':'xAOD::EventInfo','EventInfoAux':'xAOD::EventAuxInfo',
44 'TruthEvents':'xAOD::TruthEventContainer','TruthEventsAux':'xAOD::TruthEventAuxContainer',
45 'TruthVertices':'xAOD::TruthVertexContainer','TruthVerticesAux':'xAOD::TruthVertexAuxContainer',
46 'TruthParticles':'xAOD::TruthParticleContainer','TruthParticlesAux':'xAOD::TruthParticleAuxContainer'}
47
48 TRUTH0SlimmingHelper.AllVariables = [ 'EventInfo',
49 'TruthEvents',
50 'TruthVertices',
51 'TruthParticles']
52
53 # Metadata
54 TRUTH0MetaDataItems = [ "xAOD::TruthMetaDataContainer#TruthMetaData", "xAOD::TruthMetaDataAuxContainer#TruthMetaDataAux." ]
55
56 # Create output stream
57 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
58 TRUTH0ItemList = TRUTH0SlimmingHelper.GetItemList()
59 TRUTH0ItemList+=["xAOD::VertexContainer#RecoSecVtx","xAOD::VertexContainer#RecoSecVtxAux."]
60 acc.merge(OutputStreamCfg(flags, "SecondayVertexOutput", ItemList=TRUTH0ItemList))
61
62 # debug printout
63 acc.printConfig(withDetails=True, summariseProps=True)
64
65 # run the job
66 status = acc.run()
67
68 # report the execution status (0 ok, else error)
69 import sys
70 sys.exit(not status.isSuccess())