ATLAS Offline Software
LArFlatFromFileConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 
5 def LArFlatFromFileCfg(flags):
6 
7  #Get basic services and cond-algos
8  from LArCalibProcessing.LArCalibBaseConfig import LArCalibBaseCfg
9  result=LArCalibBaseCfg(flags)
10 
11  if flags.LArCalib.isSC:
12  ckey="LArOnOffIdMapSC"
13  ngain=1
14  else:
15  ckey="LArOnOffIdMap"
16  ngain=3
17  result.addEventAlgo(CompFactory.LArFlatFromFile(SuperCells=flags.LArCalib.isSC,
18  CablingKey=ckey,NGains=ngain,
19  OFCInput="",
20  SingleInput=flags.LArCalib.Input.Files[0],
21  Folder=flags.LArCalib.DetCellParams.Folder,
22  Blob=flags.LArCalib.Input.SubDet,
23  checkInput=flags.LArCalib.doValidation
24  ))
25 
26  from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
27  result.merge(OutputConditionsAlgCfg(flags,
28  outputFile="dummy.root",
29  ObjectList=["CondAttrListCollection#"+flags.LArCalib.DetCellParams.Folder, ],
30  IOVTagList=[flags.LArCalib.Input.Type],
31  Run1=flags.LArCalib.IOVStart,
32  Run2=flags.LArCalib.IOVEnd
33  ))
34 
35  #RegistrationSvc
36  result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = True, SVFolder=False,
37  OverrideNames = [flags.LArCalib.Input.SubDet], OverrideTypes = ["Blob16M"]))
38  result.getService("IOVDbSvc").DBInstance=""
39 
40  #MC Event selector since we have no input data file
41  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
42  result.merge(McEventSelectorCfg(flags,
43  RunNumber = flags.LArCalib.Input.RunNumbers[0],
44  EventsPerRun = 1,
45  FirstEvent = 1,
46  InitialTimeStamp = 0,
47  TimeStampInterval = 1))
48 
49  return result
50 
51 if __name__=="__main__":
52 
53  import sys
54  import argparse
55 
56  # now process the CL options and assign defaults
57  parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
58  parser.add_argument('-i','--infile', dest='infile', default="", help='Input file with constants`', type=str)
59  parser.add_argument('-f','--folder', dest='fld', default="", help='Folder for constants`', type=str)
60  parser.add_argument('-t','--tag', dest='tag', default="", help='Folder tag for constants`', type=str)
61  parser.add_argument('-b','--blob', dest='blb', default="", help='Blob name for constants`', type=str)
62  parser.add_argument('-o','--outfile', dest='outfile', default="Float.db", help='Output sqlite file', type=str)
63  parser.add_argument('-c','--isSC', dest='supercells', default=False, action="store_true", help='is SC data ?')
64  parser.add_argument('-m','--nocheck', dest='check', default=True, action="store_false", help='check input file ?')
65 
66  args = parser.parse_args()
67  if help in args and args.help is not None and args.help:
68  parser.print_help()
69  sys.exit(0)
70 
71  for _, value in args._get_kwargs():
72  if value is not None:
73  print(value)
74 
75  from AthenaConfiguration.AllConfigFlags import initConfigFlags
77  from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags
78  addLArCalibFlags(flags, args.supercells)
79 
80  flags.Input.Files=[]
81  flags.LArCalib.isSC = args.supercells
82  flags.LArCalib.Input.RunNumbers = [404400,]
83  flags.Input.RunNumbers=flags.LArCalib.Input.RunNumbers
84 
85  flags.IOVDb.DatabaseInstance="CONDBR2"
86  flags.IOVDb.DBConnection="sqlite://;schema=" + args.outfile +";dbname=CONDBR2"
87 
88  flags.LAr.doAlign=False
89  from AthenaConfiguration.TestDefaults import defaultGeometryTags
90  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
91 
92  #The global tag we are working with
93  flags.IOVDb.GlobalTag = "LARCALIB-RUN2-00"
94 
95  # misusing these flags, but do not want to introduce new ones
96  flags.LArCalib.DetCellParams.Folder=args.fld
97  flags.LArCalib.Input.Files=[args.infile]
98  flags.LArCalib.Input.Type=args.tag
99  flags.LArCalib.Input.SubDet=args.blb
100 
101  flags.LArCalib.doValidation=args.check
102 
103  #Define the global output Level:
104  from AthenaCommon.Constants import INFO
105  flags.Exec.OutputLevel = INFO
106 
107  flags.Detector.GeometryID = False
108  flags.Detector.GeometryITk = False
109  flags.Detector.GeometryHGTD = False
110  flags.Detector.GeometryCalo = False
111  flags.Detector.GeometryMuon = False
112  flags.Detector.GeometryForward = False
113 
114  flags.lock()
115 
116  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
117 
118  cfg=MainServicesCfg(flags)
119  cfg.merge(LArFlatFromFileCfg(flags))
120 
121 
122  cfg.run(1)
123 
LArFlatFromFileConfig.LArFlatFromFileCfg
def LArFlatFromFileCfg(flags)
Definition: LArFlatFromFileConfig.py:5
OutputConditionsAlgConfig.OutputConditionsAlgCfg
def OutputConditionsAlgCfg(flags, name="OutputConditionsAlg", outputFile='condobjs.root', **kwargs)
Definition: OutputConditionsAlgConfig.py:5
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.LArCalibBaseConfig.LArCalibBaseCfg
def LArCalibBaseCfg(flags)
Definition: LArCalibBaseConfig.py:5
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.LArCalibConfigFlags.addLArCalibFlags
def addLArCalibFlags(flags, isSC=False)
Definition: LArCalibConfigFlags.py:3