ATLAS Offline Software
LArCalib_postProcessingConfig.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 
4 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5 from LArCalibProcessing.LArCalib_OFCPhysConfig import LArOFCPhysCfg
6 from LArCalibProcessing.LArCalib_PileUpAutoCorrConfig import LArPileUpAutoCorrCfg
7 from LArCalibProcessing.LArCalib_OFPhasePickerConfig import LArOFPhasePickerCfg
8 
9 
10 def finalOFCShapeCfg(flags):
11  result=ComponentAccumulator()
12 
13  # Calculate pile-up AC for given mu
14  result.merge(LArPileUpAutoCorrCfg(flags))
15 
16  #Calculate OFCs and Shape (various flavors)
17  result.merge(LArOFCPhysCfg(flags,loadPhysAC=False))
18 
19  #Pick OFC-Phase + shape correction
20  result.merge(LArOFPhasePickerCfg(flags,InputSCOFCPhaseDb = "LAR_OFL", SCOFCPhaseTag="LARElecCalibOflSCOFCBinPhysShift-UPD3-00", loadInputs=False))
21 
22  return result
23 
24 if __name__=="__main__":
25  import sys
26  import argparse
27 
28  # now process the CL options and assign defaults
29  parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
30  parser.add_argument('-r','--run', dest='run', default=str(0x7FFFFFFF), help='Run number to query input DB', type=str)
31  parser.add_argument('-i','--insqlite', dest='insql', default="freshConstants_AP.db", help='Input sqlite file containing the (merged) output of the AP.', type=str)
32  parser.add_argument('-o','--outsqlite', dest='outsql', default="freshConstants_merged.db", help='Output sqlite file', type=str)
33  parser.add_argument('--poolfile', dest='poolfile', default="freshConstants_pp.pool.root", help='Output pool file', type=str)
34  parser.add_argument('--rootfile', dest='rootfile', default="freshConstants_pp.root", help='Output ROOT file', type=str)
35  parser.add_argument('--iovstart',dest="iovstart", default=0, help="IOV start (run-number)", type=int)
36  parser.add_argument('--isSC', dest='supercells', default=False, help='is SC data ?', action="store_true")
37  parser.add_argument('--poolcat', dest='poolcat', default="freshConstants.xml", help='Catalog of POOL files', type=str)
38  parser.add_argument('--Ncoll',dest='Ncoll', default=60, help='Number of MinBias collision assumed for pile-up OFCs', type=int)
39  parser.add_argument('--Nsamp',dest='Nsamp', default=4, help='Number of samples used for physics OFCs', type=int)
40  parser.add_argument('--usePed',dest='pedcons', default=False, help='use additional pedestal constraint ?', action="store_true")
41 
42  args = parser.parse_args()
43  if help in args and args.help is not None and args.help:
44  parser.print_help()
45  sys.exit(0)
46 
47  for _, value in args._get_kwargs():
48  if value is not None:
49  print(_,":",value)
50 
51 
52  #Import the MainServices (boilerplate)
53  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
54 
55  #Import the flag-container that is the arguemnt to the configuration methods
56  from AthenaConfiguration.AllConfigFlags import initConfigFlags
57  from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags
59  addLArCalibFlags(flags, args.supercells)
60 
61  #Now we set the flags as required for this particular job:
62  #The following flags help finding the input bytestream files:
63  flags.LArCalib.Input.RunNumbers = [int(args.run),]
64  flags.LArCalib.Input.Database = args.insql
65  flags.IOVDb.SqliteInput=args.insql
66  if args.supercells:
67  flags.IOVDb.SqliteFolders=("/LAR/ElecCalibOflSC/PhysWaves/RTM","/LAR/ElecCalibOflSC/AutoCorrs/AutoCorr")
68  flags.LArCalib.OFC.ShapeCorrection=False
69  else:
70  flags.IOVDb.SqliteFolders=("/LAR/ElecCalibOfl/PhysWaves/RTM","/LAR/ElecCalibOfl/AutoCorrs/AutoCorr")
71  flags.LArCalib.OFC.ShapeCorrection=True
72 
73  flags.LArCalib.Output.ROOTFile = args.rootfile
74  flags.LArCalib.Output.POOLFile = args.poolfile
75  #flags.LArCalib.Output.ROOTFile2 ="freshConstants2_pp.pool.root"
76  flags.IOVDb.DBConnection="sqlite://;schema="+args.outsql +";dbname=CONDBR2"
77 
78  #The global tag we are working with
79  flags.IOVDb.GlobalTag = "LARCALIB-RUN2-00"
80  # geometry
81  from AthenaConfiguration.TestDefaults import defaultGeometryTags
82  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
83 
84  flags.Input.Files=[]
85  flags.LArCalib.Input.Files = [ ]
86  flags.LArCalib.OFC.Ncoll = args.Ncoll
87  flags.LArCalib.OFC.Nsamples = args.Nsamp
88  flags.LArCalib.OFC.usePed = args.pedcons
89  flags.LArCalib.IOVStart = args.iovstart
90 
91  flags.LArCalib.PhysACuseHG=True
92  flags.LArCalib.OFC.UsePhysCalibTDiff = False
93 
94  flags.LAr.doAlign=False
95  flags.Input.RunNumbers=flags.LArCalib.Input.RunNumbers
96 
97  flags.lock()
98 
99  cfg=MainServicesCfg(flags)
100  cfg.merge(finalOFCShapeCfg(flags))
101 
102  cfg.getService("PoolSvc").ReadCatalog+=["xmlcatalog_file:%s"%args.poolcat,]
103  cfg.getService("PoolSvc").WriteCatalog="xmlcatalog_file:%s"%args.poolcat
104 
105  sys.exit(cfg.run(1).isFailure())
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.LArCalib_PileUpAutoCorrConfig.LArPileUpAutoCorrCfg
def LArPileUpAutoCorrCfg(flags)
Definition: LArCalib_PileUpAutoCorrConfig.py:7
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:26
python.LArCalib_OFCPhysConfig.LArOFCPhysCfg
def LArOFCPhysCfg(flags, loadPhysAC=True)
Definition: LArCalib_OFCPhysConfig.py:124
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.LArCalib_OFPhasePickerConfig.LArOFPhasePickerCfg
def LArOFPhasePickerCfg(flags, loadInputs=True, InputSCOFCPhaseDb="", SCOFCPhaseTag="", InputSCOFCWeightDb="", SCOFCWeightTag="")
Definition: LArCalib_OFPhasePickerConfig.py:138
str
Definition: BTagTrackIpAccessor.cxx:11
python.LArCalibConfigFlags.addLArCalibFlags
def addLArCalibFlags(flags, isSC=False)
Definition: LArCalibConfigFlags.py:3
python.LArCalib_postProcessingConfig.finalOFCShapeCfg
def finalOFCShapeCfg(flags)
Definition: LArCalib_postProcessingConfig.py:10