ATLAS Offline Software
Loading...
Searching...
No Matches
LArNewCalib_DelayDump_OFC_Cali.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4#
5
6if __name__=='__main__':
7
8 import os,sys
9 import argparse
10
11 # now process the CL options and assign defaults
12 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
13 #parser.add_argument('-r','--runlist', dest='runlist', default=RunNumberList, nargs='+', help='Run numbers string list', type=str)
14 parser.add_argument('-r','--run', dest='run', default='00408918', help='Run number string as in input filename', type=str)
15 parser.add_argument('-g','--gain', dest='gain', default="MEDIUM", help='Gain string', type=str)
16 parser.add_argument('-i','--infile', dest='infile', default="", help='Input POOL file to dump', type=str)
17 parser.add_argument('-e','--outrdir', dest='outrdir', default="/eos/atlas/atlascerngroupdisk/det-larg/Temp/Weekly/ntuples", help='Output root file directory', type=str)
18 parser.add_argument('-o','--outrwavefile', dest='outrwavefile', default="", help='Output CaliWave root file name', type=str)
19 parser.add_argument('-p','--outrofcfile', dest='outrofcfile', default="", help='Output OFC root file name', type=str)
20 parser.add_argument('-c','--isSC', dest='supercells', default=False, action='store_true', help='is SC data ?')
21 parser.add_argument('-b','--badchansqlite', dest='badsql', default="SnapshotBadChannel.db", help='Input sqlite file for bad channels', type=str)
22
23 args = parser.parse_args()
24 if help in args and args.help is not None and args.help:
25 parser.print_help()
26 sys.exit(0)
27
28 for _, value in args._get_kwargs():
29 if value is not None:
30 print(value)
31
32 # now set flags according parsed options
33
34 #Import the configution-method we want to use (here: Pedestal and AutoCorr)
35 from LArCalibProcessing.LArCalib_Delay_OFCCaliConfig import LArDelay_OFCCali_PoolDumpCfg
36
37 #Import the MainServices (boilerplate)
38 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
39
40 #Import the flag-container that is the arguemnt to the configuration methods
41 from AthenaConfiguration.AllConfigFlags import initConfigFlags
42 flags=initConfigFlags()
43 from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags
44 addLArCalibFlags(flags)
45
46 #Now we set the flags as required for this particular job:
47 #The following flags help finding the input bytestream files:
48 flags.Input.Files=[]
49 flags.LArCalib.Input.Files = [ args.infile ]
50 flags.LArCalib.Input.RunNumbers = [int(args.run),]
51 flags.Input.RunNumbers = [int(args.run)]
52 gainNumMap={"HIGH":0,"MEDIUM":1,"LOW":2}
53 flags.LArCalib.Gain=gainNumMap[args.gain.upper()]
54
55 # others flags settings
56 flags.LArCalib.isSC = args.supercells
57
58 #Configure the Bad-Channel database we are reading
59 #(the AP typically uses a snapshot in an sqlite file
60 flags.LArCalib.BadChannelTag = "-RUN2-UPD3-00"
61 flags.LArCalib.BadChannelDB = args.badsql
62
63 #Output of this job
64 # if filenames not defined, change .pool.root to .root in input file name
65 # and add CaliWave or OFC, if not part of the name
66 import os.path
67 if not args.outrwavefile:
68 inbase=os.path.basename(args.infile)
69 idx=inbase.find('.pool.root')
70 if idx != -1:
71 OutputCaliWaveRootFileName = inbase[0:idx]+'.root'
72 else:
73 OutputCaliWaveRootFileName = 'LArCaliWave.root'
74 else:
75 OutputCaliWaveRootFileName = args.outrwavefile
76
77 if not args.outrofcfile:
78 inbase=os.path.basename(args.infile)
79 idx=inbase.find('.pool.root')
80 if idx != -1:
81 OutputOFCCaliRootFileName = inbase[0:idx]+'.root'
82 else:
83 OutputOFCCaliRootFileName = 'LArOFCCali.root'
84 else:
85 OutputOFCCaliRootFileName = args.outrofcfile
86
87 flags.LArCalib.Output.ROOTFile = args.outrdir + "/" + OutputCaliWaveRootFileName
88 flags.LArCalib.Output.ROOTFile2 = args.outrdir + "/" + OutputOFCCaliRootFileName
89
90 #The global tag we are working with
91 flags.IOVDb.GlobalTag = "LARCALIB-RUN2-00"
92
93 from AthenaConfiguration.TestDefaults import defaultGeometryTags
94 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
95
96 #Define the global output Level:
97 from AthenaCommon.Constants import INFO
98 flags.Exec.OutputLevel = INFO
99
100 flags.lock()
101
102 cfg = MainServicesCfg(flags)
103 cfg.merge(LArDelay_OFCCali_PoolDumpCfg(flags))
104 cfg.getService("IOVDbSvc").DBInstance=""
105 cfg.getService("IOVDbSvc").forceRunNumber=int(args.run)
106
107 #MC Event selector since we have no input data file
108 from AthenaConfiguration.ComponentFactory import CompFactory
109 mcCnvSvc = CompFactory.McCnvSvc()
110 cfg.addService(mcCnvSvc)
111 cfg.addService(CompFactory.EvtPersistencySvc("EventPersistencySvc",CnvServices=[mcCnvSvc.getFullJobOptName(),]))
112 eventSelector=CompFactory.McEventSelector("EventSelector",
113 RunNumber = flags.LArCalib.Input.RunNumbers[0],
114 EventsPerRun = 1,
115 FirstEvent = 0,
116 InitialTimeStamp = 0,
117 TimeStampInterval = 1
118 )
119
120 cfg.addService(eventSelector)
121
122 #run the application
123 cfg.run(1)
124
void print(char *figname, TCanvas *c1)