ATLAS Offline Software
Loading...
Searching...
No Matches
LArR4ElecCalibCalcConfig.py
Go to the documentation of this file.
1#!/usr/bin/env athena.py
2# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.MainServicesConfig import MainServicesCfg
7
9 #Get basic services and cond-algos
10 result=ComponentAccumulator()
11
12 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
13 result.merge(LArGMCfg(flags))
14 from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
15 result.merge(LArOnOffIdMappingCfg(flags))
16
17
18 from LArRecUtils.LArRecUtilsConfig import LArMCSymCondAlgCfg
19 result.merge (LArMCSymCondAlgCfg (flags))
20
21 from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg
22 result.merge(LArElecCalibDBCfg(flags,["DAC2uA","uA2MeV"]))
23
24
25 theLArElecCalibCalculator = CompFactory.LArR4ElecCalibCalculator(OutputLevel=1)
26
27 result.addEventAlgo(theLArElecCalibCalculator)
28
29 theLArCompleteToFlat = CompFactory.LArCompleteToFlat(FolderBase="/LAR/ElecCalibMC",
30 nGains=2,
31 PedestalInput="Pedestal",
32 RampInput="RampSym",
33 NoiseInput="LArNoiseSym")
34
35 result.addEventAlgo(theLArCompleteToFlat)
36
37 #Output (POOL + sqlite) file writing:
38 from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
39 result.merge(OutputConditionsAlgCfg(flags,
40 CrestDir="./crestOut",
41 ObjectList=["CondAttrListCollection#/LAR/ElecCalibMC/Ramp#/LAR/ElecCalibMC/Ramp",
42 "CondAttrListCollection#/LAR/ElecCalibMC/Pedestal#/LAR/ElecCalibMC/Pedestal",
43 "CondAttrListCollection#/LAR/ElecCalibMC/Noise#/LAR/ElecCalibMC/Noise"],
44 IOVTagList=["LARElecCalibMCRamp-R4-00",
45 "LARElecCalibMCPedestal-R4-00",
46 "LARElecCalibMCNoise-R4-00"],
47 Run1=flags.LArCalib.IOVStart,
48 Run2=flags.LArCalib.IOVEnd
49 ))
50
51 #RegistrationSvc
52 #result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = True))
53
54
55
56
57
58 #ROOT ntuple writing:
59 rootfile=flags.LArCalib.Output.ROOTFile
60
61 if rootfile != "":
62 result.addEventAlgo(CompFactory.LArNoise2Ntuple(ContainerKey="LArNoiseSym",
63 nGains=2,
64 AddFEBTempInfo = False,
65 RealGeometry = False,
66 OffId = True,
67 BadChanKey = "",
68 ))
69
70
71 result.addEventAlgo(CompFactory.LArRamps2Ntuple( RampKey="LArRampSym",
72 nGains=2,
73 ContainerKey = [], #for RawRamp
74 AddFEBTempInfo = False,
75 RealGeometry = False,
76 OffId = True,
77 AddCalib = False,
78 RawRamp = False,
79 SaveAllSamples = False,
80 BadChanKey = "",
81 ApplyCorr=False,
82 ))
83 import os
84 if os.path.exists(rootfile):
85 os.remove(rootfile)
86 result.addService(CompFactory.NTupleSvc(Output = [ "FILE1 DATAFILE='"+rootfile+"' OPT='NEW'" ]))
87 result.setAppProperty("HistogramPersistency","ROOT")
88 pass # end if ROOT ntuple writing
89
90
91 from LArRecUtils.LArADC2MeVCondAlgConfig import LArADC2MeVCondAlgCfg
92 result.merge(LArADC2MeVCondAlgCfg(flags))
93 result.getCondAlgo("LArADC2MeVCondAlg").OutputLevel=2
94 result.addEventAlgo(CompFactory.LArADC2MeV2Ntuple( OffId=True,
95 AddBadChannelInfo=False,
96 nGains=2,
97 ))
98
99
100 result.addEventAlgo(CompFactory.LAruA2MeV2Ntuple(uA2MeVKey="LAruA2MeVSym",
101 DAC2uAKey="LArDAC2uASym",
102 isSC = False,
103 OffId=True,
104 nGains=2,
105 AddBadChannelInfo=False
106 ))
107
108
109 #MC Event selector since we have no input data file
110 from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
111 result.merge(McEventSelectorCfg(flags,
112 RunNumber = 500000,
113 EventsPerRun = 1,
114 FirstEvent = 1,
115 InitialTimeStamp = 0,
116 TimeStampInterval = 1))
117
118 from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
119 result.merge(PerfMonMTSvcCfg(flags))
120
121 return result
122
123
124if __name__ == "__main__":
125 from AthenaConfiguration.AllConfigFlags import initConfigFlags
126 from AthenaConfiguration.Enums import LHCPeriod
127 from AthenaConfiguration.TestDefaults import defaultGeometryTags
128 from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags
129 import sys
130 ConfigFlags=initConfigFlags()
131 addLArCalibFlags(ConfigFlags)
132
133 ConfigFlags.LArCalib.Input.Database="LArR4ElecCalib.sqlite"
134 ConfigFlags.LArCalib.Output.POOLFile="LArR4ElecCalib.pool.root"
135 ConfigFlags.LArCalib.Output.ROOTFile="LArR4ElecCalib.root"
136
137 ConfigFlags.IOVDb.GlobalTag="COND-MC21-SDR-RUN4-05"
138 ConfigFlags.GeoModel.Run=LHCPeriod.Run4
139 ConfigFlags.IOVDb.UseCREST=True
140 ConfigFlags.GeoModel.AtlasVersion=defaultGeometryTags.RUN4
141 ConfigFlags.Input.isMC=True
142 ConfigFlags.Common.MsgSuppression = False
143 ConfigFlags.fillFromArgs()
144
145 print ("Input files to be processed:")
146 for f in ConfigFlags.Input.Files:
147 print (f)
148
149 ConfigFlags.lock()
150 cfg=MainServicesCfg(ConfigFlags)
151 cfg.merge(LArR4ElecCalibCalcCfg (ConfigFlags))
152 cfg.getService("IOVDbSvc").DBInstance=""
153 print("Start running...")
154 sys.exit(cfg.run(1).isFailure())
155
void print(char *figname, TCanvas *c1)