ATLAS Offline Software
Loading...
Searching...
No Matches
LArNewCalib_FillOFCPhase.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4
5from AthenaConfiguration.ComponentFactory import CompFactory
6from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7
8if __name__=='__main__':
9
10 import os,sys
11 import argparse
12 import subprocess
13 from AthenaCommon import Logging
14 log = Logging.logging.getLogger( 'LArSC2Ntuple' )
15
16 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
17
18 parser.add_argument('-i','--infile', dest='inpfile', default="OFC_phase.dat", help='Input filename', type=str)
19 parser.add_argument('-k','--outkey', dest='outkey', default="LArOFCPhase", help='phase container key', type=str)
20 parser.add_argument('-c','--isSC', dest='supercells', default=False, action="store_true", help='is SC data ?')
21 parser.add_argument('-a','--hasid', dest='hasid', default=False, action="store_true", help='has ID in input ?')
22 parser.add_argument('-d','--default', dest='defaultphase', default=0, help='if not in input', type=int)
23 parser.add_argument('-f','--folder', dest='folder', default="/LAR/ElecCalibOfl/OFCBin/Dummy", help=' folder name', type=str)
24 parser.add_argument('-t','--tag', dest='tag', default="LArOFCPhase-01", help='folder tag', type=str)
25 parser.add_argument('-o','--outsql', dest='outsql', default="OFCPhase.db", help='output sqlite filename', type=str)
26 parser.add_argument('-p','--outp', dest='outpool', default="ofc_phase.pool.root", help='output pool filename', type=str)
27 parser.add_argument('--poolcat', dest='poolcat', default="PoolFileCatalog.xml", help='Catalog of POOL files', type=str)
28
29
30 args = parser.parse_args()
31 if help in args and args.help is not None and args.help:
32 parser.print_help()
33 sys.exit(0)
34
35 for _, value in args._get_kwargs():
36 if value is not None:
37 print(value)
38
39 # now set flags according parsed options
40
41 #Import the MainServices (boilerplate)
42 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
43
44 #Import the flag-container that is the arguemnt to the configuration methods
45 from AthenaConfiguration.AllConfigFlags import initConfigFlags
46 flags=initConfigFlags()
47 from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags
48 addLArCalibFlags(flags, args.supercells)
49
50 flags.Input.Files=[]
51 flags.LArCalib.Input.Files = [ ]
52 flags.LArCalib.Input.RunNumbers = [9999999]
53
54 flags.LArCalib.IOVStart=0
55
56 flags.LArCalib.isSC = args.supercells
57
58 flags.IOVDb.DBConnection="sqlite://;schema=" + args.outsql +";dbname=CONDBR2"
59
60 #The global tag we are working with
61 flags.IOVDb.GlobalTag = "CONDBR2-BLKPA-2024-02"
62
63
64 from AthenaConfiguration.TestDefaults import defaultGeometryTags
65 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
66
67 #Define the global output Level:
68 from AthenaCommon.Constants import INFO,DEBUG
69 flags.Exec.OutputLevel = INFO
70
71 flags.lock()
72
73 cfg=MainServicesCfg(flags)
74
75 #Get basic services and cond-algos
76 from LArCalibProcessing.LArCalibBaseConfig import LArCalibBaseCfg
77 cfg.merge(LArCalibBaseCfg(flags))
78
79
80 LArOFPhaseFill = CompFactory.getComp('LArOFPhaseFill')("LArOFPhaseFill")
81 LArOFPhaseFill.InputFile = args.inpfile
82 LArOFPhaseFill.keyOFCBin = args.outkey
83 LArOFPhaseFill.isSC = args.supercells
84 LArOFPhaseFill.isID = args.hasid
85 LArOFPhaseFill.DefaultPhase = args.defaultphase
86 LArOFPhaseFill.GroupingType = "ExtendedSubDetector" if not args.supercells else "SuperCells"
87 LArOFPhaseFill.OutputLevel = DEBUG
88
89 cfg.addEventAlgo(LArOFPhaseFill)
90
91 from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
92 cfg.merge(OutputConditionsAlgCfg(flags,
93 outputFile=args.outpool,
94 ObjectList=["LArOFCBinComplete#"+args.outkey+"#"+args.folder,],
95 IOVTagList=[args.tag,],
96 Run1=flags.LArCalib.IOVStart,
97 Run2=flags.LArCalib.IOVEnd
98 ))
99 cfg.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = False))
100
101 #MC Event selector since we have no input data file
102 from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
103 cfg.merge(McEventSelectorCfg(flags,
104 RunNumber = flags.LArCalib.Input.RunNumbers[0],
105 EventsPerRun = 1,
106 FirstEvent = 1,
107 InitialTimeStamp = 0,
108 TimeStampInterval = 1))
109
110 cfg.getService("IOVDbSvc").DBInstance="CONDBR2"
111 cfg.getService("MessageSvc").defaultLimit=9999999
112 cfg.getService("PoolSvc").WriteCatalog="xmlcatalog_file:%s"%args.poolcat
113
114 print("Start running...")
115 cfg.run(1)
116
117
void print(char *figname, TCanvas *c1)