ATLAS Offline Software
Loading...
Searching...
No Matches
LArPhysWaveFromTupleConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentFactory import CompFactory
4from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5
6
7def LArPhysWaveFromTupleCfg(flags,InputRootFile='PhysWave.root',
8 OutputTag='-calib-00', **kwargs):
9
10 cfg=ComponentAccumulator()
11 from AthenaCommon.Logging import logging
12 mlog = logging.getLogger( 'LArPhysWaveFromTuple' )
13 if not flags.hasCategory('LArCalib'):
14 mlog.error("We need the LArCalib flags")
15 return cfg
16
17 if flags.LArCalib.isSC:
18 mlog.info("Running for SC")
19
20 from LArCalibProcessing.LArCalibBaseConfig import LArCalibBaseCfg
21 cfg.merge(LArCalibBaseCfg(flags))
22
23 from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
24 cfg.merge(LArOnOffIdMappingCfg(flags))
25
26 if 'NtupleName' not in kwargs:
27 kwargs.setdefault('NtupleName', 'PHYSWAVE')
28 if 'SkipPoints' not in kwargs:
29 kwargs.setdefault('SkipPoints', 0)
30 if 'PrefixPoints' not in kwargs:
31 kwargs.setdefault('PrefixPoints', 0)
32 if 'StoreKey' not in kwargs:
33 kwargs.setdefault('StoreKey', 'LArPhysWaveIdeal')
34
35 algo = CompFactory.LArPhysWaveFromTuple("LArPhysWaveFromTuple", **kwargs)
36 algo.FileName = InputRootFile
37 algo.GroupingType = flags.LArCalib.GroupingType
38 algo.isSC = flags.LArCalib.isSC
39
40 cfg.addEventAlgo(algo)
41
42 if flags.LArCalib.Output.ROOTFile != "":
43
44 ntdump = CompFactory.LArPhysWaves2Ntuple( "LArPhysWaves2Ntuple" )
45 ntdump.NtupleName = "PHYSWAVE"
46 ntdump.KeyList = [ kwargs['StoreKey'] ]
47 ntdump.SaveDerivedInfo = True
48 if flags.LArCalib.isSC:
49 ntdump.isSC = flags.LArCalib.isSC
50 ntdump.BadChanKey = "LArBadChannelSC"
51
52 cfg.addEventAlgo(ntdump)
53
54 cfg.addService(CompFactory.NTupleSvc(Output = [ "FILE1 DATAFILE='"+flags.LArCalib.Output.ROOTFile+"' OPT='NEW'" ]))
55 cfg.setAppProperty("HistogramPersistency","ROOT")
56
57 if ( flags.LArCalib.Output.POOLFile != "" ):
58
59 OutputObjectSpecPhysWave = "LArPhysWaveContainer#"+kwargs['StoreKey']+"#"+ flags.LArCalib.PhysWave.Folder
60 OutputObjectSpecTagPhysWave = ''.join(flags.LArCalib.PhysWave.Folder.split('/')) + OutputTag
61
62 from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
63 cfg.merge(OutputConditionsAlgCfg(flags,
64 outputFile=flags.LArCalib.Output.POOLFile,
65 ObjectList=[OutputObjectSpecPhysWave],
66 IOVTagList=[OutputObjectSpecTagPhysWave],
67 Run1=flags.LArCalib.IOVStart,
68 Run2=flags.LArCalib.IOVEnd
69 ))
70
71 cfg.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = True))
72
73
74 cfg.getService("IOVDbSvc").DBInstance=""
75
76 return cfg
77
78
79if __name__ == "__main__":
80
81 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
82 from AthenaConfiguration.AllConfigFlags import initConfigFlags
83 from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags
84 flags=initConfigFlags()
85 addLArCalibFlags(flags,isSC=True)
86
87 flags.Input.Files=[]
88 flags.Input.RunNumbers=[440000,]
89 flags.Input.ConditionsRunNumber=440000
90 flags.Input.OverrideRunNumber=True
91
92 flags.LArCalib.PhysWave.Folder="/LAR/ElecCalibOflSC/PhysWaves/FCALmeasured"
93 flags.LArCalib.Output.ROOTFile="LArPhysWave_FCAL_SC.root"
94 flags.LArCalib.Output.POOLFile="LArPhysWave_FCAL_SC.pool.root"
95 flags.LArCalib.GroupingType="SuperCells"
96 flags.IOVDb.DBConnection="sqlite://;schema=fcal_measured.sqlite;dbname=CONDBR2"
97 flags.IOVDb.GlobalTag="LARCALIB-RUN2-00"
98 flags.IOVDb.DatabaseInstance="CONDBR2"
99 from AthenaConfiguration.TestDefaults import defaultGeometryTags
100 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
101
102
103 flags.fillFromArgs()
104 flags.lock()
105
106
107 cfg=MainServicesCfg(flags)
108 cfg.merge(LArPhysWaveFromTupleCfg(flags,InputRootFile="shape_patched.root",NtupleName="PHYSWAVE", OutputTag="-data-00"))
109
110 cfg.run(1)
111
LArPhysWaveFromTupleCfg(flags, InputRootFile='PhysWave.root', OutputTag='-calib-00', **kwargs)