Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LArHV2Ntuple.py
Go to the documentation of this file.
1 #!/bin/env python
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 
7 if __name__=='__main__':
8 
9  import os,sys
10  import argparse
11 
12  # now process the CL options and assign defaults
13  parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
14  parser.add_argument('-s','--stime', dest='time', default=1726837122, help='TimeStamp (in s)', type=int)
15  parser.add_argument('-r','--run', dest='run', default=999999, help='Run Number', type=int)
16  parser.add_argument('-t','--tag',dest='dbtag',default=None,help="Global conditions tag", type=str)
17  parser.add_argument('-o','--out', dest='out', default="LArHV.root", help='Output root file', type=str)
18 
19  args = parser.parse_args()
20  if help in args and args.help is not None and args.help:
21  parser.print_help()
22  sys.exit(0)
23 
24 
25  from AthenaConfiguration.AllConfigFlags import initConfigFlags
27 
28  flags.Input.RunNumbers=[args.run]
29  from AthenaConfiguration.TestDefaults import defaultGeometryTags
30  flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
31 
32  flags.Input.Files=[]
33 
34  flags.Input.isMC=False
35 
36  flags.LAr.doAlign=False
37 
38  from AthenaConfiguration.Enums import LHCPeriod
39  if flags.Input.RunNumbers[0] < 222222:
40  #Set to run1 for early run-numbers
41  flags.GeoModel.Run=LHCPeriod.Run1
42  flags.IOVDb.DatabaseInstance="OFLP200" if flags.Input.isMC else "COMP200"
43  else:
44  flags.GeoModel.Run=LHCPeriod.Run2
45  flags.IOVDb.DatabaseInstance="OFLP200" if flags.Input.isMC else "CONDBR2"
46 
47  if args.dbtag:
48  flags.IOVDb.GlobalTag=args.dbtag
49  elif flags.IOVDb.DatabaseInstance == "COMP200":
50  flags.IOVDb.GlobalTag="COMCOND-BLKPA-RUN1-09"
51  else:
52  flags.IOVDb.GlobalTag="CONDBR2-BLKPA-2024-03"
53 
54 
55  flags.lock()
56 
57  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
58  cfg=MainServicesCfg(flags)
59 
60  #MC Event selector since we have no input data file
61  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
62  cfg.merge(McEventSelectorCfg(flags,
63  EventsPerRun = 1,
64  FirstEvent = 1,
65  InitialTimeStamp = args.time,
66  TimeStampInterval = 1))
67 
68 
69 
70  from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg
71  cfg.merge(LArHVScaleCfg(flags))
72 
73 
74  cfg.addEventAlgo(CompFactory.LArHV2Ntuple())
75 
76 
77  rootfile=args.out
78  if os.path.exists(rootfile):
79  os.remove(rootfile)
80  cfg.addService(CompFactory.THistSvc(Output = [ "file1 DATAFILE='"+rootfile+"' TYP='ROOT' OPT='RECREATE'" ]))
81  cfg.setAppProperty("HistogramPersistency","ROOT")
82 
83  cfg.run(1)
84  sys.exit(0)
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.LArHVScaleConfig.LArHVScaleCfg
def LArHVScaleCfg(configFlags)
Definition: LArHVScaleConfig.py:8