5 from AthenaConfiguration.ComponentFactory
import CompFactory
7 if __name__==
'__main__':
11 from AthenaCommon
import Logging
12 log = Logging.logging.getLogger(
'LArDigits2Ntuple' )
14 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
16 parser.add_argument(
'-i',
'--indir', dest=
'indir', default=
"/eos/atlas/atlastier0/rucio/data_test/calibration_pulseall/00414414/data_test.00414414.calibration_pulseall.daq.RAW/", help=
'input files dir', type=str)
17 parser.add_argument(
'-p',
'--inprefix', dest=
'inpref', default=
"data_test", help=
'Input filenames prefix', type=str)
18 parser.add_argument(
'-y',
'--inppatt', dest=
'inppatt', default=
"lb3512", help=
'Input filenames pattern', type=str)
19 parser.add_argument(
'-f',
'--infile', dest=
'infile', default=
"", help=
'Input filename (if given indir and inprefix are ignored', type=str)
20 parser.add_argument(
'-r',
'--run', dest=
'run', default=0, help=
'Run number (if not given trying to judge from input file name)', type=int)
21 parser.add_argument(
'-m',
'--maxev', dest=
'maxev', default=-1, help=
'Max number of events to dump', type=int)
22 parser.add_argument(
'-x',
'--outlevel', dest=
'olevel', default=3, help=
'OuputLevel for dumping algo', type=int)
23 parser.add_argument(
'-o',
'--outfile', dest=
'outfile', default=
"Digits.root", help=
'Output root filename', type=str)
24 parser.add_argument(
'-n',
'--nsamp', dest=
'nsamp', default=0, help=
'Number of samples to dump', type=int)
25 parser.add_argument(
'-d',
'--addHash', dest=
'ahash', default=
False, help=
'Add hash number to output ntuple', type=bool)
26 parser.add_argument(
'-j',
'--addOffline', dest=
'offline', default=
False, help=
'Add offline Id to output ntuple', type=bool)
27 parser.add_argument(
'-k',
'--addCalib', dest=
'calib', default=
False, help=
'Add calib. info to output ntuple', type=bool)
28 parser.add_argument(
'-t',
'--addGeom', dest=
'geom', default=
False, help=
'Add real geom info to output ntuple', type=bool)
29 parser.add_argument(
'-u',
'--addBC', dest=
'bc', default=
False, help=
'Add Bad. chan info to output ntuple', type=bool)
30 parser.add_argument(
'-v',
'--addEvTree', dest=
'evtree', default=
False, help=
'Add tree with per event info to output ntuple', type=bool)
31 parser.add_argument(
'--EMF', dest=
'emf', default=
False, help=
'Is it for EMF', action=
'store_true')
33 args = parser.parse_args()
34 if help
in args
and args.help
is not None and args.help:
38 for _, value
in args._get_kwargs():
43 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
47 from LArCafJobs.LArSCDumperFlags
import addSCDumpFlags
51 if len(args.infile) > 0:
52 flags.Input.Files = [args.infile]
53 elif len(args.inppatt) > 0:
54 from LArCalibProcessing.GetInputFiles
import GetInputFilesFromPattern
57 from LArCalibProcessing.GetInputFiles
import GetInputFilesFromPrefix
61 flags.Input.RunNumbers = [args.run]
68 log.warning(
"Could not get run info, using defaults !")
70 flags.LArSCDump.nSamples=args.nsamp
72 flags.LArSCDump.nSamples=4
74 flags.LArSCDump.nSamples=runinfo.nSamples()
76 flags.LArSCDump.digitsKey=
"FREE"
77 if args.nsamp > 0
and args.nsamp < flags.LArSCDump.nSamples:
78 flags.LArSCDump.nSamples=args.nsamp
80 log.info(
"Autoconfigured: ")
81 log.info(
"nSamples: %d digitsKey %s",flags.LArSCDump.nSamples, flags.LArSCDump.digitsKey)
84 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
85 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
88 flags.LAr.doAlign=
False
91 flags.Trigger.triggerConfig =
'DB'
92 flags.Trigger.L1.doCTP =
True
93 flags.Trigger.L1.doMuon =
False
94 flags.Trigger.L1.doCalo =
False
95 flags.Trigger.L1.doTopo =
False
97 flags.Trigger.enableL1CaloLegacy =
True
98 flags.Trigger.enableL1CaloPhase1 =
True
102 flags.IOVDb.SqliteInput=
"/afs/cern.ch/user/p/pavol/public/EMF_otherCond.db"
103 flags.IOVDb.SqliteFolders = (
"/LAR/BadChannelsOfl/BadChannels",
"/LAR/BadChannelsOfl/KnownBADFEBs",
"/LAR/BadChannelsOfl/KnownMNBFEBs",
"/LAR/BadChannelsOfl/MissingFEBs",
"/LAR/Identifier/OnOffIdMap",)
108 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
109 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
114 from LArCabling.LArCablingConfig
import LArOnOffIdMappingCfg
118 from LArCafJobs.LArSCDumperSkeleton
import L1CaloMenuCfg
120 from TrigDecisionTool.TrigDecisionToolConfig
import TrigDecisionToolCfg
127 from LArBadChannelTool.LArBadChannelConfig
import LArBadFebCfg, LArBadChannelCfg
132 log.warning(
"Adding real geometry is not working yet")
139 from LArCalibTools.LArDigits2NtupleConfig
import LArDigits2NtupleCfg
140 acc.merge(
LArDigits2NtupleCfg(flags, AddBadChannelInfo=args.bc, AddFEBTempInfo=
False, isSC=
False, isFlat=
True,
141 OffId=args.offline, AddHash=args.ahash, AddCalib=args.calib, RealGeometry=args.geom,
142 NSamples=flags.LArSCDump.nSamples, FTlist=[], ContainerKey=flags.LArSCDump.digitsKey,
144 OutputLevel=args.olevel
147 if os.path.exists(args.outfile):
148 os.remove(args.outfile)
149 acc.addService(CompFactory.NTupleSvc(Output = [
"FILE1 DATAFILE='"+args.outfile+
"' OPT='NEW'" ]))
150 acc.setAppProperty(
"HistogramPersistency",
"ROOT")
153 log.info(
"Input files to be processed:")
154 for f
in flags.Input.Files:
156 log.info(
"Output file: ")
157 log.info(args.outfile)