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,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 ?', type=bool)
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  args = parser.parse_args()
40  if help in args and args.help is not None and args.help:
41  parser.print_help()
42  sys.exit(0)
43 
44 
45 
46 
47  #Import the MainServices (boilerplate)
48  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
49 
50  #Import the flag-container that is the arguemnt to the configuration methods
51  from AthenaConfiguration.AllConfigFlags import initConfigFlags
52  from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags
54  addLArCalibFlags(flags, args.supercells)
55 
56  #Now we set the flags as required for this particular job:
57  #The following flags help finding the input bytestream files:
58  flags.LArCalib.Input.RunNumbers = [int(args.run),]
59  flags.LArCalib.Input.Database = args.insql
60  flags.IOVDb.SqliteInput=args.insql
61  flags.IOVDb.SqliteFolders=("/LAR/ElecCalibOfl/PhysWaves/RTM","/LAR/ElecCalibOfl/AutoCorrs/AutoCorr","/LAR/ElecCalibOfl/AutoCorrs/PhysicsAutoCorr")
62 
63  flags.LArCalib.Output.ROOTFile = args.rootfile
64  flags.LArCalib.Output.POOLFile = args.poolfile
65  #flags.LArCalib.Output.ROOTFile2 ="freshConstants2_pp.pool.root"
66  flags.IOVDb.DBConnection="sqlite://;schema="+args.outsql +";dbname=CONDBR2"
67 
68  #The global tag we are working with
69  flags.IOVDb.GlobalTag = "LARCALIB-RUN2-00"
70  # geometry
71  from AthenaConfiguration.TestDefaults import defaultGeometryTags
72  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
73 
74  flags.Input.Files=[]
75  flags.LArCalib.Input.Files = [ ]
76  flags.LArCalib.OFC.Ncoll = args.Ncoll
77  flags.LArCalib.IOVStart = args.iovstart
78 
79  flags.LArCalib.PhysACuseHG=True
80  flags.LArCalib.OFC.ShapeCorrection=True
81  flags.LArCalib.OFC.UsePhysCalibTDiff = False
82 
83  flags.LAr.doAlign=False
84  flags.Input.RunNumbers=flags.LArCalib.Input.RunNumbers
85 
86 
87  flags.lock()
88 
89  cfg=MainServicesCfg(flags)
90  cfg.merge(finalOFCShapeCfg(flags))
91 
92  cfg.getService("PoolSvc").ReadCatalog+=["xmlcatalog_file:%s"%args.poolcat,]
93  cfg.getService("PoolSvc").WriteCatalog="xmlcatalog_file:%s"%args.poolcat
94 
95  sys.exit(cfg.run(1).isFailure())
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.LArCalib_OFPhasePickerConfig.LArOFPhasePickerCfg
def LArOFPhasePickerCfg(flags, loadInputs=True, InputSCOFCPhaseDb="/afs/cern.ch/user/p/pavol/w0/public/DB_update_22/fillDB/SCOFCPhase.db", SCOFCPhaseTag="LARElecCalibOflSCOFCBinPhysShift-07", InputSCOFCWeightDb="", SCOFCWeightTag="")
Definition: LArCalib_OFPhasePickerConfig.py:135
python.LArCalib_PileUpAutoCorrConfig.LArPileUpAutoCorrCfg
def LArPileUpAutoCorrCfg(flags)
Definition: LArCalib_PileUpAutoCorrConfig.py:7
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
python.LArCalib_OFCPhysConfig.LArOFCPhysCfg
def LArOFCPhysCfg(flags, loadPhysAC=True)
Definition: LArCalib_OFCPhysConfig.py:119
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
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